2020-03-07 Ludovic Courtès Bump version for Guile 2.2.7. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_REVISION): Increment. Update NEWS. * NEWS: Update. 2020-03-07 Andy Wingo Bump user-visible copyright years to 2020 * module/ice-9/command-line.scm (version-etc): * module/scripts/compile.scm (show-version): Bump to 2020. 2020-03-07 Ludovic Courtès Actually run '00-repl-server.test'. This is a followup to ddcab06f20525d975503d8d9611e02021fb0dff1. Until now the tests would always be marked as unresolved because TMPDIR was removed before the client and server had been started. * test-suite/tests/00-repl-server.test (call-with-repl-server): Remove initial call to 'rmdir'. Add calls to 'delete-file' and 'rmdir' in the unwind handler. 2020-02-12 John Paul Adrian Glaubitz Fix build on platforms where the stack grows upwards. * libguile/continuations.c (scm_dynthrow): Fix missing mra parameter to grow_stack for SCM_STACK_GROWS_UP. 2020-02-12 Ludovic Courtès Handle GMP allocations through libgc and remove bignum finalizers. This significantly speeds up loads that create lots of bignums, like (language cps slot-allocation) for files with many top-level definitions. Compiling such a file is typically 2.5 times faster. See . * libguile/numbers.c (custom_gmp_malloc): Use 'scm_gc_malloc_pointerless' instead of 'scm_malloc'. (custom_gmp_realloc): Use 'scm_gc_realloc'. (custom_gmp_free): Remove call to 'free'. (make_bignum): Use 'scm_gc_malloc' instead of 'scm_gc_malloc_pointerless'. Call 'scm_i_set_finalizer' only when SCM_INSTALL_GMP_MEMORY_FUNCTIONS is false. 2020-02-12 Ludovic Courtès Remove duplicate procedure in slot-allocation.scm. * module/language/cps/slot-allocation.scm (add-live-slot) (kill-dead-slot, compute-slot): Move higher up in the file. (compute-shuffles): Remove duplicate 'add-live-slot' procedure. 2020-02-12 Ludovic Courtès texinfo: Properly render @acronym in plain text. Fixes . Reported by Christopher Baines . * module/texinfo/plain-text.scm (acronym): New procedure. (tag-handlers): Change 'acro' handle to ACRONYM, and add 'acronym' handler. * test-suite/tests/texinfo.plain-text.test ("stexi->plain-text") ["acronym", "recursive acronym"]: New tests. 2020-02-12 Ludovic Courtès texinfo: Add '*line-width*' fluid to control line wrapping. * module/texinfo/plain-text.scm (*line-width*): New variable. (wrap*): Honor it. * doc/ref/texinfo.texi (texinfo plain-text): Document it. * test-suite/tests/texinfo.plain-text.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it. 2020-02-12 Daniel Llorens Fix check for rl_get_keymap This lets Guile build on OS X (tested on 10.14) with the system-provided libreadline. * acinclude.m4 (GUILE_READLINE): Check for rl_get_keymap_name instead of rl_get_keymap. The system provided libreadline is an alias to libedit, which has _keymap but not _keymap_name, and Guile uses both. * guile-readline/readline.c: Adjust the include guard. 2020-01-23 Rob Browning 00-repl-server.test: don't use fixed path for socket * test-suite/tests/00-repl-server.test (make-tempdir): Add. (call-with-repl-server): Store socket in a make-tempdir dir. 2020-01-12 Rob Browning Respect thread local fluid defaults Previously (fluid-ref (make-thread-local-fluid #t)) would return #f via scm_fluid_ref because the internal scm_hashq_ref would return #f when the fluid had not been set, and that was interpreted as an actual value for the fluid. Instead, just pass the fluid default as the default for the hash table lookups so that we don't need a second step to determine if the fluid was set. Thanks to Andrew Gierth for tracking down the problem. 2020-01-12 Andy Wingo Fix peval bug that ignored excess args * module/language/tree-il/peval.scm (peval): Fix arity check for type confusion (empty value of "rest" in this context was (), not #f). The effect was that we'd silently allow extra arguments to inlined calls. Thanks to Christopher Lam for the report! Fixes #38617. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2020-01-03 Ludovic Courtès web: Update comment regarding the 'tls-wrap' port wrapper. * module/web/client.scm (tls-wrap): Update comment. 2019-12-09 Ludovic Courtès Fix non-deterministic crash in 'finalization_thread_proc'. Fixes . Reported by Jesse Gibbons . * libguile/finalizers.c (finalization_thread_proc): Do not enter the "switch (data.byte)" condition when data.n <= 0. 2019-11-18 Ludovic Courtès ports: 'scm_port_poll' honors "w" flags. Fixes . Reported by Mark H Weaver . * libguile/ports.c (scm_port_poll): Replace second POLLIN by POLLOUT. 2019-07-07 Ludovic Courtès build: Do not record LDFLAGS in .pc file. Fixes . Reported by Cyprien Nicolas . * configure.ac (GUILE_LIBS): Remove $LDFLAGS. 2019-06-30 Ludovic Courtès Bump version for Guile 2.2.6. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_REVISION): Increment. Update NEWS. * NEWS: Update. REPL server: Avoid deprecated '_IOFBF'. * module/system/repl/server.scm (drain-input-and-close): Use 'block instead of _IOFBF. 2019-06-30 Ludovic Courtès 'strftime' and 'strptime' honor the locale encoding. Fixes . Reported by Christopher Lam . * libguile/stime.c (scm_strftime): Use 'scm_to_locale_stringn' instead of 'scm_to_utf8_stringn'. (scm_strptime): Likewise, and use 'scm_string_length' instead of 'u8_strnlen'. * test-suite/tests/time.test ("strftime")["strftime passes wide characters"]: Wrap body in 'with-locale'. ["strftime fr_FR.utf8", "strftime fr_FR.iso88591"]: New tests. ("strptime")["strftime fr_FR.utf8", "strftime fr_FR.iso88591"]: New tests. 2019-06-30 Ludovic Courtès doc: Document optional parameter of 'stat'. Fixes . Reported by Tim Gesthuizen . * doc/ref/posix.texi (File System): Document 'exception_on_error' parameter of 'stat'. 2019-06-30 Ludovic Courtès tests: Add (web server) test. * test-suite/tests/web-server.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it. 2019-06-30 Ludovic Courtès ports: Export 'current-load-port'. This binding was forgotten when (ice-9 ports) was introduced in 44b3342c4d5ebd4bbf21c7c7608a5f1a53ba0eb4. Thus it has always been missing in Guile 2.2. * module/ice-9/ports.scm: Export 'current-load-port'. 2019-06-24 Mark H Weaver Revert "web: Add support for HTTP header continuation lines." Fixes . This reverts commit 73cde5ed7218a090ecee888870908af5445796f0. 2019-06-24 Paul Morris doc: Fix argument list in match-lambda docs * doc/ref/match.texi: Fix argument list for match-lambda. 2019-06-24 Arun Isaac doc: Fix minor typo in the HTTP headers documentation. * doc/ref/web.texi (HTTP Headers): Fix minor typo. 2019-06-24 Ludovic Courtès Remove references to 'inet-ntoa' and 'inet-aton'. These procedures were removed in Guile 2.2 by commit fc7bd367ab4b5027a7f80686b1e229c62e43c90b (May 2011). * libguile/socket.h (scm_inet_aton, scm_inet_ntoa): Remove. * module/system/repl/server.scm (make-tcp-server-socket): Use 'inet-pton' instead of 'inet-aton'. * doc/ref/web.texi (HTTP): Likewise in 'declare-header!' example. * doc/ref/posix.texi (Network Address Conversion): Remove documentation of 'inet-ntoa' and 'inet-aton'. 2019-06-20 Ludovic Courtès Bump version for Guile 2.2.5. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment. (LIBGUILE_INTERFACE_AGE): Increment. (LIBGUILE_INTERFACE_REVISION): Reset. Copy terminating zero in 'scm_cat_path'. * libguile/script.c (scm_cat_path): Pass N + 1, not N, to 'strncat'. Reported by GCC 9.1.0. srfi-14: Fix possible buffer overrun in '%char-set-dump'. * libguile/srfi-14.c (scm_sys_char_set_dump): Change array size from 9 to 11 as suggested by GCC 9.1.0. 2019-06-19 Mark H Weaver NEWS: Add information to remaining news items. * NEWS: Update. 2019-06-18 Mark H Weaver NEWS: Fix typo. * NEWS: Fix typo. NEWS: More tweaks. * NEWS: Update. NEWS: Add more details. * NEWS: Update text. NEWS: Add more text. * NEWS: Update. NEWS: Add first draft of 2.2.5 changes. * NEWS: Add draft updates. THANKS: Christopher Allan Webber -> Christopher Lemmer Webber. * THANKS: Update name and re-sort. Update THANKS. * THANKS: Thank Christopher Allan Webber, Christopher Baines, and Timothy Sample for contributions. Thank Andrea Azzarone, Михаил Бахтерев, Jonathan Brielmaier, Josh Datko, Massimiliano Gubinelli, Arun Isaac, Shea Levy, Chris Marusich, Jan Smydke, Tom de Vries, Jeffrey Walton, and Zefram for fixes. Move Michael Talbot-Wilson and Michael Tuexen to their proper place to fix the sorting. 2019-06-18 Christopher Baines stexi->shtml: Add support for @i, @math, @tie and @dots. * module/texinfo/html.scm (tag-replacements): Add support for @i and @math. The tags used come from the texinfo documentation. (rules): Convert @tie and @dots to the appropriate HTML entities. 2019-06-18 Mark H Weaver Avoid regexp ranges in HTTP inter-protocol exploitation check. * module/system/repl/server.scm (permissive-http-request-line?): Avoid character ranges in regexp. web: Add support for HTTP header continuation lines. * module/web/http.scm (spaces-and-tabs, space-or-tab?): New variables. (read-header-line): After reading a header, if a space or tab follows, read the continuation lines and join them. * test-suite/tests/web-http.test: Add test. Rename 'scm_c_make_char' to 'scm_i_make_char'. * libguile/chars.c, libguile/chars.h, libguile/ports.c, libguile/print.c, libguile/read.c, libguile/srfi-13.c, libguile/strings.c, libguile/vm-engine.c: Rename 'scm_c_make_char' to 'scm_i_make_char'. Make 'get-bytevector-n!' suspendable. * module/ice-9/suspendable-ports.scm (get-bytevector-n!): New procedure. (get-bytevector-n): Rewrite in terms of 'get-bytevector-n!'. (port-bindings): Add 'get-bytevector-n!'. SRFI-19: Rename 'tai-epoch-in-jd' to 'utc-epoch-in-jd'. * module/srfi/srfi-19.scm: Rename 'tai-epoch-in-jd' to 'utc-epoch-in-jd', to reflect its actual meaning and usage. 2019-06-18 Mark H Weaver fport_seek: Eliminate a fruitless use of 'off_t_or_off64_t'. This is a followup to commit 91ba73b397fcc2a36ae7e434522a924c7a8887d0. * libguile/fports.c (fport_seek): Use 'lseek' instead of 'lseek_or_lseek64', and use 'scm_t_off' uniformly. That's the type used in the function signature, and there's no benefit to using a wider type internally. Remove the overflow check, which is no longer needed. 2019-06-18 Mark H Weaver Fix documentation of R6RS 'binary-port?' to reflect reality. * doc/ref/r6rs.texi (rnrs io ports): Improve the descriptions of 'binary-port?' and 'textual-port?'. * module/rnrs/io/ports.scm (binary-port?, textual-port?): Update the docstrings. 2019-06-18 Mark H Weaver open-process: Fix dup(2) and execvp(2) error handling. Previously, in the case where OUT is 0, or ERR is 0 or 1, e.g. when (current-error-port) points to STDOUT, the code in 'start_child' to relocate OUT/ERR out of the way to another file descriptor had multiple bugs: (1) It neglected to close the original file descriptor. (2) It checked 'errno' without first checking the return value of dup(2). This doesn't work because dup(2) leaves 'errno' unchanged if there's no error. (3) In case 'errno' contained EINTR, the retry code failed because OUT (or ERR) was overwritten by the result of the previous failed dup(2) call. This commit fixes these problems, as well as another problem with 'execvp' error reporting. * libguile/posix.c (renumber_file_descriptor): New static helper function. (start_child): Use 'renumber_file_descriptor'. If 'execvp' fails, write the error message to file descriptor 2. Previously, we wrote the error message to ERR, which was the old file descriptor before being relocated to 2. 2019-06-18 Mark H Weaver Refresh a stale comment. * libguile/numbers.h: In a comment, update the count of number subtypes. scm_mkstrport: Optimize the POS -> BYTE_POS conversion. * libguile/strports.c (scm_mkstrport): Use 'scm_c_string_utf8_length' to avoid the conversion to UTF-8. Make 'get-bytevector-some' and 'get-bytevector-some!' suspendable. * module/ice-9/suspendable-ports.scm (get-bytevector-some) (get-bytevector-some!): New procedures. (port-bindings): Add them. open-pipe*: Improve performance of OPEN_BOTH mode. * module/ice-9/popen.scm (make-rw-port): Re-implement using R6RS custom binary input/output ports. Add get-bytevector-some!. * libguile/r6rs-ports.c (scm_get_bytevector_some_x): New procedure. * libguile/r6rs-ports.h (scm_get_bytevector_some_x): Add prototype. (scm_unget_bytevector): Move prototype next to 'scm_get_bytevector_some_x'. * module/ice-9/binary-ports.scm: Export 'get-bytevector-some!'. * doc/ref/api-io.texi (Binary I/O): Document it. 2019-06-18 Mark H Weaver scm_to_stringn: Avoid passing NULL to c_strcasecmp. Reported by Massimiliano Gubinelli in . * libguile/strings.c (scm_to_stringn): Check for (encoding == NULL) before passing it to 'c_strcasecmp'. Eliminate redundant 'enc' variable. 2019-06-18 Mark H Weaver time.test: Use 'pass-if-equal' in more tests. * test-suite/tests/time.test ("strftime"): Change some uses of 'pass-if' to instead use 'pass-if-equal'. Fix typo in tags.h comment. * libguile/tags.h: Fix typo in comment. Save and restore errno in the signal handler. * libguile/scmsigs.c (take_signal): Save and restore errno. Improve overflow checks in bytevector, string, and I/O operations. * libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE) (scm_bytevector_copy_x, bytevector_large_set): Rewrite checks to reliably detect overflows. (make_bytevector): Constrain the bytevector length to avoid later overflows during allocation. (make_bytevector_from_buffer): Fix indentation. (scm_bytevector_length): Use 'scm_from_size_t' to convert a 'size_t', not 'scm_from_uint'. * libguile/fports.c (fport_seek): Check for overflow before the implicit conversion of the return value. * libguile/guardians.c (guardian_print): Use 'scm_from_ulong' to convert an 'unsigned long', not 'scm_from_uint'. * libguile/ports.c (scm_unread_string): Change a variable to type 'size_t'. (scm_seek, scm_truncate_file): Use 'scm_t_off' instead of 'off_t_or_off64_t' to avoid implicit type conversions that could overflow, because 'ptob->seek' and 'ptob->truncate' use 'scm_t_off'. * libguile/r6rs-ports.c (bytevector_input_port_seek) (custom_binary_port_seek, bytevector_output_port_seek): Rewrite offset calculations to reliably detect overflows. Use 'scm_from_off_t' to convert a 'scm_t_off', not 'scm_from_long' nor 'scm_from_int'. (scm_get_bytevector_n_x, scm_get_bytevector_all, scm_unget_bytevector) (bytevector_output_port_write): Rewrite checks to reliably detect overflows. Use 'size_t' where appropriate. (bytevector_output_port_buffer_grow): Rewrite size calculations to reliably detect overflows. Minor change in the calculation of the new size: now it is max(min_size, 2*current_size), whereas previously it would multiply current_size by the smallest power of 2 needed to surpass min_size. * libguile/strings.c (make_stringbuf): Constrain the stringbuf length to avoid later overflows during allocation. (scm_string_append): Change overflow check to use INT_ADD_OVERFLOW. * libguile/strports.c (string_port_write): Rewrite size calculations to reliably detect overflows. (string_port_seek): Rewrite offset calculations to reliably detect overflows. Use 'scm_from_off_t' to convert a 'scm_t_off', not 'scm_from_long'. (string_port_truncate): Use 'scm_from_off_t' to convert a 'scm_t_off', not 'scm_from_off_t_or_off64_t'. * libguile/vectors.c (scm_c_make_vector): Change a variable to type 'size_t'. 2019-06-04 Timothy Sample Make URI handling locale independent. Fixes . * module/web/uri.scm (digits, hex-digits, letters): New variables. (ipv4-regexp, ipv6-regexp, domain-label-regexp, top-label-regexp, userinfo-pat, host-pat, ipv6-host-pat, port-pat, scheme-pat): Explicitly list each character instead of using character ranges. * test-suite/tests/web-uri.test: Add corresponding tests. 2019-06-04 Ludovic Courtès 'basename' correctly handles "/" and "//". * libguile/filesys.c (scm_basename): Special-case "/" and "//". * test-suite/tests/filesys.test ("basename"): New test prefix. 2019-05-14 Mark H Weaver Update iconv.m4 from gnulib. * m4/iconv.m4: Update from gnulib-v0.1-2176-ga79f2a287. 2019-05-07 Mark H Weaver Strings, i18n: Limit the use of alloca to approximately 8 kilobytes. * libguile/i18n.c (SCM_MAX_ALLOCA): New macro. (SCM_STRING_TO_U32_BUF): Accept an additional variable to remember whether we used malloc to allocate the buffer. Use malloc if the allocation size is greater than SCM_MAX_ALLOCA. (SCM_CLEANUP_U32_BUF): New macro. (compare_u32_strings, compare_u32_strings_ci, str_to_case): Adapt. * libguile/strings.c (SCM_MAX_ALLOCA): New macro. (normalize_str, unistring_escapes_to_r6rs_escapes): Use malloc if the allocation size is greater than SCM_MAX_ALLOCA. * test-suite/tests/i18n.test, test-suite/tests/strings.test: Add tests. 2019-05-07 Mark H Weaver put-u8: Always write a single byte, regardless of the port encoding. Previously, 'put-u8' used textual I/O to write a single character, relying on the usual practice of setting the port encoding to ISO-8859-1 for binary ports. * libguile/r6rs-ports.c (scm_put_u8): Use 'scm_c_write', not 'scm_putc'. 2019-05-07 Mark H Weaver Optimize fixnum exact integer square roots. * libguile/numbers.c (scm_exact_integer_sqrt, scm_sqrt) (exact_integer_is_perfect_square, exact_integer_floor_square_root): Where it is trivial to do so, use GMP's low-level mpn functions to avoid heap allocation. Avoid 'with-latin1-locale' in binary I/O tests. * test-suite/tests/r6rs-ports.test ("put-bytevector [2 args]") ("put-bytevector [3 args]", "put-bytevector [4 args]"): Set the default port encoding instead of setting the locale. Fix indentation in scm_sum. Fix typo in comment. 2019-05-07 Mark H Weaver Add 'scm_c_make_char' and use it where appropriate. This reverts the change to SCM_MAKE_CHAR made in the previous commit 63818453ad226cd3c2d1fd8ade12e3d7c1d43c05, which used an arithmetic trick to avoid evaluating its argument more than once. Here, we restore the previous implementation of SCM_MAKE_CHAR, which evaluates its argument twice. Instead, we introduce a new inlinable function 'scm_c_make_char' and replace uses of SCM_MAKE_CHAR with calls to 'scm_c_make_char' where appropriate. * libguile/chars.h (scm_c_make_char): New inline function. * libguile/inline.c: Include chars.h. * libguile/srfi-13.c (REF_IN_CHARSET, scm_string_any, scm_string_every) (scm_string_trim, scm_string_trim_right, scm_string_trim_both) (scm_string_index, scm_string_index_right, scm_string_skip) (scm_string_skip_right, scm_string_count, string_titlecase_x) (string_reverse_x, scm_string_fold, scm_string_fold_right) (scm_string_for_each, scm_string_filter, scm_string_delete): Use 'scm_c_make_char' instead of 'SCM_MAKE_CHAR' in cases where the argument calls a function. * libguile/chars.c (scm_char_upcase, scm_char_downcase, scm_char_titlecase), libguile/ports.c (scm_port_decode_char), libguile/print.c (scm_simple_format), libguile/read.c (scm_read_character), libguile/strings.c (scm_string_ref, scm_c_string_ref), libguile/vm-engine.c ("string-ref"): Ditto. 2019-04-17 Mark H Weaver Reimplement SCM_MAKE_CHAR to evaluate its argument only once. The motivation for this change is that SCM_MAKE_CHAR is sometimes passed an expression that involves a procedure call that is not always trivial. In other cases, the results are not guaranteed to be the same both times, which could lead to the creation of invalid SCM objects. * libguile/chars.h (SCM_MAKE_CHAR): Reimplement. 2019-04-16 Andrea Azzarone Fix gc.test "after-gc-hook gets called" failures. * libguile/scmsigs.c (signal_delivery_thread): Call scm_async_tick to give any pending asyncs a chance to run before we block indefinitely waiting for a signal to arrive. 2019-04-16 Mark H Weaver Update user-visible copyright years. * doc/ref/guile.texi: Update years in copyright notice. * module/ice-9/command-line.scm (version-etc): Update 'copyright-year'. * module/system/repl/common.scm (*version*): Update copyright years. 2019-04-16 Mark H Weaver Avoid passing NULL to 'memcpy' and 'memcmp'. Reported by Jeffrey Walton in . Note that C11 section 7.1.4 (Use of library functions) states that: "unless explicitly stated otherwise in the detailed descriptions [of library functions] that follow: If an argument to a function has an invalid value (such as ... a null pointer ...) ..., the behavior is undefined." Note that 'strxfrm' is an example of a standard C function that explicitly states otherwise, allowing NULL to be passed in the first argument if the size argument is zero, but no similar allowance is specified for 'memcpy' or 'memcmp'. * libguile/bytevectors.c (scm_uniform_array_to_bytevector): Call memcpy only if 'byte_len' is non-zero. * libguile/srfi-14.c (charsets_equal): Call memcmp only if the number of ranges is non-zero. * libguile/stime.c (setzone): Pass 1-character buffer to 'scm_to_locale_stringbuf', instead of NULL. * libguile/strings.c (scm_to_locale_stringbuf): Call memcpy only if the number of bytes to copy is non-zero. 2019-04-16 Mark H Weaver Remove vestigial comment in tags.h. * libguile/tags.h: Remove a vestigial comment which seems to have been separated from its associated code long ago. 2019-04-02 Mark H Weaver Fix typo in comment. * module/ice-9/boot-9.scm: Fix typo. 2019-02-24 Michael Gran Disable test for current value of setitimer on Cygwin * test-suite/tests/signals.test ("current itimers are 0"): throws unresolved for cygwin Make locale monetary conversion tests be less strict on terminal whitespace * test-suite/tests/i18n.test (monetary-amount->locale-string): modified 2019-02-24 Michael Gran Handle newlib C library's langinfo constant names The newlib C library (used in Cygwin) has alternative names for nl_langinfo GNU extensions * configure.ac (_NL_NUMERIC_GROUPING): new test * libguile/i18n.c (INT_CURR_SYMBOL, MON_DECIMAL_POINT, MON_THOUSANDS_SEP) (MON_GROUPING, POSITIVE_SIGN, NEGATIVE_SIGN, GROUPING, INT_FRAC_DIGITS) (FRAC_DIGITS, P_CS_PRECEDES, P_SEP_BY_SPACE, N_CS_PRECEDES, N_SEP_BY_SPACE) (P_SIGN_POSN, N_SIGN_POSN, INT_P_CS_PRECEDES, INT_P_SEP_BY_SPACE) (INT_N_CS_PRECEDES, INT_N_SEP_BY_SPACE, INT_P_SIGN_POSN, INT_N_SIGN_POSN) [HAVE_DECL__NL_NUMERIC_GROUPING]: map to newlib C constants, when present 2019-02-24 Michael Gran Add a fallback value for the locale-monetary-decimal-point * module/ice-9/i18n.scm (locale-monetary-decimal-point): use "." as fallback 2019-02-22 Andy Wingo Fix race when expanding syntax-parameterize and define-syntax-parameter * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook): Inline into uses. (make-binding): Change format of lexically defined or rebound syntax parameters to just be the transformer, not a list of the transformer. (resolve-identifier, expand-install-global, expand-body) (syntax-parameterize): Adapt to use the variable object (box) holding the top-level syntax parameter as the "key" for lookups into the lexical environment, instead of a fresh object associated with the syntax transformer. * module/ice-9/psyntax-pp.scm: Regenerate. Fixes #27476, a horrible race when one thread is expanding a syntax-parameterize form including uses, and another thread is expanding the corresponding define-syntax-parameter. See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27476#102. 2019-02-21 Andy Wingo Fix crypt-on-glibc test error * test-suite/tests/posix.test ("crypt"): Allow for the given salt being valid. Thanks to Jonathan Brielmaier for the report and debugging! 2019-02-10 Mike Gran Fix binary output on files created by mkstemp! Some operating systems require a O_BINARY flag. * libguile/filesys.c (scm_i_mkstemp): Don't mask out O_BINARY flag * test-suite/tests/posix.test ("binary mode honored"): new test 2019-02-10 Mike Gran Avoid leaking a file descriptor in test-unwind * test-suite/standalone/test-unwind.c (check_ports): explicitly close temp file Fix strftime compile with null threads * libguile/stime.c (scm_strftime): use correct pthread lock function 2019-02-09 Mike Gran Remove redefinition of when & unless in snarf-check-and-output-texi * module/scripts/snarf-check-and-output-texi.scm (when, unless): removed Don't mutate read-only string in ports test * test-suite/tests/ports.test ("valid wide mode string"): modified 2018-12-16 Ludovic Courtès Do not warn the user when 'madvise' returns ENOSYS. * libguile/vm.c (return_unused_stack_to_os): Avoid 'perror' calls when 'madvise' returns ENOSYS. 2018-12-12 Daniel Llorens Fix tests for SRFI-19 date->string ~N 2018-12-11 Daniel Llorens Support ~N in SRFI-19 string->date * module/srfi/srfi-19.scm (fractional-integer-reader, make-fractional-integer-reader): From reference implementation. (reader-directives): Handle #\N, from reference implementation. * test-suite/tests/srfi-19: Add tests for string->date ~N. * doc/ref/srfi-modules.texi (string->date): Add line for ~N. 2018-11-12 Mark H Weaver Update (ice-9 match) to include selected bug fixes from upstream. Fixes and other bugs. * module/ice-9/match.upstream.scm: Apply selected fixes from the upstream match.scm in Chibi-Scheme. * test-suite/tests/match.test.upstream: Add more tests from upstream. 2018-11-12 Mark H Weaver Fix spelling of ellipsis in (ice-9 match). * module/ice-9/match.upstream.scm: Change several occurrences of 'ellipse' and 'ellipses' to 'ellipsis', to more closely match match.scm from Chibi-Scheme. 2018-10-31 Mikael Djurfeldt Documentation fixes * doc/ref/api-control: * doc/ref/compiler.texi: Language fixes * doc/ref/compiler ($kfun): Renamed argument clauses -> clause. 2018-10-28 Mikael Djurfeldt Bootstrap optimization * bootstrap/Makefile.am: Build both eval.go and psyntax-pp.go before the rest of the .go files so that they are handled by a fast macro expander. This saves time for a parallel build. 2018-10-25 Mikael Djurfeldt Add texinfo dependency to README * README: Add texinfo dependency. 2018-10-24 Mark H Weaver SRFI-19: Minor refactor of leap second table lookups. * module/srfi/srfi-19.scm (leap-second-delta): Replace with ... (utc->tai): ... this. (leap-second-neg-delta): Replace with ... (tai->utc): ... this. (current-time-tai, priv:time-tai->time-utc!, priv:time-utc->time-tai!) (time-tai->julian-day, time-monotonic->julian-day): Adapt accordingly. SRFI-19: time-utc->date: Support non-integer nanoseconds values. * module/srfi/srfi-19.scm (time-utc->date): Use 'floor-remainder' instead of 'modulo'. 2018-10-22 Mark H Weaver SRFI-19: Check for incompatible types in time comparisons. Fixes . Reported by Zefram . * module/srfi/srfi-19.scm (time-compare-check): New procedure. (time=?): Use 'time-compare-check' to check the arguments and raise an error in case of mismatched types. Previously, mismatched types would cause time=? to return #f. (time>?, time=?, time<=?, time-difference!): Use 'time-compare-check' to check the arguments. 2018-10-22 Mark H Weaver SRFI-19: Fix normalization of seconds and nanoseconds in time records. Fixes . Reported by Zefram . * module/srfi/srfi-19.scm (time-normalize!): Rewrite. * test-suite/tests/srfi-19.test: Add tests. 2018-10-21 Mark H Weaver SRFI-19: Add a few more tests. This is a followup to commit a58c7abd72648f77e4ede5f62a2c4e7969bb7f95. * test-suite/tests/srfi-19.test: Add tests for large positive years. 2018-10-21 Mark H Weaver SRFI-19: Fix handling of negative years and negative julian days. Fixes . Mitigates and . Reported by: Zefram . * module/srfi/srfi-19.scm (encode-julian-day-number) (decode-julian-day-number, date-week-number): Use 'floor-quotient' instead of 'quotient', and 'floor' instead of 'truncate', where appropriate. (time-utc->date): Ensure that the 'nanoseconds' field of the returned date is non-negative. (leap-year): Handle negative years properly, and reformulate the computation. (week-day): Handle negative years properly. Use 'floor-quotient' instead of 'quotient' where appropriate. (directives): In the handler for '~Y' format escapes, improve the handling of years outside of the range 0-9999. (read-directives): Add a FIXME comment to fix the '~Y' reader to handle years outside of the range 0-9999. * test-suite/tests/srfi-19.test: Import (srfi srfi-1). Use Guile's modern keyword notation in the 'define-module' form. Add more tests. 2018-10-20 Mark H Weaver SRFI-19: Fix TAI->UTC conversions, leap second handling, etc. Fixes . Fixes . Fixes . Partially fixes . Reported by Zefram . * doc/ref/srfi-modules.texi (SRFI-19 Introduction): Fix the definitions of Julian Day and Modified Julian Day. Give the correct full names of UTC and TAI. * module/srfi/srfi-19.scm: Import (srfi srfi-1). Use modern Guile keyword syntax in the 'define-module' form. (leap-second-neg-delta): New procedure, derived from a similar procedure in the latest upstream SRFI-19 reference implementation. (priv:time-tai->time-utc!, time-tai->julian-day) (time-monotonic->julian-day): Use 'leap-second-neg-delta'. (local-tz-offset): Fix comment. (leap-second?): Remove. (tai-before-leap-second?): New procedure, derived from upstream SRFI-19. (time-utc->date): Use 'define*' to handle the optional argument. Remove the leap second handling, following upstream SRFI-19. (time-tai->date): Rewrite in terms of 'time-utc->date'. Add special leap second handling, following upstream SRFI-19. (time-monotonic->date): Rewrite in terms of 'time-tai->date'. (date->time-tai, date->time-monotonic): Add special leap second handling, following upstream SRFI-19. (directives): In the entry for the "~Y" escape in 'date->string', pad the year field to 4 characters, following upstream SRFI-19. * test-suite/tests/srfi-19.test: Add tests. 2018-10-20 Mark H Weaver scm_seed_to_random_state: Support wide string arguments. Partially fixes . Reported by Tom de Vries . * libguile/random.c (scm_seed_to_random_state): Use 'scm_to_utf8_string' (or 'scm_to_latin1_string' for a narrow string, for compatibility) to convert the string into raw bytes for use by 'scm_c_make_rstate'. Make sure the length in bytes fits within an 'int'. 2018-10-20 Mark H Weaver Fix typo in strings.h. * libguile/strings.h: In a comment, add the missing "i_" in "scm_i_is_narrow_string". 2018-10-20 Mark H Weaver Fix type inferencing for 'nil?' and 'null?' predicates. Fixes . Reported by . * module/language/cps/types.scm (define-simple-type-inferrer): Apply (logand (&type val) <>) uniformly. Previously, this was done only in the false branch. Rename local variable to 'type*', to allow the macro operand 'type' to be an arbitrary expression. (*type-inferrers*): Add &nil to the set of possible types. (*type-inferrers*): Add &false and &null to the set the possible types. * module/language/cps/type-fold.scm (*branch-folders*): Add &nil to the set of possible types. (*branch-folders*): Add &false and &null to the set the possible types. * test-suite/tests/compiler.test: Add tests. 2018-10-18 Mark H Weaver Use 'scm_from_utf8_{string,symbol,keyword}' for C string literals. Partial fix for . Reported by Tom de Vries . Fix several instances of the mistake of using 'scm_from_locale_*' for C strings that originally came from a C string literal. Change several uses of 'scm_from_latin1_*' as well, to promote the practice of writing code that works for arbitrary C string literals. Also add missing years to the copyright notices of changed files, based on the git history. * libguile/debug-malloc.c, libguile/deprecation.c, libguile/error.c, libguile/eval.c, libguile/expand.c, libguile/extensions.c, libguile/filesys.c, libguile/init.c, libguile/load.c, libguile/modules.c, libguile/pairs.c, libguile/posix.c, libguile/print.c, libguile/random.c, libguile/read.c, libguile/regex-posix.c, libguile/snarf.h, libguile/srfi-13.c, libguile/stacks.c, libguile/stime.c, libguile/strports.c, libguile/values.c: Use 'scm_from_utf8_*' where appropriate. 2018-10-16 Mark H Weaver Fix typos, indentation and error reporting in SRFI-19. * module/srfi/srfi-19.scm: Fix typos in comments, indentation, and pass the correct 'caller' name to 'time-error' in several places. Update SRFI-19 leap second table. * module/srfi/srfi-19.scm (leap-second-table): Update to include the leap second on 1 January 2017. 2018-10-14 Chris Marusich Clarify the manual's "Processes" section. * doc/ref/posix.texi (Processes): Use the phrase "integer status value" consistently, and add a cross-reference to the section of the glibc manual that explains what it is. 2018-10-14 Mark H Weaver In 'ash' and 'round-ash', handle right shift count of LONG_MIN. Fixes . Reported by Zefram . * libguile/numbers.c: Add another top-level 'verify' to ensure that LONG_MIN is not a fixnum. (scm_ash, scm_round_ash): Ensure that when the shift count is LONG_MIN, it is not handled via the normal code path, to avoid signed overflow when the shift count is negated. * test-suite/tests/numbers.test: Add tests. 2018-10-14 Mark H Weaver Fix 'round-ash' of negative integers by huge right shift counts. This is a followup to commit 011aec7e240ef987931548d90c53e6692c85d01c. When rounding, right shifting a negative integer by a huge shift count results in 0, not -1. * libguile/numbers.c: Add top-level 'verify' to ensure that the assumptions in 'scm_ash' and 'scm_round_ash' are valid. (scm_round_ash): In the case that handles huge right shifts, require that the shift count _exceeds_ the integer length, and return 0 instead of -1. * test-suite/tests/numbers.test: Adjust tests accordingly. 2018-10-14 Mark H Weaver Gracefully handle huge shift counts in 'ash' and 'round-ash'. Fixes . Reported by Stefan Israelsson Tampe . The need for this arose because the type inferrer for 'ursh' sometimes passes (- 1 (expt 2 64)) as the second argument to 'ash'. * libguile/numbers.c (scm_ash, scm_round_ash): Gracefully handle several cases where the shift count does not fit in a C 'long'. * test-suite/tests/numbers.test: Add tests. 2018-10-14 Mark H Weaver Fix list validation of *list->bytevector procedures. Fixes . Reported by Josh Datko . * libguile/validate.h (SCM_VALIDATE_LIST_COPYLEN) (SCM_VALIDATE_NONEMPTYLIST_COPYLEN): Use '!=' instead of '>=' to validate the result of 'scm_ilength' after it has been stored in the user variable 'cvar'. * test-suite/tests/bytevectors.test: Add tests. Use '#:use-module' instead of ':use-module' in 'define-module' form. 2018-10-14 Mark H Weaver Improve the documentation for 'nil?'. * libguile/boolean.c (scm_nil_p): Improve docstring. * doc/ref/api-languages.texi (Nil): Add documentation for 'nil?', along with a description of how Elisp interprets Scheme booleans and end-of-list. 2018-10-10 Daniel Llorens Fix 32/64 bit bug in INTEGER_ACCESSOR_PROLOGUE 2018-10-06 Mark H Weaver Fix 'atomic-box-compare-and-swap!'. Fixes . 'scm_atomic_compare_and_swap_scm' is a thin wrapper around 'atomic_compare_exchange_weak' (where available), and therefore it may spuriously fail on some platforms, leaving the atomic object unchanged even when the observed value is equal to the expected value. Since 'scm_atomic_compare_and_swap_scm' returns both a boolean result and the observed value, the caller is able to detect spurious failures when using that API. 'atomic-box-compare-and-swap!' presents a simpler API, returning only the observed value. The documentation advises callers to assume that the exchange succeeded if the observed value is 'eq?' to the expected value. It's therefore not possible to report spurious failures with this API. 'atomic-box-compare-and-swap!' uses 'scm_atomic_compare_and_swap_scm', and prior to this commit would simply ignore the boolean result and return the observed value. In case of spurious failures, the caller would legitimately conclude that the exchange had succeeded. With this commit, 'atomic-box-compare-and-swap!' now retries in case of spurious failures. * libguile/atomic.c (scm_atomic_box_compare_and_swap_x): If 'scm_atomic_compare_and_swap_scm' returns false and the observed value is equal to 'expected', then try again. * libguile/vm-engine.c (atomic-box-compare-and-swap!): Ditto. 2018-09-23 Ludovic Courtès Define AT_SYMLINK_NOFOLLOW et al. * libguile/posix.c (scm_init_posix): Define AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, and AT_EMPTY_PATH when available. (scm_utime): Mention AT_SYMLINK_NOFOLLOW. * doc/ref/posix.texi (File System): Update accordingly. * test-suite/tests/posix.test ("utime")["AT_SYMLINK_NOFOLLOW"]: New test. time: Use #: for 'define-module' clauses. * module/ice-9/time.scm: Use #: instead of : in 'define-module' form. time: Support expressions that return any number of values. * module/ice-9/time.scm (time-proc): Call PROC with 'call-with-values'; return all its values. time: Use 'syntax-rules' instead of 'define-macro'. * module/ice-9/time.scm (time): Rewrite using 'define-syntax-rule'. 2018-08-02 Mark H Weaver Fix R6RS call-with-{input,output}-file to open textual ports. Fixes . Reported and diagnosed by Göran Weinholt . * module/rnrs/io/simple.scm (call-with-input-file) (call-with-output-file): Use 'open-{input,output}-file' to open the port in textual mode. Previously 'open-file-{input,output}-port' was used, which opened the port in binary mode. 2018-07-24 Ludovic Courtès srfi-19: Remove unused procedure. * module/srfi/srfi-19.scm (date->broken-down-time): Remove. Add -Wshadowed-toplevel. * module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): New variable. * module/language/tree-il/compile-cps.scm (%warning-passes): Add it. * module/system/base/message.scm (%warning-types): Add it. * test-suite/tests/tree-il.test ("warnings")["shadowed-toplevel"]: New test prefix. * module/ice-9/boot-9.scm (%auto-compilation-options): Add it. * doc/ref/api-evaluation.texi (Compilation): Add 'shadowed-toplevel' and 'macro-use-before-definition'. 2018-07-20 Ludovic Courtès r6rs-ports: 'put-bytevector' accepts 64-bit integers. * libguile/r6rs-ports.c (scm_put_bytevector): Use 'size_t' for c_start, c_count, and c_len. 2018-07-19 Ludovic Courtès compile: Update copyright year. * module/scripts/compile.scm (show-version): Update copyright year. compile: Improve error message. * module/scripts/compile.scm (parse-args): Add missing newline in "unrecognized option" message. compile: Add '-x' flag. * module/scripts/compile.scm (%options, compile): Add '-x'. * doc/ref/api-evaluation.texi (Compilation): Document it. 2018-07-19 Ludovic Courtès r6rs-ports: Accept 'port-position' values greater than 2^32. Reported by Ricardo Wurmus . Fixes . * libguile/r6rs-ports.c (custom_binary_port_seek): Use 'scm_to_off_t' instead of 'scm_to_int'. * test-suite/tests/r6rs-ports.test ("8.2.7 Input Ports")["custom binary input port position, long offset"]: New test. 2018-07-05 Mark H Weaver Make srfi-71 visible through 'cond-expand'. This is a followup to commit eb90831ce81bcb85ae96d27011ebe71955cdf75d. * module/srfi/srfi-71.scm: Add missing 'cond-expand-provide'. 2018-07-02 Ludovic Courtès Update release docs. * doc/release.org: Update web site instructions. 2018-07-01 Ludovic Courtès Bump version for Guile 2.2.4. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_REVISION): Increment. 2018-07-01 Ludovic Courtès build: Really build srfi/srfi-71.scm. Commit eb90831ce81bcb85ae96d27011ebe71955cdf75d added it to the wrong makefile. * module/Makefile.am (SOURCES): Add srfi/srfi-71.scm. * module/srfi/Makefile.am: Remove. It's a leftover from the 2009 build system rework in commit 3bb299b3f0d5b31957a6447d095ed723268019be. 2018-07-01 Ludovic Courtès Update NEWS. * NEWS: Update. Update copyright years in '--version' and the manual. * module/ice-9/command-line.scm (version-etc): Change #:copyright-year to 2018. * doc/ref/guile.texi: Add 2017 and 2018 to the copyright years. * configure.ac (GUILE_CONFIGURE_COPYRIGHT): Add 2018. 2018-07-01 Ludovic Courtès Serialize accesses to submodule hash tables. Fixes . Previously, when compiling files in parallel like Guix does, threads would be concurrently inserting, rehashing, and reading the submodule hash table of module (). Thus, some threads would sometimes see an inconsistent state, leading to errors such as: Module named (system repl debug) does not exist * module/ice-9/boot-9.scm (call-with-module-autoload-lock): Move higher in the file. (module-name): Use it around call to 'nested-define-module!'. (resolve-module): Wrap the whole thing in 'call-with-module-autoload-lock'. 2018-06-29 Ludovic Courtès vm: Fix stack-marking bug in multi-threaded programs. Fixes . * libguile/vm-engine.c (call, call_label, handle_interrupts): Add 'new_fp' variable; set the dynamic link and return address of the frame at NEW_FP before setting 'vp->fp'. This fixes a bug whereby, in a multi-threaded context, the stack-marking code could run after vp->fp has been set but before its dynamic link has been set, leading the stack-walking code in 'scm_i_vm_mark_stack' to exit early on. 2018-06-28 Ludovic Courtès linker: Don't rely on out-of-range bv-ref exceptions. * module/system/vm/linker.scm (find-shstrndx): Check whether NAME is lower than the length of BV; remove 'false-if-exception' around 'string-table-ref' call. 2018-06-24 Ludovic Courtès GDB support: Add 'guile-backtrace' command. * libguile/libguile-2.2-gdb.scm : Add 'register-command!' call. GDB support: Add note about (gdb frame-filters). * libguile/libguile-2.2-gdb.scm : Add comment. 2018-06-24 Ludovic Courtès GDB support: Fix 'display-vm-frames'. Previously 'vm-frame-older' would fail to traverse the chain of frames. * libguile/libguile-2.2-gdb.scm (uint-type): New variable (vm-frame): Fix "saved ip" and "saved fp" computation. The latter had been broken roughly since commit 72353de77d0a06f158d8af66a2540015658e2574. (vm-frame-older): Return #f when IP is zero, not when FP is zero. (vm-frame-function-name): Wrap 'vm-frame-program-debug-info' in 'false-if-exception' 2018-06-24 Ludovic Courtès types: Recognize 'scm_t_port_type' and decode port type name. * module/system/base/types.scm (read-c-string, inferior-port-type): New procedures. (inferior-port): Use 'inferior-port-type' to determine the port type. (cell->object): Rename 'flags+type' to 'flags' in the '%tc7-port' case. * test-suite/tests/types.test ("opaque objects"): Adjust port testse. (test-inferior-ports): New macro. ("ports"): New test prefix. 2018-06-24 Ludovic Courtès vm: Fix another typo. Fix typo introduced in efc33cd1497c00c5ebf961e834efc1d85f3e28ac. * libguile/vm.c (return_unused_stack_to_os): Remove extra 'while'. 2018-06-23 Arun Isaac web: Export http-request. * module/web/client.scm (request): Rename to http-request, add a docstring, and export it. (http-get, http-head, http-post, http-put, http-delete, http-trace, http-options): Update docstring. * doc/ref/web.texi (Web Client): Document http-request. 2018-06-19 Ludovic Courtès Add 'scm_to_stringn' shortcut when converting to UTF-8. * libguile/strings.c (scm_to_stringn): Call 'scm_to_utf8_stringn' when ENCODING == "UTF-8". 2018-06-18 Ludovic Courtès Module import obarrays are accessed in a critical section. Fixes . * libguile/modules.c (import_obarray_mutex): New variable. (resolve_duplicate_binding, module_imported_variable): Acquire it before accessing an obarray. 2018-06-18 Ludovic Courtès tests: Adjust i18n.test to 'fr_FR.utf8' locale in glibc 2.27. * test-suite/tests/i18n.test (french-number-string=?): New procedure. ("number->locale-string")["French"]("integer", "negative integer") ("fraction", "fraction, 1 digit"): Use it. ("format ~h")["French"]("12345.678"): Likewise. ("monetary-amount->locale-string")["French"]("integer", "fraction"): Check for both SPACE and NO-BREAK SPACE. 2018-06-18 Arun Isaac doc: Document (ice-9 match) macros. * doc/ref/match.texi: Document match-lambda, match-lambda*, match-let, match-let* and match-letrec. 2018-06-18 Ludovic Courtès doc: Fix typo. Fixes . Reported by Fis Trivial . * doc/ref/libguile-foreign-objects.texi (Defining Foreign Object Types): Remove extraneous 'image_type' in example. 2018-06-18 Jan Smydke get-bytevector-n and get-bytevector-n! can now read more than 4 GB * libguile/r6rs-ports.c (scm_get_bytevector_n, scm_get_bytevector_n_x): Turn 'c_count' and related variables into a 'size_t', and use 'scm_to_size_t' instead of 'scm_to_uint'. 2018-06-18 Ludovic Courtès vm: Fix typo when checking for 'madvise' error code. * libguile/vm.c (return_unused_stack_to_os): Check for EAGAIN, not -EAGAIN. 2018-06-18 Ludovic Courtès Make module autoloading thread-safe. Fixes . * module/ice-9/boot-9.scm (call-with-module-autoload-lock): New procedure. (try-module-autoload): Wrap body in 'call-with-module-autoload-lock'. * module/ice-9/threads.scm: Set (@ (guile) call-with-module-autoload-lock). 2018-06-18 Ludovic Courtès tests: Add SRFI-71 test. * test-suite/tests/srfi-71.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it. 2018-06-18 Christopher Allan Webber Add SRFI 71: Extended LET-syntax for multiple values. * module/srfi/srfi-71.scm: New file. * module/srfi/Makefile.am: Add it. * doc/ref/srfi-modules.texi: Document it. * NEWS: Update. 2018-06-11 Mark H Weaver Add copyright header for (language elisp falias), and fix typo. * module/language/elisp/falias.scm: Add copyright header. * module/language/elisp/spec.scm: Fix typo in header. elisp: Fix cross-compilation support. * module/system/base/target.scm (with-native-target): New exported procedure. * module/language/elisp/spec.scm: In the top-level body expression, call 'compile-and-load' within 'with-native-target' to compile native code. * module/language/elisp/compile-tree-il.scm (eval-when-compile, defmacro): Compile native code. 2018-06-11 Mark H Weaver Fix error reporting in 'load-thunk-from-memory'. Previously 'load-thunk-from-memory' would often throw to 'system-error' based on a stale value in 'errno', leading to incorrect error messages. * libguile/loader.c (load_thunk_from_memory): Set 'errno' to 0 before jumping to cleanup in the ABORT preprocessor macro, and also in the case when 'process_dynamic_segment' reports an error. 2018-06-11 Mark H Weaver goops: Fix 'instance?' to work on objects that aren't structs. Fixes Reported by Tommi Höynälänmaa * module/oop/goops.scm (instance?): Check that OBJ is a struct before applying 'struct-vtable' to it. 2018-06-11 Mark H Weaver Avoid inexact arithmetic in the type inferrer for 'sqrt'. * module/language/cps/types.scm: Use 'exact-integer-sqrt' and avoid inexact arithmetic in the range analysis of the type inferrer for 'sqrt'. 2018-06-11 Mark H Weaver Fix type inference for bitwise logical operators. Fixes and related bugs. Reported by Jan Nieuwenhuizen . * module/language/cps/types.scm (next-power-of-two): Remove procedure. (non-negative?, lognot*, saturate+, saturate-, logand-bounds) (logsub-bounds, logior-bounds, logxor-bounds): New procedures. Use them to improve and fix bugs in the range analysis of the type inferrers for 'logand', 'logsub', 'logior', 'ulogior', 'logxor', 'ulogxor', and 'lognot'. 2018-06-11 Mark H Weaver Revert "Minor CSE run-time optimization" Fixes . Reported by David Thompson . This reverts commit d4883307ca64a7028b9a6cd072974437306c19d3. 2018-06-11 Mark H Weaver Fix typo in comment within numbers.c 2018-05-09 Andy Wingo VM syncs IP in pop-fluid * libguile/vm-engine.c (pop-fluid): Sync IP before popping, as setting a fluid may allocate. 2018-03-16 Arun Isaac Fix minor typo in the PEG documentation. * doc/ref/api-peg.texi (PEG Internals): Fix minor typo. 2018-03-16 Mark H Weaver Fix a few typos in the manual. Fixes . Reported by Matt Wette . * doc/ref/api-macros.texi (Macro Expansion) doc/ref/vm.texi (Procedure Call and Return Instructions): Fix typos. 2018-03-16 Mark H Weaver Fix eta-conversion edge cases in peval. Fixes . Reported by Stefan Israelsson Tampe . * module/language/tree-il/peval.scm (peval)[lift-applied-lambda]: Before performing eta-conversion, check that the variable(s) passed to the inner 'apply' are not referenced from the inner lambda, and that the number of required arguments would not be reduced by the conversion. 2018-03-16 Shea Levy Recognize RISC-V compilation targets. * module/system/base/target.scm (cpu-endianness): Add case for "riscv" variants. 2018-02-16 Ludovic Courtès srfi-18: 'thread-sleep!' timeout-as-a-number is relative. This is a followup to . * module/srfi/srfi-18.scm (thread-sleep!): When TIMEOUT is a number, keep it as-is. * test-suite/tests/srfi-18.test ("thread sleep with number"): Pass 0 as the timeout. ("thread sleeps fractions of a second"): Pass 0.5 as the timeout. 2018-02-16 Ludovic Courtès srfi-18: When timeout is a number, it's a relative number of seconds. Fixes . Reported by David Beswick . * module/srfi/srfi-18.scm (timeout->absolute-time): New procedure. (mutex-lock!): Use it in 'thread:lock-mutex' call. (mutex-unlock!): Use it. * test-suite/tests/srfi-18.test ("mutex-lock! returns false on timeout") ("mutex-lock! returns true when lock obtained within timeout") ("recursive lock waits") ("mutex unlock is false when condition times out"): Adjust cases where the 'timeout' parameter is a number so that it's a relative number. 2018-02-16 Ludovic Courtès doc: Fix typo about SRFI-4 syntax. Reported by Matt Wette . Fixes . * doc/ref/api-data.texi (Array Syntax): Fix typo. 2018-02-16 Ludovic Courtès build: Use 'sed' invocation compatible with BSD sed. Fixes . Reported by ilove zfs . * libguile/Makefile.am (INSTANTIATE): Move '-i' first. 2018-02-16 Ludovic Courtès 'select' returns empty sets upon EINTR and EAGAIN. Fixes . * libguile/filesys.c (scm_select): Clear READ_SET, WRITE_SET, and EXCEPT_SET when RV < 0. 2018-01-26 Andy Wingo Sync IP before allocating closures * libguile/vm-engine.c (vm_engine): Sync IP before allocating closures. 2018-01-15 Ludovic Courtès Revert "Honor '%fresh-auto-compile'." This reverts commit 83d4c4d622b406ec0bc9d8139ec8182fa72b5720, which came from a misunderstanding. 2018-01-11 Ludovic Courtès No tabs in C code. * .dir-locals.el (c-mode): Set 'indent-tabs-mode' to nil in C. 2018-01-10 Ludovic Courtès Make sure the return value of 'scm_crypt' is always initialized. * libguile/posix.c (scm_crypt): Always initialize 'ret'; error out even when ERR is zero. 2017-12-22 Ludovic Courtès compile: Load language modules upfront. Fixes a bug whereby "guild compile --target=arm-linux-gnueabihf --from=elisp ... language/elisp/boot.el" would fail with an exception from 'load-thunk-from-memory' while trying to load (language elisp spec) from the guile-being-compiled instead of using that of the guile-for-build. The problem did not manifest with --from=scheme because (language scheme spec) happened to be already loaded before we had changed %load-path. * module/scripts/compile.scm (compile): Add calls to 'lookup-language'. 2017-12-22 Ludovic Courtès 'load-thunk-from-memory' reports the correct error. Previously 'load-thunk-from-memory' would often throw to 'system-error' when passed an incorrect ELF file, leading to incorrect error messages. * libguile/loader.c (load_thunk_from_memory): Reset 'errno' when 'check_elf_header' returns non-NULL. * test-suite/tests/vm.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it. 2017-12-22 Ludovic Courtès Fix 'crypt' deadlock upon error. * libguile/posix.c (scm_crypt): Take 'scm_i_misc_mutex' right before calling 'crypt'. Move 'SCM_SYSERROR' call after 'scm_dynwind_end'. * test-suite/tests/posix.test ("crypt"): New test prefix. 2017-12-14 Ludovic Courtès doc: Update LALR URL. Reported by Chris Vine . * doc/ref/api-lalr.texi (LALR(1) Parsing): Update URL. 2017-12-01 Andy Wingo Bump version for Guile 2.2.3. * GUILE-VERSION (GUILE_MICRO_VERSION, LIBGUILE_INTERFACE_CURRENT) (LIBGUILE_INTERFACE_AGE): Increment. Update NEWS for 2.2.3 * NEWS: Update. Avoid generating arity-adapting zero-value conts where possible * module/language/tree-il/compile-cps.scm (adapt-arity, convert): Avoid generating arity-adapting continuations for nullary continuations. 2017-11-30 Andy Wingo Avoid generating arity-adapting continuations if not needed * module/language/tree-il/compile-cps.scm (adapt-arity): Allow k to be $kargs for the 1-valued case. (convert): For single-valued continuations where the definition is clearly single-valued, avoid making a needless $kreceive and extra "rest" binding that will just be filled with () and have to be eliminated later. 2017-11-30 Andy Wingo -O1 disables call precoloring * module/language/cps/compile-bytecode.scm (compile-function) (emit-bytecode): * module/language/cps/slot-allocation.scm (allocate-slots): * module/language/cps/optimize.scm (cps-default-optimization-options): Allow the "lazy vars" optimization, a form of slot precoloring, to be disabled. It will be disabled at -O0 or -O1, to speed compilation times. Improve CSE complexity * module/language/cps/cse.scm (compute-available-expressions): (compute-equivalent-subexpressions): Improve algorithmic complexity of CSE by pre-computing the labels whose reads are clobbered by a label's writes. Add compute-clobber-map to effect analysis * module/language/cps/effects-analysis.scm (compute-clobber-map): New public function. Minor CSE run-time optimization * module/language/cps/cse.scm (compute-equivalent-subexpressions): Minor optimization to reduce the size of equivalent expression keys, and to avoid some work if an expression has no key. 2017-11-29 Andy Wingo Simplify live variable computation for graphs without loops * module/language/cps/slot-allocation.scm (compute-reverse-control-flow-order): For graphs without back-edges, use a simplified computation of reverse control flow order. Add nullary intmap and intset folders * module/language/cps/intmap.scm (intmap-fold, intmap-fold-right): * module/language/cps/intset.scm (intset-fold, intset-fold-right): Add nullary folders. Fix logand type inference * module/language/cps/types.scm (logand): We were computing the wrong ranges when either argument was negative; a terrible bug! (logsub): Also fix range when A is negative and B is non-negative. (ulogand): Tighten up range. 2017-11-22 Ludovic Courtès ltdl wrappers now use a recursive mutex. Fixes . Reported by noxdafox . * libguile/dynl.c (scm_init_dynamic_linking): Add call to 'scm_i_pthread_mutex_init'. 2017-11-22 Matt Wette Ludovic Courtès foreign: Add 'uintptr_t' and 'intptr_t'. * libguile/foreign.c (scm_uintptr_t, scm_intptr_t): New variables. (scm_init_foreign): Define them. * module/system/foreign.scm: Export 'intptr_t' and 'uintptr_t'. * doc/ref/api-foreign.texi (Foreign Types): Document them. 2017-11-22 Maxim Cournoyer scripts: help: Fix reference to the "Using Guile Tools" node. Fixes . * module/scripts/help.scm (list-commands): Fix reference to the "Using Guile Tools" node. 2017-11-22 Sergei Trofimovich ia64: Fix crash in thread context switch. Fixes and . Backtrace looks like that: Program terminated with signal SIGSEGV, Segmentation fault. #0 0x200000000014a5c0 in scm_ia64_longjmp (JB=0x6000000000817020, VAL=1) at continuations.c:372 372 t->pending_rbs_continuation->backing_store, [Current thread is 1 (Thread 0x2000000000049340 (LWP 8190))] (gdb) bt #0 0x200000000014a5c0 in scm_ia64_longjmp (JB=0x6000000000817020, VAL=1) at continuations.c:372 #1 0x2000000000148e00 in scm_c_abort (vm=0x60000000000edea0, tag=0x6000000000795ba0, n=0, argv=0x60000fffff7f0ce0, cookie=-1) at control.c:239 #2 0x2000000000149070 in scm_at_abort (tag=0x6000000000795ba0, args=0x304) at control.c:258 (gdb) print t $2 = (scm_i_thread *) 0x6000000000068000 (gdb) print t->pending_rbs_continuation $3 = (scm_t_contregs *) 0xffeb The problem here is the value of 't->pending_rbs_continuation' pointer. It's supposed to poin to a register stack pointer or be NULL if not yet backed up. The problem is it is never initialized to NULL at creation time and contained garbage on stack. Sometimes people are lucky and have zeros on stack and guile works. But sometimes there is something and guile crashes. The fix is trivial: initialize 'pending_rbs_continuation = NULL' at thread registration time (the same way other threads are registered). Reported-by: Matt Turner * libguile/threads.c (guilify_self_1): Initialize pending_rbs_continuation to avoid crash on ia64. 2017-11-22 Arun Isaac Mention (ice-9 peg) module path. * doc/ref/api-peg.texi (PEG Parsing): Mention (ice-9 peg) module path. Convert `close' ref to xref. * doc/ref/api-io.texi (Ports): Convert `close' ref to xref. 2017-11-22 Ludovic Courtès Honor '%fresh-auto-compile'. Fixes . * libguile/load.c (scm_primitive_load_path): Set 'compiled_thunk' to SCM_BOOL_F when *scm_loc_fresh_auto_compile is true. * module/ice-9/boot-9.scm (load-in-vicinity)[load-absolute]: Call 'pre-compiled' only when %FRESH-AUTO-COMPILE is false. 2017-11-18 Ludovic Courtès Destroy the mutex associated with a dirstream. This is a followup to 187655cedb42cc4b01088179649b02295cd35260. * libguile/filesys.c (scm_dir_free): Add call to 'scm_i_pthread_mutex_destroy'. 2017-11-17 Ludovic Courtès 'readdir' no longer deadlocks upon error. If 'readdir' returned an error, we'd call SCM_SYSERROR, which would try to acquire 'scm_i_misc_mutex' and sit there forever because it was already taken. Reported at . * libguile/filesys.c (scm_opendir): Allocate storage for a mutex and store it as the third word of the SMOB. (scm_readdir): Use that mutex instead of 'scm_i_misc_mutex'. Fixes the deadlock upon error. (scm_rewindir): Lock the mutex around the 'rewinddir' call. 2017-11-11 Ludovic Courtès http: Fix typo in proxy handling in 'write-request-line'. Reported by Mark H Weaver at . * module/web/http.scm (write-request-line): Fix more typos introduced in 96b994b6f815747ce2548123cc996d8132bd4781. 2017-11-10 Ludovic Courtès http: Fix typo in proxy handling in 'write-request-line'. Reported by Konrad Hinsen at . * module/web/http.scm (write-request-line): Move 'string-index' first in 'cond' clause. Fixes a regression introduced in 96b994b6f815747ce2548123cc996d8132bd4781. 2017-11-09 Ludovic Courtès Print exception location only once. Fixes a regression introduced in commit 39090e677eed54761e0952f2575ddef1504545d3. * module/ice-9/boot-9.scm (exception-printers)[print-exception]: Remove extraneous 'print-location' call. 2017-11-05 Ludovic Courtès Allow GDB support to be used with GDB-linked-against-Guile-2.0. * libguile/Makefile.am (INSTANTIATE): New variable. (install-data-hook): Use it. * libguile/libguile-2.2-gdb.scm: Autoload (system vm debug). Augment %load-path and %load-compiled-path, and reload (system base types). * module/system/base/types.scm: Remove #:hide to be 2.0-compatible. Use (system syntax internal) conditionally when on 2.2. 2017-11-01 Andy Wingo More robust vacuuming of in-use weak tables * libguile/weak-table.c (scm_t_weak_table); Add last_gc_no member. * libguile/weak-table.c (vacuum_weak_table): Only vacuum if we haven't done so since the last GC. (scm_c_weak_table_ref, scm_c_weak_table_put_x, scm_c_weak_table_remove_x) (scm_c_weak_table_fold): Vacuum the weak table if needed. (scm_weak_table_clear_x): Update last_gc_no flag, as no more vacuuming will be needed. Refactor weak table to use bitmaps for weak entries 2017-11-01 Andy Wingo Weak tables are now bucket-and-chain tables This change should make weak tables work better with libgc, as the weak components that need mark functions are smaller, so they don't overflow the mark queue. Also this prevents the need to move disappearing links. * libguile/weak-table.c (scm_t_weak_entry): Change to be a hash table chain entry. (struct weak_entry_data, do_read_weak_entry, read_weak_entry): Read out the key and value directly. (GC_move_disappearing_link, move_disappearing_links, move_weak_entry): Remove. (scm_t_weak_table): Rename "entries" member to "buckets", and "size" to "n_buckets". (hash_to_index, entry_distance, rob_from_rich, give_to_poor): Remove. (mark_weak_key_entry, mark_weak_value_entry): Mark a single link, and the next link. (mark_doubly_weak_entry): New kind. (allocate_entry): Allocate a single entry. (add_entry): New helper. (resize_table): Reimplement more like normal hash tables. (vacuum_weak_table): Adapt to new implementation. (weak_table_ref, weak_table_put_x, weak_table_remove_x): Adapt. (make_weak_table): Adapt. (scm_weak_table_clear_x): Actually unregister the links to prevent a memory leak. (scm_c_weak_table_fold): Collect items in an alist, then fold outside the lock. (scm_weak_table_prehistory): Initialize doubly_weak_gc_kind. 2017-10-31 Daniel Llorens Support general arrays in random:hollow-sphere! * libguile/random.c (vector_scale_x, vector_sum_squares): Handle general rank-1 #t or 'f64 arrays. * test-suite/tests/random.test: Add tests for random:hollow-sphere!. Fix bitvectors and non-zero lower bound arrays in truncated-print * module/ice-9/arrays.scm (array-print-prefix): New private function. * libguile/arrays.c (scm_i_print_array): Reuse (array-print-prefix) from (ice-9 arrays). Make sure to release the array handle. * module/ice-9/pretty-print.scm (truncated-print): Support bitvectors. Don't try to guess the array prefix but call array-print-prefix from (ice-9 arrays) instead. Fix call to print-sequence to support non-zero lower bound arrays. * test-suite/tests/arrays.test: Test that arrays print properly. * test-suite/tests/print.test: Test truncated-print with bitvectors, non-zero lower bound arrays. Support non-zero lower bounds in array-slice-for-each * libguile/array-handle.c (scm_array_handle_writable_elements): Fix error message. * libguile/array-map.c (scm_array_slice_for_each): Support non-zero lower bounds. Fix error messages. * test-suite/tests/array-map.test: Test scm_array_slice_for_each with non-zero lower bound argument. Fix sort, sort! for arrays with nonzero lower bound * module/ice-9/arrays.scm (array-copy): New function, export. * module/Makefile.am: Install (ice-9 arrays). * doc/ref/api-data.texi: Add documentation for (ice-9 arrays). * libguile/quicksort.i.c: Use signed bounds throughout. * libguile/sort.c (scm_restricted_vector_sort_x): Fix error calls. Fix calls to quicksort. * test-suite/tests/sort.test: Actually test that the sorted results match the original data. Test cases for non-zero base index arrays for sort, sort!, and stable-sort!. Remove documentation on uniform-vector-read!, uniform-vector-write * NEWS: Add specific removal notice. * doc/ref/api-data.texi: Remove documentation on uniform-vector-read!, uniform-vector-write. Replace uniform-vector-read benchmark with bytevector-io benchmark * benchmark-suite/benchmarks/uniform-vector-read.bm: Remove; uniform-vector-read! and uniform-vector-write were deprecated in 2.0 and are have been removed in 2.1. * benchmark-suite/benchmarks/bytevector-io.bm: New benchmark. * benchmark-suite/Makefile.am: Run the new benchmark. Allow scm_XXX_writable_elements on empty vectors, even if immutable * libguile/array-handle.c (initialize_vector_handle): Set both element pointers to NULL if the vector is empty. * libguile/array-map.c (racp): Ignore immutability if destination is empty. * test-suite/tests/sort.test: Check empty/mutable/immutable vectors with sort!. * test-suite/tests/array-map.test: Check array-copy! with empty/immutable destination. 2017-10-25 Ludovic Courtès Allow garbage collection of revealed file ports. Reported at . Discussed at . * libguile/fports.c (revealed_ports, revealed_lock): Remove. (scm_revealed_count): Just return 'SCM_REVEALED (port)'. (scm_set_port_revealed_x, scm_adjust_port_revealed_x): Remove REVEALED_PORTS manipulation. (fport_close): Do nothing when SCM_REVEALED (port) > 0. * libguile/fports.h (scm_t_fport): Adjust comment; make 'revealed' unsigned. * libguile/ports.c (do_close): Call 'close_port' instead of 'scm_close_port'. (scm_close_port): Rename to... (close_port): ... this. Add 'explicit' parameter. Clear 'revealed' field when PORT is a file port and EXPLICIT is true. (scm_close_port): Call 'close_port'. * test-suite/tests/ports.test ("close-port & revealed port") ("revealed port fdes not closed"): New tests. 2017-10-25 Ludovic Courtès 'frame-matcher' doesn't crash when the last IP is unknown. This fixes a bug when using ",break": system/vm/traps.scm:127:31: system/vm/traps.scm:127:31: In procedure <: Wrong type: #f * module/system/vm/traps.scm (frame-matcher): Check whether END is true. 2017-09-25 Andy Wingo Add struct-ref/unboxed, struct-set!/unboxed * NEWS: Add news entry. * doc/ref/api-data.texi (Vtables, Structure Basics): Update documentation. * libguile/struct.c (scm_i_struct_equalp): Avoid using struct-ref on unboxed fields. (scm_struct_ref, scm_struct_set_x_unboxed): Issue deprecation warning when accessing unboxed fields. (scm_struct_ref_unboxed, scm_struct_set_x_unboxed): New functions. * libguile/struct.h (scm_struct_ref_unboxed, scm_struct_set_x_unboxed): New functions. * module/oop/goops.scm (class-add-flags!, class-clear-flags!): (class-has-flags?, , %allocate-instance, ): (compute-get-n-set, unboxed-get, unboxed-set, unboxed-slot?): (allocate-slots, %prep-layout!, make-standard-class, initialize): Adapt to access unboxed nfields and flags fields via the new accessors. 2017-09-23 Andy Wingo GOOPS slot access protected via slot accessors, not struct perms * module/oop/goops.scm (opaque-slot?, read-only-slot?): New helpers. (allocate-slots): Protect opaque and read-only slots by wrapping the slot accessors instead of relying on struct permissions. (%compute-layout): Remove opaque-slot case. Deprecate opaque struct fields * NEWS: Add entry. * doc/ref/api-data.texi (Vtables, Structure Basics): Remove mention of opaque field protection. * libguile/struct.c (scm_make_struct_layout, scm_make_struct_no_tail): Remove discussion of opaque fields. (set_vtable_layout_flags): Issue a deprecation warning when opaque fields are used. 2017-09-22 Andy Wingo Remove needless static variables from goops.c * libguile/goops.c: Remove many static SCM variables that were not used on the C level, like class_protected for and so on. Fix up make-struct-layout and make-struct/no-tail docstrings * libguile/struct.c (scm_make_struct_layout, scm_make_struct_no_tail): Fix up docstrings for self and tail deprecation. Deprecate struct "self" slots * libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use a normal slot instead of a self slot. * libguile/print.c (make_print_state): Initialize "handle" slot manually. * libguile/struct.c (issue_deprecation_warning_for_self_slots): New helper, called when making vtables to issue deprecation warnings for "self" slots. Avoids warning for the "self" slot that's part of the fixed vtable slots. (scm_i_struct_inherit_vtable_magic): Call issue_deprecation_warning_for_self_slots. * doc/ref/api-data.texi (Vtables, Structure Basics): Remove references to self slots. * NEWS: Add entry. Remove unused code in struct.c * libguile/struct.c (scm_make_struct_layout, scm_struct-ref) (scm_struct_set_x): Remove commented-out support for signed and double raw fields. Deprecate make-struct * libguile/struct.c: Replace uses of scm_make_struct with scm_make_struct_no_tail or scm_c_make_struct. (scm_make_struct_no_tail): Move this function to C instead of Scheme to be able to deprecate scm_make_struct. * libguile/struct.h (scm_make_struct_no_tail): New public declaration. * libguile/deprecated.h: * libguile/deprecated.c (scm_make_struct): Deprecate. * libguile/print.c: * libguile/procs.c: * libguile/stacks.c: Replace uses of scm_make_struct with scm_make_struct_no_tail. * test-suite/tests/coverage.test: * test-suite/tests/structs.test: Use make-struct/no-tail instead of make-struct. * NEWS: Add entry. 2017-09-20 Andy Wingo Remove references to tail arrays in the documentation * doc/ref/api-data.texi (Vtables, Structure Basics): Update to remove references to tail arrays, in preparation for deprecation. Use make-struct/no-tail instead of make-struct * module/ice-9/boot-9.scm: * module/language/cps/effects-analysis.scm: * module/language/elisp/falias.scm: * module/language/tree-il.scm: * module/language/tree-il/primitives.scm: * module/rnrs/records/procedural.scm: * module/srfi/srfi-35.scm: * module/system/base/syntax.scm: Change uses of make-struct to make-struct/no-tail. psyntax generates calls to make-struct/no-tail * module/ice-9/psyntax.scm (define-expansion-constructors): Expand to make-struct/no-tail. * module/ice-9/psyntax-pp.scm: Regenerate. 2017-07-31 Mark H Weaver put-bytevector, unget-bytevector: Allow start == bytevector length. * libguile/r6rs-ports.c (scm_put_bytevector, scm_unget_bytevector): When three arguments (port bv start) are provided, allow start to be equal to the length of the bytevector, resulting in a zero-length write. 2017-06-15 Ludovic Courtès Correctly relativize file names in the presence of common prefixes. * libguile/filesys.c (scm_i_relativize_path): When DIR is a prefix of SCANON, make sure DIR ends with a separator or SCANON starts with a separator. * test-suite/tests/ports.test (%temporary-directory): New variable. ("%file-port-name-canonicalization")["relative canonicalization with common prefixes"]: New test. 2017-06-12 Mark H Weaver doc: Document 'short' and 'unsigned-short' foreign types. This is a followup to commit 42f7c01e0a1d1c139ec8b835429a80ab15ac4007. Reported by Adriano Peluso . * doc/ref/api-foreign.texi (Foreign Types): Add missing entries for 'short' and 'unsigned-short'. 2017-05-31 Andy Wingo Update guile.m4 to check for 2.2 by default * meta/guile.m4 (GUILE_PKG): Update default Guile versions to 2.2. guile.m4 fix for 3.0 prereleases * meta/guile.m4 (GUILE_PROGS): Allow prereleases of Guile with a new major version. 2017-05-22 Andy Wingo Minor updates of README. * README: Minor updates. Remove legacy NEWS.guile-vm. * NEWS.guile-vm: Remove. Minor updates to HACKING. * HACKING: Minor updates. Remove outdated ANNOUNCE. * ANNOUNCE: Remove outdated file. Remove outdated README.guile-vm. * README.guile-vm: Remove. 2017-05-21 Andy Wingo web: add support for URI-reference Based on a patch by Daniel Hartwig . * NEWS: Update. * doc/ref/web.texi (URIs): Fragments are properly part of a URI, so remove the incorrect note. Add documentation on URI subtypes. * module/web/uri.scm (uri-reference?): New base type predicate. (uri?, relative-ref?): Specific predicates. (validate-uri-reference): Strict validation. (validate-uri, validate-relative-ref): Specific validators. (build-uri-reference, build-relative-ref): New constructors. (string->uri-reference): Rename from string->uri. (string->uri, string->relative-ref): Specific constructors. (uri->string): Add #:include-fragment? keyword argument. * module/web/http.scm (parse-request-uri): Use `build-uri-reference', and result is a URI-reference, not URI, object. No longer infer an absent `uri-scheme' is `http'. (write-uri): Just use `uri->string'. (declare-uri-header!): Remove unused function. (declare-uri-reference-header!): Update. Rename from `declare-relative-uri-header!'. * test-suite/tests/web-uri.test ("build-uri-reference"): ("string->uri-reference"): Add. ("uri->string"): Also tests for relative-refs. * test-suite/tests/web-http.test ("read-request-line"): ("write-request-line"): Update for no scheme in some URIs. ("entity headers", "request headers"): Content-location, Referer, and Location should also parse relative-URIs. * test-suite/tests/web-request.test ("example-1"): Expect URI-reference with no scheme. 2017-05-17 Andy Wingo readline: Avoid interpreting control characters in pastes. * NEWS: Update. * doc/ref/repl-modules.texi (Readline Options): Update for bracketed-paste. * guile-readline/readline.h (SCM_READLINE_BRACKETED_PASTE): Add bracketed-paste option. * guile-readline/readline.c (scm_readline_opts): Add bracketed-paste. (scm_init_readline): Wire up the logic. 2017-05-16 Manolis Ragkousis On Hurd, skip tests that require working setrlimits for memory On Hurd, setrlimits are not yet implemented. See . * test-suite/standalone/test-out-of-memory: skip for Hurd. * test-suite/standalone/test-stack-overflow: skip for Hurd. 2017-04-28 Andy Wingo Fix reading of HTTPS responses that are smaller than port buffer * module/web/client.scm (tls-wrap): Use get-bytevector-some instead of get-bytevector-n, to prevent Guile from attempting to read more bytes than are available. Normally trying to read data on a shut-down socket is fine, but but gnutls issues an error if you attempt to read data from a shut-down socket, and that appears to be a security property. Fixes HTTPS requests whose responses are smaller than the port buffer. 2017-04-25 Zefram Correct note about Gregorian reform in SRFI-19 * doc/ref/srfi-modules.texi (SRFI-19): SRFI-19 specifies proleptic use of the Gregorian calendar, so it was incorrect of the documentation to describe the code as erroneous in doing so. Rewrite the caution more neutrally, and move it to the section about the "date" structure, where it seems most relevant. 2017-04-22 Ludovic Courtès SRFI-19: Swap seconds and nanoseconds in 'current-time-monotonic'. * module/srfi/srfi-19.scm (current-time-monotonic): Swap the 2nd and 3rd arguments. Fixes a regression introduced in commit b11e2922c36c4105797c269c7e616535b702698a. 2017-04-21 Andy Wingo Bump version to 2.2.2. * GUILE-VERSION: Bump to 2.2.2. Update NEWS some more * NEWS: More updates. Update NEWS. * NEWS: Update. Syntax objects are comparable with equal? * libguile/eq.c (scm_equal_p, scm_raw_ihash): Add cases for syntax objects, which should be comparable with equal?. * test-suite/tests/syntax.test ("syntax objects"): Add tests. 2017-04-20 Thomas Danckaert SRFI-37: Account for zero-length arguments. * module/srfi/srfi-37.scm (args-fold): When checking if an argument is an option (starts with #\-), first check if the length is non-zero. 2017-04-20 Andy Wingo Restore libgc 7.2 compatibility * configure.ac: Check for GC_is_heap_ptr, added after libgc 7.2. * libguile/pairs.h (GC_is_heap_ptr): Define a shim for GC_is_heap_ptr, inside BUILDING_LIBGUILE so as not to expose it to users. 2017-04-19 Andy Wingo GNU Guile 2.2.1. * GUILE-VERSION (GUILE_MICRO_VERSION, LIBGUILE_INTERFACE_CURRENT): (LIBGUILE_INTERFACE_AGE): Increment version. Update release docs * doc/release.org: Update for 2.2. Update NEWS * NEWS: Update. 2017-04-19 Sergei Trofimovich guile-snarf: skip -g* arguments to avoid build failure * libguile/guile-snarf.in: skip -g* arguments to avoid failure on -ggdb3. Bug: https://bugs.gentoo.org/608190 Bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25803 2017-04-19 Sergei Trofimovich api-procedures.texi: typo: 'an' -> 'on' * doc/ref/api-procedures.texi: Fix typo. Documentation typo tweak * doc/ref/api-data.texi: Tweak 'u+0007' to 'U+0007' (as in the rest of the table). 2017-04-19 Andy Wingo Fix spurious warnings in net_db.c * libguile/guile-func-name-check (/^SCM_DEFINE /): Fix pattern to not produce spurious warnings. Thanks to Dale Smith for the suggestion. Fixes https://bugs.gnu.org/26123. 2017-04-19 Freja Nordsiek Fixed bug: statprof flat display wasn't writing summary lines to port * module/statprof.scm (statprof-display/flat): fixed bug where summary lines were written to (current-output-port) instead of the provided port. 2017-04-19 Andy Wingo Document guile-2.2 cond-expand feature. * doc/ref/srfi-modules.texi (SRFI-0): Mention guile-2.2 feature. Add --with-bdw-gc and update README * README: Update to 2.2. Add instructions for FreeBSD based on notes from Matt Wette. * configure.ac: Add --with-bdw-gc argument. Fix typo in fold-layout documentation * doc/ref/sxml.texi (SXML Tree Fold): Fix minor typo. Fixes https://bugs.gnu.org/26188. Add srfi-19 ~f regression test * test-suite/tests/srfi-19.test ("SRFI date/time library"): Add test for https://bugs.gnu.org/26259. Fix date->string ~f operator to not emit leading zeros * module/srfi/srfi-19.scm (directives): Format ~f without leading zeroes. Fixes https://bugs.gnu.org/26260. * test-suite/tests/srfi-19.test ("SRFI date/time library"): Add test. 2017-04-19 Andrew Moss Fixed bug: ~N mishandles small nanoseconds value Fixes . Reported by Zefram . * module/srfi/srfi-19.scm ("define directives"): N padding increased from 7 to 9 * test-suite/tests/srfi-19.test ("date->string"): New test. 2017-04-19 Andy Wingo SRFI-19 current-time-monotonic returns time of right type * module/srfi/srfi-19.scm (current-time-monotonic): Actually return a time with the correct type. Fixes #26329. Avoid causing GC when lookup up exception handler * libguile/fluids.c (scm_fluid_ref_star): Avoid causing GC. Possibly fixes some crashes during out-of-memory conditions (#26351). Fix test suite for constant literals change * test-suite/tests/elisp-compiler.test ("List Built-Ins"): Avoid mutating a literal pair. If this turns out to be necessary for elisp, the compiler will have to compile literals to calls to run-time heap allocations rather than constants. 2017-04-18 Andy Wingo Bump objcode version in a compatible way * libguile/_scm.h (SCM_OBJCODE_MINIMUM_MINOR_VERSION): New definition, indicating the oldest objcode version that we support. (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/loader.c (process_dynamic_segment): Support a range of versions. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. Add sandboxed evaluation facility * module/ice-9/sandbox.scm: New file. * module/Makefile.am (SOURCES): Add new file. * doc/ref/api-evaluation.texi (Sandboxed Evaluation): New section. * NEWS: Update. * test-suite/tests/sandbox.test: New file. * test-suite/Makefile.am: Add new file. Update NEWS * NEWS: Add note about constants and mutation. All literal constants are read-only * libguile/array-handle.c (initialize_vector_handle): Add mutable_p argument. Unless the vector handle is mutable, null out its writable_elements member. (scm_array_get_handle): Adapt to determine mutability of the various arrays. (scm_array_handle_elements, scm_array_handle_writable_elements): Reverse the sense: instead of implementing read-only in terms of read-write, go the other way around, adding an assertion in the read-write case that the array handle is mutable. * libguile/array-map.c (racp): Assert that the destination is mutable. * libguile/bitvectors.c (SCM_F_BITVECTOR_IMMUTABLE, IS_BITVECTOR): (IS_MUTABLE_BITVECTOR): Add a flag to indicate immutability. (scm_i_bitvector_bits): Fix indentation. (scm_i_is_mutable_bitvector): New helper. (scm_array_handle_bit_elements) ((scm_array_handle_bit_writable_elements): Build writable_elements in terms of elements. (scm_bitvector_elements, scm_bitvector_writable_elements): Likewise. (scm_c_bitvector_set_x): Require a mutable bitvector for the fast-path. (scm_bitvector_to_list, scm_bit_count): Use read-only elements() function. * libguile/bitvectors.h (scm_i_is_mutable_bitvector): New decl. * libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE): (INTEGER_GETTER_PROLOGUE, INTEGER_SETTER_PROLOGUE): (INTEGER_REF, INTEGER_NATIVE_REF, INTEGER_SET, INTEGER_NATIVE_SET): (GENERIC_INTEGER_ACCESSOR_PROLOGUE): (GENERIC_INTEGER_GETTER_PROLOGUE, GENERIC_INTEGER_SETTER_PROLOGUE): (LARGE_INTEGER_NATIVE_REF, LARGE_INTEGER_NATIVE_SET): (IEEE754_GETTER_PROLOGUE, IEEE754_SETTER_PROLOGUE): (IEEE754_REF, IEEE754_NATIVE_REF, IEEE754_SET, IEEE754_NATIVE_SET): Setters require a mutable bytevector. (SCM_BYTEVECTOR_SET_FLAG): New helper. (SCM_BYTEVECTOR_SET_CONTIGUOUS_P, SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Remove helpers. (SCM_VALIDATE_MUTABLE_BYTEVECTOR): New helper. (make_bytevector, make_bytevector_from_buffer): Use SCM_SET_BYTEVECTOR_FLAGS. (scm_c_bytevector_set_x, scm_bytevector_fill_x) (scm_bytevector_copy_x): Require a mutable bytevector. * libguile/bytevectors.h (SCM_F_BYTEVECTOR_CONTIGUOUS) (SCM_F_BYTEVECTOR_IMMUTABLE, SCM_MUTABLE_BYTEVECTOR_P): New definitions. * libguile/bytevectors.h (SCM_BYTEVECTOR_CONTIGUOUS_P): Just access one bit. * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Implement writable_elements() in terms of elements(). * libguile/strings.c (scm_i_string_is_mutable): New helper. * libguile/uniform.c (scm_array_handle_uniform_elements): (scm_array_handle_uniform_writable_elements): Implement writable_elements in terms of elements. * libguile/vectors.c (SCM_VALIDATE_MUTABLE_VECTOR): New helper. (scm_vector_elements, scm_vector_writable_elements): Implement writable_elements in terms of elements. (scm_c_vector_set_x): Require a mutable vector. * libguile/vectors.h (SCM_F_VECTOR_IMMUTABLE, SCM_I_IS_MUTABLE_VECTOR): New definitions. * libguile/vm-engine.c (VM_VALIDATE_MUTABLE_BYTEVECTOR): (VM_VALIDATE_MUTABLE_VECTOR, vector-set!, vector-set!/immediate) (BV_BOUNDED_SET, BV_SET): Require mutable bytevector/vector. * libguile/vm.c (vm_error_not_a_mutable_bytevector): (vm_error_not_a_mutable_vector): New definitions. * module/system/vm/assembler.scm (link-data): Mark residualized vectors, bytevectors, and bitvectors as being read-only. Attempt to mutate residualized literal pair throws exception * libguile/validate.h (SCM_VALIDATE_MUTABLE_PAIR): * libguile/pairs.h (scm_is_mutable_pair): New internal definitions. * libguile/pairs.c (scm_set_car_x, scm_set_cdr_x): Validate mutable pairs. * libguile/alist.c (scm_assq_set_x, scm_assv_set_x, scm_assoc_set_x): * libguile/list.c (scm_reverse_x, scm_list_set_x, scm_list_cdr_set_x): * libguile/srcprop.c (scm_make_srcprops): * libguile/srfi-1.c (scm_srfi1_append_reverse_x) (scm_srfi1_delete_duplicates_x): * libguile/symbols.c (scm_symbol_fset_x, scm_symbol_pset_x): * libguile/sort.c (scm_merge_list_x): Use scm_set_car_x / scm_set_cdr_x instead of the macros, so as to check for mutable pairs. (SCM_VALIDATE_MUTABLE_LIST): New internal helper macro. (scm_sort_x, scm_stable_sort_x, scm_sort_list_x): Use SCM_VALIDATE_MUTABLE_LIST. * libguile/vm-engine.c (VM_VALIDATE_MUTABLE_PAIR): New definition. (set-car!, set-cdr!): Use VM_VALIDATE_MUTABLE_PAIR. Fix error message for set-cdr!. 2017-04-14 Ludovic Courtès types: Hide one of the 'bytevector->string' procedures. * module/system/base/types.scm: Hide 'bytevector->string' from (rnrs io ports). 2017-04-04 Michael Gran Only run tests that require fork if it is provided * test-suite/tests/00-repl-server.test (call-with-repl-server): throw if no fork provided * test-suite/tests/00-socket.test (primitive-fork-if-available): new help procedure (bind/sockaddr, AF_UNIX/SOCK_STREAM): use helper func * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): throw if no fork provided 2017-04-03 Andy Wingo Speed up procedure-minimum-arity for fixed arity * libguile/programs.c (try_parse_arity): Add a case for assert-nargs-ee/locals. 2017-04-01 Mike Gran fix repl server test to allow for ECONNABORTED For some systems, ECONNABORTED is a failure condition for reading from closed sockets. * test-suite/tests/00-repl-server.test (HTTP inter-protocol attack): modified 2017-03-28 Andy Wingo Add allow-legacy-syntax-objects? parameter * module/ice-9/psyntax.scm (syntax?): Only recognize legacy syntax objects if the new allow-legacy-syntax-objects? parameter is true. * module/ice-9/boot-9.scm (allow-legacy-syntax-objects?): New parameter. * doc/ref/api-macros.texi (Syntax Transformer Helpers): Document the horrible situation with legacy syntax objects. * NEWS: Add entry. Psyntax generates new syntax objects * module/ice-9/psyntax.scm (make-syntax-object): Change to make new-style syntax objects. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/compile-psyntax.scm (squeeze-syntax-object): Change to be functional. (squeeze-constant): Likewise. (squeeze-tree-il): Likewise. (translate-literal-syntax-objects): New pass. The compiler can embed literal syntax objects into compiled objects, but syntax can no longer be read/written; otherwise users could forge syntax objects. So for the bootstrap phase, rewrite literal constants to calls to make-syntax. Beginnings of psyntax switch to new syntax objects * module/ice-9/psyntax.scm: Baby steps towards support of a new representation of syntax objects. * module/ice-9/psyntax-pp.scm: Regenerate. Add disjoint syntax object type * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, noinst_HEADERS): Add syntax.c and syntax.h. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (class_syntax, scm_class_of, scm_goops_early_init): * libguile/init.c (scm_init_guile): * libguile/print.c (iprin1): * libguile/tags.h (scm_tc7_syntax): * module/oop/goops.scm (): * module/system/base/types.scm (%tc7-syntax, cell->object): * module/system/vm/disassembler.scm (code-annotation): Wire up the new data type. * libguile/syntax.c: * libguile/syntax.h: New files. * module/ice-9/boot-9.scm: Move new definitions to (system syntax internal). * module/system/syntax.scm (print-syntax): New helper. * module/system/vm/assembler.scm (statically-allocatable?) (intern-constant, link-data): Arrange to be able to write syntax objects into images. * module/language/cps/types.scm (&syntax): New type. Remove &hash-table; it was never detected, an internal binding, and we need the bit to avoid going into bignum territory. Plumbing changes to rename "syntax-module" * module/ice-9/psyntax.scm (%syntax-module): Rename from syntax-module in order to make room for a new syntax-module primitive binding. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm: Push syntax bindings into an internal module. * module/system/syntax.scm: New file. * module/Makefile.am (SOURCES): Add system/syntax.scm. 2017-03-23 Mike Gran Git ignore .exe files * .gitignore: add *.exe 2017-03-21 Mike Gran i18n: add international sign positions to %locale-dump * module/ice-9/i18n.scm (%locale-dump): modified i18n: locale-positive-separated-by-space? should return bool, not string * libguile/i18n.c (scm_nl_langinfo): unpack INT_P_SEP_BY_SPACE as bool * test-suite/tests/i18n.test (nl-langinfo et al.): new tests i18n: add debugging helper procedure for locales * module/ice-9/i18n.scm (%locale-dump): new procedure 2017-03-20 Mike Gran i18n: add tests for locale-digit-grouping * test-suite/tests/i18n.test ("nl-langinfo et al."): new tests i18n: add tests for locale AM/PM * test-suite/tests/i18n.test ("nl-langinfo et al."): new tests i18n: rename locale-monetary-digit-grouping to locale-monetary-grouping * module/ice-9/i18n.scm (locale-monetary-digit-grouping): renamed to locale-monetary grouping (monetary-amount->locale-string): use renamed procedure * test-suite/tests/i18n.test (%french-locale): add LC_MONETARY (%french-utf8-locale): add LC_MONETARY ("nl-langinfo et al."): tests for locale-monetary-grouping 2017-03-17 Ludovic Courtès web: Avoid deprecated '_IOFBF'. * module/web/client.scm (open-socket-for-uri): Use 'block instead of _IOFBF. web: Remove export of nonexistent 'open-connection-for-uri'. * module/web/client.scm: Don't export 'open-connection-for-uri', which doesn't exist. 2017-03-15 Andy Wingo Add generic prebuilt links to dist. * prebuilt/Makefile.am (EXTRA_DIST): Add generic prebuilt links. Update --version and REPL copyright years * module/ice-9/command-line.scm (version-etc): * module/system/repl/common.scm (*version*): Update release year. GNU Guile 2.2.0. * GUILE-VERSION (GUILE_MINOR_VERSION, GUILE_MICRO_VERSION): Bump. (LIBGUILE_INTERFACE_CURRENT): Incrememt to indicate that we now have a defined libtool ABI "interface" of 1, that we support no other interface (yet), and that this is the 0th revision of that interface. 2017-03-15 Freja Nordsiek GUILE_SITE_DIR: Update to find compiled site directories * meta/guile.m4 (GUILE_SITE_DIR): Update to find compiled site directories. * meta/guile-2.2.pc.in: Add entry for site-ccache directory. 2017-03-14 Andy Wingo Better eval+promise+gc test * test-suite/tests/eval.test ("promises"): Increase clear pass rate on this test. Resolve unresolved alist test cases * test-suite/tests/alist.test: Update unresolved cases to match current behavior. Bogus but stable :/ 2017-03-14 Ludovic Courtès build: Compress with lzip too. * configure.ac: Add 'dist-lzip' Automake option. 2017-03-14 Freja Nordsiek Fixed reversed version order bug in GUILE_PROGS Autoconf macro. * meta/guile.m4 (GUILE_PROGS): Build version in correct order. 2017-03-14 Andy Wingo Update NEWS * NEWS: Update for 2.2.0. configure detects which set of prebuilt binaries to use * configure.ac: Use detected endianness and word size to automatically select which set of prebuilt binaries to use. * meta/build-env.in (top_builddir): * meta/uninstalled-env.in (top_builddir): Update to use SCM_PREBUILT_BINARIES for prebuilt entry in GUILE_LOAD_COMPILED_PATH. * prebuilt/32-bit-big-endian: * prebuilt/32-bit-little-endian: * prebuilt/64-bit-little-endian: New links. * prebuilt/x86_64-pc-linux-gnu: Remove this link now that it's unneeded. 2017-03-13 Andy Wingo Nonlocal prompt returns cause all effects * module/language/cps/effects-analysis.scm (expression-effects): Prompts cause &all-effects. I tried to limit this change to CSE but it was actually LICM that was borked, so better to be conservative * test-suite/tests/control.test ("escape-only continuations"): Add test. 2017-03-13 Andy Wingo Fix finalizer resuscitation causing excessive GC * libguile/finalizers.c (async_gc_finalizer): (scm_i_register_async_gc_callback): Replace "weak gc callback" mechanism with "async gc callback" mechanism. Very similar but the new API is designed to be called a bounded number of times, to avoid running afoul of libgc heuristics. * libguile/weak-list.h: New internal header. * libguile/Makefile.am (noinst_HEADERS): Add weak-list.h. * libguile/weak-set.c (vacuum_all_weak_sets): (scm_c_make_weak_set, scm_init_weak_set): * libguile/weak-table.c (vacuum_all_weak_tables): (scm_c_make_weak_table, scm_init_weak_table): Arrange to vacuum all weak sets from a single async GC callback, and likewise for weak tables. Thanks to Ludovic Courtès for tracking this bug down! 2017-03-10 Andy Wingo Guile 2.1.8. * GUILE-VERSION (GUILE_MICRO_VERSION): Bump. Revert "Fix "Scheme Syntax" info rendering" This reverts commit 62f08b8f38990c1849ea61cd622f84b3d2611cd9, which was causing failing texi2dvi runs. Update NEWS * NEWS: Update for 2.1.8. Fix atomics compilation on clang * libguile/atomics-internal.h (scm_atomic_subtract_uint32): (scm_atomic_compare_and_swap_uint32, scm_atomic_set_pointer): (scm_atomic_ref_pointer, scm_atomic_set_scm): (scm_atomic_ref_scm, scm_atomic_swap_scm): (scm_atomic_compare_and_swap_scm): Use C11 atomic types if we have loaded C11 stdatomic.h. 2017-03-09 Vladislav Ivanishin Fix a couple of typos in the docs * doc/ref/scheme-ideas.texi: the some way -> the same way * doc/ref/scheme-intro.texi: Use @math inside a texinfo command (turns out $math$ is not processed in this context and thus is not rendered correctly). 2017-03-09 Andy Wingo VM support for string-set!; slimmer read-string * doc/ref/vm.texi (Inlined Scheme Instructions): Add string-set!. * libguile/vm-engine.c (string-set!): New opcode. * module/ice-9/rdelim.scm (read-string): Reimplement in terms of a geometrically growing list of strings, to reduce total heap usage when reading big files. * module/language/cps/compile-bytecode.scm (compile-function): Add string-set! support. * module/language/cps/types.scm (string-set!): Update for &u64 index. * module/language/tree-il/compile-cps.scm (convert): Unbox index to string-set!. * module/system/vm/assembler.scm (system): Export string-set!. Micro-optimize update-port-position. * libguile/ports.c (update_port_position): Only fetch line if we need to increment it. 2017-03-09 Daniel Llorens Fix bug in comparison between real and complex This bug was introduced by 35a90592501ebde7e7ddbf2486ca9d315e317d09. * module/language/cps/specialize-numbers.scm (specialize-operations): Check that both operands are real as a condition for specialize-f64-comparison. * test-suite/tests/numbers.test: Add test. 2017-03-09 Andy Wingo Remove contification restriction in case-lambda * module/language/cps/compile-bytecode.scm (compile-function): Check for fallthrough after $kclause too; possible to need to jump if clause tails are contified. * module/language/cps/contification.scm (compute-contification-candidates): Enable inter-clause contification. All clauses of function have same nlocals * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/slot-allocation.scm ($allocation) (lookup-nlocals, compute-frame-size, allocate-slots): Adapt to have one frame size per function, for all clauses. Adapt gcprof to preemptive interrupts * module/statprof.scm (gcprof): Remove handle-interrupts trampoline from captured stacks. Adapt statprof to new preemptive interrupts * module/statprof.scm (profile-signal-handler): Cut an additional stack frame, corresponding to the handle-interrupts trampoline added recently. 2017-03-09 Ludovic Courtès statprof: 'with-statprof' honors #:display-style. * module/statprof.scm (with-statprof): Pass #:display-style to 'statprof'. 2017-03-08 Andy Wingo 64KB segment alignment * module/system/vm/linker.scm (*lcm-page-size*): Rename from *page-size*, change to 64 KB. * libguile/loader.c (load_thunk_from_memory): Only require page size alignment, knowing that although Guile might emit ELF with 64k alignment, it only really needs page alignment. 2017-03-07 Andy Wingo Fix new thread-local fluids test * test-suite/tests/fluids.test ("dynamic states"): Fix test. Fix documentation build * doc/ref/api-control.texi (Fluids and Dynamic States): Fix link. Add thread local fluids * libguile/fluids.h (struct scm_dynamic_state): Add thread_local_values table. Thread locals are flushed to a separate thread-local table. The references are strong references since the table never escapes the thread. (scm_make_thread_local_fluid, scm_fluid_thread_local_p): New functions. * libguile/fluids.c (FLUID_F_THREAD_LOCAL): (SCM_I_FLUID_THREAD_LOCAL_P): New macros. (restore_dynamic_state): Add comment about precondition. (save_dynamic_state): Flush thread locals. (scm_i_fluid_print): Print thread locals nicely. (new_fluid): Add flags arg. (scm_make_fluid, scm_make_fluid_with_default, scm_make_unbound_fluid): Adapt. (scm_make_thread_local_fluid, scm_fluid_thread_local_p): New functions. (fluid_set_x): Special flushing logic for thread-locals. (fluid_ref): Special cache miss logic for thread locals. * libguile/stacks.c (scm_init_stacks): * libguile/throw.c (scm_init_throw): %stacks and %exception-handler are thread-locals. * libguile/threads.c (guilify_self_2): Init thread locals table. * test-suite/tests/fluids.test ("dynamic states"): Add test. * doc/ref/api-control.texi (Fluids and Dynamic States): Add link to Thread-Local Variables. * doc/ref/api-scheduling.texi (Thread Local Variables): Update with real thread-locals. * NEWS: Update. 2017-03-07 Mark H Weaver Ludovic Courtès psyntax: Generate identifiers in a deterministic fashion. Fixes . * module/ice-9/boot-9.scm (module-generate-unique-id!) (module-gensym): New procedures. (module): Add 'next-unique-id' field. (the-root-module): Inherit 'next-unique-id' value from early stub. (make-module, make-autoload-interface): Adjust calls to module-constructor. * module/ice-9/psyntax.scm (gen-label, new-mark): Generate unique identifiers from the module name and the per-module unique-id. (build-lexical-var, generate-temporaries): Use 'module-gensym' instead of 'gensym'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il/fix-letrec.scm (fix-letrec!): Use 'module-gensym' instead of 'gensym'. * module/system/base/syntax.scm (define-record): Likewise. (transform-record): Likewise. 2017-03-07 Mike Gran Check for working profiling and virtual itimers * configure.ac (HAVE_USABLE_GETITIMER_PROF, HAVE_USABLE_GETITIMER_VIRTUAL): new tests * doc/ref/posix.texi (setitimer, getitimer): document provided? 'ITIMER_VIRTUAL and 'ITIMER_PROF * doc/ref/statprof.texi (statprof): document ITIMER_PROF requirements * libguile/scmsigs.c (scm_setitimer, scm_getitimer): document (provided? 'ITIMER_VIRTUAL) and (provided? 'ITIMER_PROF) (scm_init_scmsigs): add features ITIMER_VIRTUAL and ITIMER_PROF * test-suite/tests/asyncs.test ("prevention via sigprof"): throw when unsupported * test-suite/tests/signals.test: throw when not supported * test-suite/tests/statprof.test: throw when not supported 2017-03-05 Mike Gran Can't recursively search DLLs with FFI on Cygwin * doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs. * test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly * test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly * test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly 2017-03-05 Mike Gran Disable Turkish locale tests on Cygwin Cygwin's support of Turkish casing rules is broken. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): modified 2017-03-03 Mike Gran Fix regression in non-mmap fallback elf loader * libguile/loader.c [!HAVE_SYS_MMAN_H] (map_file_contents): updated variables and function calls to the current names 2017-03-03 Mike Gran Cygwin: skip tests that require working setrlimits for memory On Cygwin, setrlimits cannot be used to set total memory availabe for a process. * test-suite/standalone/test-out-of-memory: skip for cygwin * test-suite/standalone/test-stack-overflow: skip for cygwin 2017-03-02 Andy Wingo Revert "build: Compress with lzip too." This reverts commit 89ce9fb31b00f1f243fe6f2450db50372cc0b86d. It was causing the hydra builds to fail. 2017-03-01 Andy Wingo Fix makeinfo warnings * doc/ref/api-languages.texi (Nil): * doc/ref/statprof.texi (Statprof): Use headings instead of sections to avoid makeinfo warnings. Remove useless subsection from hooks documentation * doc/ref/api-utility.texi (Hook Reference): Remove useless "handling hooks from C" section that was also generating warnings. Fix scheme-scripts markup. * doc/ref/scheme-scripts.texi (Scripting Examples): Fix $@ rendering in texinfo. Update NEWS for prerelease. * NEWS: Update for next prerelease. Update NEWS * NEWS: Update 2.0.x NEWS. Fold 2.1.7 NEWS into main 2.2 body. 2017-03-01 Arne Babenhauserheide Ludovic Courtès doc: Describe -e (module) on equal footing with (@ ...). * doc/ref/guile-invoke.texi, doc/ref/scheme-scripts.texi: describe the -e (module) shorthand as on equal footing with (@ ...) 2017-03-01 Ludovic Courtès i18n: 'number->locale-string' guesses the minimum number of decimals. This feature was removed by 4aead68cdb86ca60cc372f0cd558cadda90ddec5. * module/ice-9/i18n.scm (number-decimal-string): Rewrite the case where DIGIT-COUNT is not an integer. (number->locale-string): Always pass FRACTION-DIGITS to 'number-decimal-string'. * test-suite/tests/format.test ("~h localized number")["1234.5"] ["padding", "padchar"]: Remove decimal specifier. * test-suite/tests/i18n.test ("number->locale-string") ["fraction", * test-suite/tests/i18n.test ("format ~h")["12 345,678"]: Remove decimal specifier. Remove one decimal. * doc/ref/api-i18n.texi (Number Input and Output): Update 'number->locale-string' doc to mention the number of decimals. 2017-03-01 Ludovic Courtès i18n: Fix corner cases for monetary and number string conversions. Fixes . Reported by Martin Michel . * module/ice-9/i18n.scm (integer->string, number-decimal-string): New procedures. (monetary-amount->locale-string): Use them instead of 'number->string' followed by 'string-split'. (number->locale-string): Likewise. * test-suite/tests/i18n.test ("number->locale-string")["fraction"]: Add second argument to 'number->locale-string'. ["fraction, 1 digit"]: Round up. ["fraction, 10 digits", "trailing zeros", "negative integer"]: New tests. * test-suite/tests/i18n.test ("format ~h"): Pass the number of decimals for ~h. ("monetary-amount->locale-string")["French"]: Always expect two decimals after the comma. ["one cent", "very little money"]: New tests. * test-suite/tests/format.test ("~h localized number")["1234.5"]: Specify the number of decimals explicitly. ["padding"]: Expect zero decimals. ["padchar"]: Ask for one decimal. ["decimals", "locale"]: Adjust rounding. 2017-03-01 Ludovic Courtès tests: Choose a more plausible US English locale name. * test-suite/tests/i18n.test (%american-english-locale-name): Change to en_US.utf8". tests: Use 'pass-if-equal' for (ice-9 i18n) tests. * test-suite/tests/i18n.test ("number->locale-string") ("format ~h", "monetary-amount->locale-string"): Use 'pass-if-equal' instead of 'pass-if'. 2017-03-01 Ludovic Courtès i18n: Do not represent zero as "-0". Partly fixes . Reported by Martin Michel . * module/ice-9/i18n.scm (monetary-amount->locale-string): Don't negate AMOUNT when it's zero. (number->locale-string): Likewise. * test-suite/tests/i18n.test ("number->locale-string")["positive inexact zero, 1 digit"]: New test. ("monetary-amount->locale-string")["positive inexact zero"]: New test. 2017-03-01 John Paul Adrian Glaubitz Recognize sh3 as compilation targets * module/system/base/target.scm (cpu-endianness, triplet-pointer-size): Add case for "sh3". 2017-03-01 Georgi Kirilov doc: Fix typo in site packages documentation. * doc/ref/scheme-using.texi (Installing Site Packages): Fix typo doc: Fix typo in keywords documentation. * doc/ref/api-data.texi (Keyword Read Syntax): Fix typo 2017-03-01 Ludovic Courtès tests: Avoid statprof test failure on systems without 'setitimer'. Partly fixes . Reported by rennes@openmailbox.org. * test-suite/tests/statprof.test ("return values"): Wrap in 'when-implemented'. 2017-03-01 Ludovic Courtès build: Honor $SOURCE_DATE_EPOCH for the recorded timestamp. Reported by Jan Nieuwenhuizen at . * libguile/Makefile.am (libpath.h): Honor 'SOURCE_DATE_EPOCH'. 2017-03-01 Ludovic Courtès scandir: Avoid 'stat' calls on each entry. * module/ice-9/ftw.scm (scandir): Rewrite in terms of 'readdir'. build: Compress with lzip too. * configure.ac: Add 'dist-lzip' Automake option. build: Check for /gnu/store file names upon "make dist". * Makefile.am (assert-no-store-file-names): New rule, taken from Guix. (dist-hook): Depend on it. 2017-03-01 Andy Wingo Disable REPL server tests if no threads * test-suite/tests/00-repl-server.test (call-with-repl-server): The REPL server needs threads so don't bother testing if we have no threads. Also, prevent SIGPIPE from killing the parent process. 2017-03-01 Ludovic Courtès tests: Avoid race condition in REPL server test. Fixes . Reported by Rob Browning . * test-suite/tests/00-repl-server.test ("simple expression"): Add call to 'select' before 'display'. 2017-03-01 Ludovic Courtès tests: Throw 'unresolved when the REPL server is too slow. * test-suite/tests/00-repl-server.test (call-with-repl-server): Use (usleep 100) instead of (sleep 1). Throw 'unresolved when TRIES is too high. 2017-03-01 Ludovic Courtès tests: Add REPL server test for CVE-2016-8606. This is a followup to 08c021916dbd3a235a9f9cc33df4c418c0724e03. * test-suite/tests/00-repl-server.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it. 2017-03-01 Mark H Weaver Ludovic Courtès REPL Server: Guard against HTTP inter-protocol exploitation attacks. Reported by Christopher Allan Webber This commit adds protection to Guile's REPL servers against HTTP inter-protocol exploitation attacks, a scenario whereby an attacker can, via an HTML page, cause a web browser to send data to TCP servers listening on a loopback interface or private network. See and , The HTML Form Protocol Attack (2001) by Tochen Topf . Here we add a procedure to 'before-read-hook' that looks for a possible HTTP request-line in the first line of input from the client socket. If present, the socket is drained and closed, and a loud warning is written to stderr (POSIX file descriptor 2). * module/system/repl/server.scm: Add 'maybe-check-for-http-request' to 'before-read-hook' when this module is loaded. (with-temporary-port-encoding, with-saved-port-line+column) (drain-input-and-close, permissive-http-request-line?) (check-for-http-request, guard-against-http-request) (maybe-check-for-http-request): New procedures. (serve-client): Use 'guard-against-http-request'. * module/system/repl/coop-server.scm (start-repl-client): Use 'guard-against-http-request'. * doc/ref/guile-invoke.texi (Command-line Options): In the description of the --listen option, make the security warning more prominent. Mention the new protection added here. Recommend using UNIX domain sockets for REPL servers. "a path to" => "the file name of". 2017-03-01 Ludovic Courtès tests: Use the "normalized codeset" in locale names. * test-suite/tests/i18n.test (%french-locale-name) (%french-utf8-locale-name, %turkish-utf8-locale-name) (%german-utf8-locale-name, %greek-utf8-locale-name): Use the normalized codeset for ISO-8859-1 and UTF-8. Treat 'SIG_IGN' as a pointer. * libguile/posix.c (scm_system_star): Cast 'SIG_IGN' to 'scm_t_uintptr_t' and use 'scm_from_uintptr_t'. This fixes an 'int-conversion' warning with GCC 6.2. Document 'scm_to_uintptr_t' and 'scm_from_uintptr_t'. * doc/ref/api-data.texi (Integers): Document them. 2017-03-01 Ludovic Courtès Remove 'umask' calls from 'mkdir'. Fixes . * libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is unbound; instead, use 0777 as the mode. Update docstring to clarify this. * doc/ref/posix.texi (File System): Adjust accordingly. * NEWS: Mention it. 2017-03-01 Andy Wingo %port-encoding requires an open port * libguile/ports.c (scm_sys_port_encoding) (scm_sys_set_port_encoding_x): Require an open port, to match 2.0 behavior. 2017-03-01 Mark H Weaver http: Do not use 'eq?' to compare characters in parse-request-uri. * module/web/http.scm (parse-request-uri): Use 'eqv?' to compare characters. 2017-03-01 Mark H Weaver build: .x and .doc files depend on generated includes. Fixes . * libguile/Makefile.am (BUILT_INCLUDES): New variable. (BUILT_SOURCES): Put generated .h to BUILT_INCLUDES. (DOT_X_FILES, EXTRA_DOT_X_FILES, DOT_DOC_FILES, EXTRA_DOT_DOC_FILES): Depend on $(BUILT_INCLUDES), in place of scmconfig.h which is included in $(BUILT_INCLUDES). 2017-03-01 Ludovic Courtès texinfo: Remove unnecessary (oop goops) dependency. * module/texinfo/string-utils.scm: Remove #:use-module (oop goops). 2017-03-01 Mark H Weaver Do not assume that sizeof (long) == sizeof (void *) == sizeof (SCM). This assumption does not hold on systems that use the LLP64 data model. Partially fixes . Reported by Peter TB Brett . * libguile/numbers.h (scm_t_inum): Move here from numbers.c, and change to be equivalent to 'long' (formerly 'scm_t_signed_bits'). (SCM_MOST_POSITIVE_FIXNUM, SCM_MOST_NEGATIVE_FIXNUM): Define based on SCM_I_FIXNUM_BIT instead of SCM_T_SIGNED_BITS_MAX. (SCM_I_INUM): Adjust definitions to return a 'scm_t_inum', and avoiding the assumption that SCM_UNPACK returns a 'long'. * libguile/numbers.c (scm_t_inum): Move definition to numbers.h. Verify that 'scm_t_inum' fits within a SCM value. (scm_i_inum2big): Remove preprocessor code that forced a compile error unless sizeof (long) == sizeof (void *). 2017-03-01 Mark H Weaver Avoid signed integer overflows in numeric conversions. Reported by Miroslav Lichvar in * libguile/conv-integer.i.c: Avoid signed overflow. * libguile/numbers.c (scm_is_signed_integer): Avoid signed overflow. 2017-03-01 Andy Wingo Remove extraneous debugging output in test * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (missing_value_error_handler): Remove debugging write. Fix open-file mode misinterpretation * libguile/fports.c (scm_i_mode_to_open_flags): Validate that argument is string. Fixes #25498. "select" no longer throws exception on EINTR * doc/ref/posix.texi (Ports and File Descriptors): Update. * libguile/filesys.c (scm_select): Use scm_std_select so that pending interrupts can be delivered. On EINTR or EAGAIN, just return directly so that calling Scheme code can run asyncs. scm_std_select doesn't tick itself * libguile/threads.c (scm_std_select): If there are unblocked asyncs pending, return directly instead of ticking ourselves. Cosmetic REPL server improvements * module/system/repl/server.scm (run-server*): Cosmetic improvements. Fix trap frame matching * module/system/vm/traps.scm (program-last-ip): Actually return an absolute IP. Fixes traps! Fix class slot allocation since GOOPS rewrite * module/oop/goops.scm (%compute-layout): Fix class slot layout. Before, a #:class that was an argument to #:allocation was getting interpreted as a keyword with a value. * test-suite/tests/goops.test ("#:class slot allocation"): Add test. Fix (mkstemp! "XX" 0) errors * libguile/filesys.c (scm_i_mkstemp): Validate "mode" argument as a string, and validate writability of template string early too. Thanks to Jean Louis for the bug report. Flush when getting string from r6rs string output port * module/rnrs/io/ports.scm (open-string-output-port): Calling the get-string proc should flush the buffer and reset the file position. * test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Add tests. Thanks to Freja Nordsiek for the report. String ports can be truncated * libguile/strports.c (string_port_truncate): (scm_make_string_port_type): Support truncate-file on string ports. * test-suite/tests/ports.test ("string ports"): Add tests. Minor expansion of guile-test comments * test-suite/guile-test: Add -L to example. 2017-03-01 Wilfred Hughes Favor docstrings for describing the purpose of functions. * module/ice-9/boot-9.scm: Where functions have docstring-style comments, make them proper docstrings. 2017-03-01 Andy Wingo Fix "Scheme Syntax" info rendering * doc/ref/api-evaluation.texi (Expression Syntax): Fix quote and quasiquote so that they actually look different in Info. 2017-02-28 Andy Wingo Better errors for odd-length keyword args * libguile/vm-engine.c (bind-kwargs): * libguile/vm.c (vm_error_kwargs_missing_value): * libguile/eval.c (error_missing_value) (prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior. * libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise. * module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw) with a "Keyword argument has no value" instead of the horrible "odd argument list length". Also adapts to the expected args format for the keyword-argument-error exception printer in all cases. Matches 1.8 optargs behavior also. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value): (missing_value_error_handler): Update test. * test-suite/tests/optargs.test: Add tests. Fix segfault introduced with R6RS port commit * libguile/init.c (scm_i_init_guile): Move scm_register_r6rs_ports later, so that defining port types hsa the SCM trampoline subrs defined. * libguile/bytevectors.c (scm_bootstrap_bytevectors): Cosmetic changes. "Scripting Examples" update. * doc/ref/scheme-scripts.texi (Scripting Examples): Mention system* and open-pipe. Register R6RS port and bytevector internals early * libguile/bytevectors.c (sym_big, sym_little): Rename from scm_sym_big and scm_sym_little, and don't use the snarf mechanism as we need to initialize this value eagerly in case the C API is used before the Scheme module is loaded. (scm_bootstrap_bytevectors): Initialize the endianness symbols here. * libguile/r6rs-ports.c (scm_register_r6rs_ports): Register the R6RS port kinds here, for the same reason. 2017-02-28 Andy Wingo Fix support for threads already known to GC * libguile/threads.h (scm_i_thread): Add bool tracking whether the thread needs to be unregistered from libgc. * libguile/threads.c (guilify_self_1): Add needs_unregister arg. (on_thread_exit): Only unregister thread if the thread needs it. (scm_i_init_thread_for_guile): A thread needs unregistering if GC_register_my_thread succeeded. (scm_threads_prehistory): Don't unregister initial thread. Fixes #19523. Thanks to Anthonin Bonnefoy for the report. 2017-02-28 Andy Wingo Declare module exports before loading imports * module/ice-9/boot-9.scm (define-module*): Process module imports after module exports. Allows for an additional kind of circular module imports (see https://bugs.gnu.org/15540). * test-suite/tests/modules.test ("circular imports"): Add test. Revert "futures: Limit the number of nested futures on the same stack." This reverts commit 8a177d316c0062afe74f9a761ef460e297435e59, though keeping the additional tests. (Guile 2.2 doesn't have a fixed stack limit). Fix (* x -1) for GOOPS types * libguile/numbers.c (scm_product): Only reduce (* x -1) to (- x) when X is a bignum. Fixes weirdness when X is not a number and instead multiplication should dispatch to GOOPS. Thanks to Alejandro Sanchez for the report. 2017-02-27 Diogo F. S. Ramos Explain why no native accessors for `s8' and `u8' exist * doc/ref/api-data.texi: Instead of saying it is obvious, explain why no native endianness accessors exist for the `s8' and `u8' variants. 2017-02-23 Andy Wingo Fix guild compile --to=cps / --from=cps * module/language/cps/spec.scm (read-cps, write-cps): Fix CPS serialization and parsing, so that "guild compile" works with --to=cps and --from=cps. Fix kfun parse-cps bug * module/language/cps.scm (parse-cps): Fix bug parsing kfun. 2017-02-23 Freja Nordsiek Fixed specific version of guile search in autoconf macro GUILE_PROGS. * meta/guile.m4 (GUILE_PROGS): Search for guile with suffixes first ('-X.Y' and 'X.Y' where X.Y denotes the version) before searching for guile with no suffix. Patch co-authored by Andy Wingo. 2017-02-23 Andy Wingo Fix typo in old NEWS. * NEWS: Fix typo. 2017-02-22 Andy Wingo Fix multi-arity dispatch in GOOPS * module/oop/goops.scm (multiple-arity-dispatcher): Fix dispatch for max-arity+1 when a generic is already in multiple-arity dispatch. Fixes #24454. * test-suite/tests/goops.test ("dispatch"): Add test. Fix compute-frame-sizes for case-lambda jumps * module/system/vm/frame.scm (compute-frame-sizes): Fix for jumps to the next arity. 2017-02-21 Andy Wingo Use labs instead of abs where needed * libguile/numbers.c (log_of_fraction): Use labs instead of abs on longs. Thanks to Matt Wette for the tip. 2017-02-21 Matt Wette Fix make-polar signedness of zeros on macOS * configure.ac: Check for __sincos. * libguile/numbers.c (scm_c_make_polar): Fall back to __sincos if possible. Fixes zero signedness of make-polar on macOS. 2017-02-21 Andy Wingo Conditionally define SOCK_CLOEXEC, SOCK_NONBLOCK * libguile/socket.c (scm_init_socket): Conditionally define SOCK_CLOEXEC and SOCK_NONBLOCK. Fixes compilation on macOS. 2017-02-19 Andy Wingo Fix flonum/complex type inference. * module/language/cps/types.scm (define-binary-result!): Arithmetic where one argument is a flonum may produce a complex. * test-suite/tests/compiler.test: Add test. 2017-02-18 Andy Wingo Guile 2.1.7. * GUILE-VERSION: Bump to 2.1.7. Update NEWS for 2.1.7. * NEWS: Update. Fold 2.1.6 NEWS changes * NEWS: Fold 2.1.6 changes into main 2.2 NEWS. 2017-02-17 Andy Wingo Speed up number->string * libguile/numbers.c (scm_number_to_string): Use scm_from_latin1_string where appropriate. Avoids mucking about with iconv. Minor make-string optimization * libguile/strings.c (STRINGBUF_SET_MUTABLE): New helper. (scm_i_string_ensure_mutable_x): Use new helper. (scm_make_string): Mark stringbuf as mutable. Bump fluid cache size to 16 entries * libguile/cache-internal.h (SCM_CACHE_SIZE): Bump to 16. It seems that a thread accesses more than 8 fluids by default (%stacks, the exception handler, current ports, current-fiber, port read/write waiters) which leads every fiber to cause cache eviction and copying the value table, which is a bottleneck. Instead just bump this cache size. (scm_cache_lookup): Update unrolled search. Revert "Cheaper fluid-ref cache" This reverts commit cd3ff33a31c51612f2247bdb15ecbe92d7da1310. 2017-02-16 Andy Wingo Stringbufs immutable by default * libguile/snarf.h (SCM_IMMUTABLE_STRINGBUF): Remove shared flag. Stringbufs are immutable by default. * libguile/strings.c: Rewrite blurb. Change to have stringbufs be immutable by default and mutable only when marked as such. Going mutable means making a private copy. (STRINGBUF_MUTABLE, STRINGBUF_F_MUTABLE): New definitions. (SET_STRINGBUF_SHARED): Remove. (scm_i_print_stringbuf): Simplify to just alias the stringbuf as-is. (substring_with_immutable_stringbuf): New helper. (scm_i_substring, scm_i_substring_read_only, scm_i_substring_copy): use new helper. (scm_i_string_ensure_mutable_x): New helper. (scm_i_substring_shared): Use scm_i_string_ensure_mutable_x. (stringbuf_write_mutex): Remove; yaaaaaaaay. (scm_i_string_start_writing): Use scm_i_string_ensure_mutable_x. No more mutex. (scm_i_string_stop_writing): Now a no-op. (scm_i_make_symbol): Use substring/copy. (scm_sys_string_dump, scm_sys_symbol_dump): Update. * libguile/strings.h (SCM_I_STRINGBUF_F_SHARED): Remove. (SCM_I_STRINGBUF_F_MUTABLE): Add. * module/system/vm/assembler.scm (link-data): Don't add shared flag any more. Existing compiled flags are harmless tho. * test-suite/tests/strings.test ("string internals"): Update. Remove unnecessary scm_i_string_start_writing calls * libguile/strings.c (scm_string, scm_c_make_string): * libguile/srfi-13.c (scm_reverse_list_to_string, scm_string_map) (scm_string_unfold, scm_string_unfold_right, scm_xsubstring) (scm_string_filter, scm_string_delete): Remove scm_i_string_start_writing / scm_i_string_stop_writing calls around fresh strings that aren't visible to other threads. Cheaper fluid-ref cache * libguile/cache-internal.h (struct scm_cache_entry): Add needs_flush member. (scm_cache_evict_1): Clear needs_flush on newly evicted entry. (scm_cache_insert): Propagate needs_flush to new entry. * libguile/fluids.c (restore_dynamic_state): Mark all restored entries as needing a flush. (save_dynamic_state): Only cons on "needs_flush" entries to the resulting dynamic state. The result is the same as before but avoiding the refq on the weak table. (fluid_set_x): Propagate needs_flush down to the cache. (fluid_ref): When adding entry to cache, use needs_flush==0. (scm_fluid_set_x, scm_fluid_unset_x, scm_swap_fluid, swap_fluid): Use needs_flush==1. 2017-02-15 Andy Wingo Fix accept4 gnulib update. * m4/accept4.m4: Add missing file. * lib/accept4.c: Add missing file. * .gitignore: Update. Add accept4 support * doc/ref/posix.texi (Network Sockets and Communication): Add documentation. * libguile/socket.c (scm_accept4): New function, replaces accept implementation. (scm_accept): Call scm_accept4. (scm_init_socket): Define SOCK_CLOEXEC and SOCK_NONBLOCK. * libguile/socket.h: Add private scm_accept4 decl. * module/ice-9/suspendable-ports.scm (accept): Update. Switch to accept4 * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Switch from accept gnulib module to accept4. * libguile/socket.c (scm_accept): Use accept4. Update Gnulib to v0.1-1157-gb03f418. 2017-02-14 Andy Wingo Elide syscalls in fdes->port * libguile/fports.h (scm_t_fport): Add options field. (SCM_FDES_RANDOM_P): Deprecate. (scm_i_fdes_to_port): Add options argument. * libguile/fports.c (scm_i_fdes_to_port): Add options argument. Only verify FD if SCM_FPORT_OPTION_VERIFY is there. (scm_fdes_to_port, scm_open_file_with_encoding): Adapt to scm_i_fdes_to_port changes. (fport_random_access_p): Don't try to seek if NOT_SEEKABLE option is set. * libguile/deprecated.h: * libguile/deprecated.c (SCM_FDES_RANDOM_P): Deprecate. * NEWS: Add deprecation. * libguile/filesys.c: * libguile/ioext.c: * libguile/posix.c: * libguile/read.c: * libguile/socket.c: Adapt callers. 2017-02-13 Andy Wingo Fix compilation of continuations.c * libguile/continuations.c (scm_i_continuation_to_frame): Remove unused assignment. The previous commit removed the declaration in order to silence an unused-assignment warning, but forgot to remove the assignment :/ 2017-02-12 Andy Wingo Remove unused variable in continuations.c * libguile/continuations.c (scm_i_continuation_to_frame): Remove unused variable. VM continuations store FP/SP by offset * libguile/continuations.c (scm_i_continuation_to_frame): * libguile/stacks.c (scm_make_stack): * libguile/vm.c (scm_i_vm_cont_to_frame, scm_i_vm_capture_stack): (vm_return_to_continuation_inner) (struct vm_reinstate_partial_continuation_data): (vm_reinstate_partial_continuation_inner): (vm_reinstate_partial_continuation): * libguile/vm.h (sstruct scm_vm_cont): Simplify VM continuations by recording the top FP by offset, not value + reloc. * libguile/frames.c (frame_offset, scm_i_vm_frame_offset): Remove unused functions. * libguile/frames.h (SCM_VALIDATE_VM_FRAME, scm_i_vm_frame_offset): Remove. * libguile/control.c (reify_partial_continuation): Once we know the base_fp, relocate the dynamic stack. * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_relocate_prompts): New function. (scm_dynstack_wind_prompt): Adapt to add new fp offset. Avoid reading garbage from dynstack * libguile/dynstack.c (push_dynstack_entry_unchecked): Reset top dynstack tag to prevent garbage. 2017-02-08 Andy Wingo Web server and client use suspendable ports * module/web/request.scm (write-request): * module/web/response.scm (write-response): Use put-string instead of display. Prevent TOCTTOU bugs in C ports * libguile/ports-internal.h (scm_port_buffer_can_take): (scm_port_buffer_can_put): Add cur/end output arguments so that when a caller asks the buffer room, it can be relative to a fixed point in the buffer and not whatever point it's at when we go to fill it. (scm_port_buffer_did_take, scm_port_buffer_did_put): Similarly, require that the caller knows where they took/put data in the buffer. Prevents overflow. (scm_port_buffer_take_pointer, scm_port_buffer_put_pointer): Likewise, require that the caller has already checked and knows a position in the buffer and therefore how much data is available. (scm_port_buffer_take, scm_port_buffer_put, scm_port_buffer_putback): Adapt. * libguile/ports.h (scm_fill_input): Add cur/avail output arguments. * libguile/filesys.c: * libguile/poll.c: * libguile/ports.c: * libguile/r6rs-ports.c: * libguile/read.c: * libguile/rw.c: Adapt all callers. Gnarly work! Prevent TOCTTOU bugs in suspendable ports * module/ice-9/suspendable-ports.scm: Prevent TOCTTOU bugs by additionally returning the buffer and offset when we compute an amount-buffered. Remove remaining "display" uses in (web http) * module/web/http.scm (header-writer): Default to calling put-string. (put-list): Rename from write-list, take the port first, and call the put-item function with port then value. Adapt all callers. (write-date): Rename display-digits to put-digits. (put-challenge): Rename from write-challenge, adapt arguments to put convention, and adapt callers. (declare-symbol-list-header!): Use put-symbol. (declare-integer-header!): Use put-non-negative-integer.o (declare-entity-tag-list-header!): Use put-entity-tag-list. ("If-Range", "Etag"): Adapt to put-entity-tag. (make-chunked-output-port): Use put-char. Beginnings of suspendable HTTP * module/web/http.scm: Use put-string and other routines from (ice-9 textual-ports) in preference to `display'. The goal is for these operations to be suspendable. Modernize (web http) a bit * module/web/http.scm: Modernize the Guile Scheme by using more match, when, unless, and non-tail conversion. No functional change, with the exception of fixing a bug in write-key-value-list for symbols like 100-continue that shouldn't print as #{100-continue}#. * test-suite/tests/web-http.test (pass-if-only-parse): (pass-if-reparse, pass-if-parse): Arrange to also serialize and reparse values from pass-if-parse. Apply to all existing tests except fragments where we don't expect fragments to be written out. 2017-02-07 Daniel Llorens Fix rank 0 arrays and nested arrays in truncated-print * module/ice-9/pretty-print.scm (print): In the array case, pass #:inner? along to (print-sequence), unless we're at the last dimension of the array. Special case for 0-rank arrays, which cannot be empty and have no length. * test-suite/tests/print.test: Test some of the cases fixed by this patch. Support arrays in truncated-print * module/ice-9/pretty-print.scm (print): Handle general arrays. * test-suite/tests/print.test: Test truncated-print with general arrays. Fix bug #25492 * libguile/vm-engine.c (BR_F64_ARITHMETIC): Fix type. 2017-02-07 Andy Wingo Avoid stacks in dynamically-bound values * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_find_old_fluid_value): New function. * libguile/fluids.c (saved_dynamic_state_ref): New helper. (scm_fluid_ref): Fix docstring. (scm_fluid_ref_star): New function allowing access to previous values for a fluid. (scm_dynamic_state_ref): New internal function. * libguile/fluids.h: Add scm_fluid_ref_star and scm_dynamic_state_ref. * libguile/stacks.c (scm_stack_id): Adapt to %stacks not being a chain. * libguile/throw.c (catch, throw_without_pre_unwind): Adapt to %exception-handlers not being a chain. * module/ice-9/boot-9.scm (catch, dispatch-exception): Instead of having %exception-handlers be a chain, use fluid-ref* to access the chain that is in place at the time the exception is thrown. Prevents unintended undelimited capture of the current exception handler stack by a delimited "catch". (%start-stack): Similarly, don't be a chain. * module/system/repl/debug.scm (frame->stack-vector): * module/system/repl/error-handling.scm (call-with-error-handling): * module/ice-9/save-stack.scm (save-stack): Adapt to %stacks not being a chain. * test-suite/tests/exceptions.test ("delimited exception handlers"): Add tests. * doc/ref/api-control.texi (Fluids and Dynamic States): Add docs. 2017-01-19 Andy Wingo Guile 2.1.6. * GUILE-VERSION (GUILE_MICRO_VERSION): Bump to 2.1.6. Update NEWS. * NEWS: Update. Fix build warning * libguile/stime.c (scm_init_stime): Remove unused variable. 2017-01-12 David Thompson Add unboxed floating point comparison instructions. * libguile/vm-engine.c (BR_F64_ARITHMETIC): New preprocessor macro. (br_if_f64_ee, br_if_f64_lt, br_if_f64_le, br_if_f64_gt, br_if_f64_ge): New VM instructions. * doc/ref/vm.texi ("Unboxed Floating-Point Arithmetic"): Document them. * module/language/cps/compile-bytecode.scm (compile-function): Emit f64 comparison instructions. * module/language/cps/effects-analysis.scm: Define effects for f64 primcalls. * module/language/cps/primitives.scm (*branching-primcall-arities*): Add arities for f64 primcalls. * module/language/cps/specialize-numbers.scm (specialize-f64-comparison): New procedure. (specialize-operations): Specialize f64 comparisons. * module/system/vm/assembler.scm (emit-br-if-f64-=, emit-br-if-f64-<) (emit-br-if-f64-<=, emit-br-if-f64->, emit-br-if-f64->=): Export. * module/system/vm/disassembler.scm (code-annotation): Add annotations for f64 comparison instructions. 2017-01-11 Andy Wingo Protect call-with-new-thread data from GC. * libguile/threads.c (struct launch_data): Add prev/next pointers. (protected_launch_data, protected_launch_data_lock): New static vars. (protect_launch_data, unprotect_launch_data): New functions. (really_launch, scm_sys_call_with_new_thread): Preserve launch data from GC. Thanks to Linas Vepstas for the report! 2017-01-09 Daniel Llorens Final names for new array functions Globally rename (array-from* -> array-slice), (array-from -> array-cell-ref), (array-amend! -> array-cell-set!), (array-for-each-cell -> array-slice-for-each). 2017-01-08 Andy Wingo Fix scm_init_stime for macOS * libguile/stime.c (scm_init_stime): Remove needless test of clock_getcpuclockid. Fixes build on macOS; thanks to Matt Wette for the report and fix. Fix alloc_aligned for high allocations * libguile/loader.c (alloc_aligned): Widen alignment. Thanks to Matt Wette for the report and the fix! Speed up load-thunk-from-memory for page alignment * libguile/loader.c (page_size): New static var. (alloc_aligned): Enable mmap path that was never used in the past (!). Thanks to Matt Wette for the bug report! (load_thunk_from_memory): Use page_size instead of 4096. (scm_bootstrap_loader): Init page_size. Fix mkstemp on macOS * libguile/filesys.c (scm_i_mkstemp): Limit flags to mkostemp. Based on a patch by Matt Wette; thanks! Fix close-port race. * libguile/ports.c (release_port): Fix race. Exited threads retain less memory * libguile/threads.c (on_thread_exit): Lessen excess retention. Prevent some interrupts of wait-condition-variable * libguile/threads.c (timed_wait): Disable interrupts while reacquiring mutex after wait-condition-variable. Enable interrupts only when running thread body * libguile/threads.c (really_launch): Start threads with asyncs blocked. * module/ice-9/threads.scm (call-with-new-thread): Unblock asyncs once we have the bookkeeping sorted out. Don't use with-continuation-barrier; it's not needed. Print nice thread backtraces. Remove thread-specific admin mutex * libguile/threads.c (guilify_self_1): * libguile/threads.h (scm_i_thread): Remove unused thread "admin mutex". Remove thread-exited? check in sigaction * libguile/scmsigs.c (scm_sigaction_for_thread): Remove check that thread hadn't exited. This check was racy as it's always possible that the other thread exits between checking it or even after the signal handler is installed. Thread prepare-to-wait respects block_asyncs * libguile/async.c (scm_i_prepare_to_wait): Don't signal interrupt if asyncs are blocked. 2016-12-29 Andy Wingo New interfaces to help wait on fd/cond * libguile/async.h: * libguile/async.c (struct scm_thread_wake_data): Include the cond to signal. Be a union and include a tag. (scm_i_prepare_to_wait): Rename from scm_i_setup_sleep and take wake data directly. Also call scm_i_wait_finished as appropriate. (scm_i_wait_finished): Rename from scm_i_reset_sleep. (scm_i_prepare_to_wait_on_fd, scm_c_prepare_to_wait_on_fd): (scm_i_prepare_to_wait_on_cond, scm_c_prepare_to_wait_on_cond): New functions. (scm_c_wait_finished): New function. (scm_system_async_mark_for_thread): Adapt to wake data change. * libguile/threads.c (block_self, scm_std_select): Adapt to async interface changes. * doc/ref/api-scheduling.texi (Asyncs): Doc new public interfaces. 2016-12-18 Andy Wingo Improve handle-interrupts placement * module/language/cps/handle-interrupts.scm (compute-safepoints): New function. (add-handle-interrupts): Add safepoints at backedge targets, not backedges. Gives better register allocation, loop rotation, and code size. 2016-12-18 Mark H Weaver FFI: Add support for functions that set 'errno'. Implements wishlist item . Requested by Frank Terbeck . Based on a proposed patch by Nala Ginrut . Patch ported to 2.2 by Andy Wingo . * libguile/foreign.c (cif_to_procedure): Add 'with_errno' argument. If true, truncate result to only one return value. (scm_i_foreign_call): Separate the arguments. Always return errno. (pointer_to_procedure): New static function. (scm_pointer_to_procedure_with_errno): New C API function, implemented in terms of 'pointer_to_procedure'. (scm_pointer_to_procedure): Reimplement in terms of 'pointer_to_procedure', no longer bound to "pointer->procedure". See below. (scm_i_pointer_to_procedure): New C function bound to "pointer->procedure" which now accepts the optional #:return-errno? keyword argument, implemented in terms of 'pointer_to_procedure'. (k_return_errno): New keyword #:return-errno?. * libguile/foreign.h (scm_pointer_to_procedure_with_errno): Add prototype. * doc/ref/api-foreign.texi (Dynamic FFI): Adjust documentation. * libguile/vm-engine.c (foreign-call): Return two values. 2016-12-15 Daniel Llorens Test format ~f with width parameters * test-suite/tests/format.test: Additional tests for ~f. 2016-12-14 Andy Wingo Fix bug in compute-significant-bits for phi predecessors * module/language/cps/specialize-numbers.scm (compute-significant-bits): Always revisit predecessors after first visit. Avoids situation where predecessor of an unvisited phi var could default to 0 significant bits and never be revisited. Fixes (format #f "~2f" 9.9). 2016-12-14 Daniel Llorens Make scm_gc_warn_proc() write directly to stderr This avoids a deadlock due to the lookup of cur_warnport_fluid while an allocation is ongoing. * libguile/gc.c (scm_gc_warn_proc): Write the warning directly to stderr. 2016-12-12 Andy Wingo Add suspendable-continuation? * doc/ref/api-control.texi (Prompt Primitives): Document suspendable-continuation?. * libguile/control.c (scm_suspendable_continuation_p): New procedure. (scm_init_ice_9_control): New extension procedure, defines suspendable-continuation?. (scm_init_control): Register scm_init_ice_9_control. * libguile/eval.c (eval): * libguile/throw.c (catch): * libguile/continuations.c (scm_i_make_continuation): Restore resumable prompt cookie after continuation invocation. * libguile/vm.c (scm_call_n): Arrange to set resumable_prompt_cookie during invocation of VM. * libguile/vm.h (struct scm_vm): Add resumable_prompt_cookie member. * module/ice-9/control.scm: Export suspendable-continuation?. * test-suite/tests/control.test ("suspendable-continuation?"): New test. 2016-12-07 Andy Wingo Bump version to 2.1.5. * GUILE-VERSION (GUILE_MICRO_VERSION): Bump. Fix --without-threads * libguile/dynl.c: * libguile/gc.c: * libguile/keywords.c: * libguile/scmsigs.c: * libguile/stime.c: Use scm_i_dynamic_link instead of scm_dynamic_link so that things compile in without-threads configurations. 2016-12-06 Andy Wingo Refine check for when atomics are available. * configure.ac: * libguile/atomics-internal.h: Use HAVE_STDATOMIC_H to know when to use atomics. Use readdir instead of readdir_r * libguile/filesys.c: * configure.ac: Remove readdir_r / readdir64_r checks and usage. glibc's impls are thread-safe, the _r variants are squirrely and now deprecated in glibc, and it is expected that POSIX will mandate that readdir{,64} be thread-safe already. See https://sourceware.org/ml/libc-alpha/2016-02/msg00093.html. Update NEWS. * NEWS: Update. Add thread-local variables manual section. * doc/ref/api-scheduling.texi (Thread Local Variables): New subsection. Minor parameters doc change * doc/ref/api-control.texi (Parameters): Make the opening a bit less abrupt. Update fluids / dynstate docs * doc/ref/api-control.texi (Fluids and Dynamic States): Update documentation. Move fluids, parameters docs nearer to dynamic-wind * doc/ref/api-control.texi: * doc/ref/api-scheduling.texi: Move fluids and parameters docs. 2016-12-06 Christopher Allan Webber Fix small typo in suspendable-ports documentation. * doc/ref/api-io.texi (Non-Blocking I/O): Fix example to call use-modules rather than use-module. 2016-12-05 Andy Wingo with-dynamic-state compiler and VM support * libguile/dynstack.h (SCM_DYNSTACK_TYPE_DYNAMIC_STATE): * libguile/dynstack.c (DYNAMIC_STATE_WORDS, DYNAMIC_STATE_STATE_BOX): (scm_dynstack_push_dynamic_state): (scm_dynstack_unwind_dynamic_state): New definitions. (scm_dynstack_unwind_1, scm_dynstack_wind_1): Add with-dynamic-state cases. * libguile/memoize.c (push_dynamic_state, pop_dynamic_state) (do_push_dynamic_state, do_pop_dynamic_state): New definitions. (memoize, scm_init_memoize): Handle push-dynamic-state and pop-dynamic-state. * libguile/vm-engine.c (push-dynamic-state, pop-dynamic-state): New opcodes. * module/ice-9/boot-9.scm (with-dynamic-state): New definition in Scheme so that the push-dynamic-state and pop-dynamic-state always run in the VM. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/types.scm: * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): * module/system/vm/assembler.scm: Add support for with-dynamic-state to the compiler. * test-suite/tests/fluids.test ("dynamic states"): Add basic tests. * doc/ref/vm.texi (Dynamic Environment Instructions): Update. 2016-12-05 Andy Wingo Reimplement dynamic states There are two goals: one, to use less memory per dynamic state in order to allow millions of dynamic states to be allocated in light-weight threading scenarios. The second goal is to prevent dynamic states from being actively mutated in two threads at once. This second goal does mean that dynamic states object that escape into scheme are now copies that won't receive further updates; an incompatible change, but one which we hope doesn't affect anyone. * libguile/cache-internal.h: New file. * libguile/fluids.c (is_dynamic_state, get_dynamic_state) (save_dynamic_state, restore_dynamic_state, add_entry) (copy_value_table): New functions. (scm_i_fluid_print, scm_i_dynamic_state_print): Move up. (new_fluid): No need for a number. (scm_fluid_p: scm_is_fluid): Inline IS_FLUID uses. (fluid_set_x, fluid_ref): Adapt to dynamic state changes. (scm_fluid_set_x, scm_fluid_unset_x): Call fluid_set_x. (scm_swap_fluid): Rewrite in terms of fluid_ref and fluid_set. (swap_fluid): Use internal fluid_set_x. (scm_i_make_initial_dynamic_state): Adapt to dynamic state representation change. (scm_dynamic_state_p, scm_is_dynamic_state): Use new accessors. (scm_current_dynamic_state): Use make_dynamic_state. (scm_dynwind_current_dynamic_state): Use new accessor. * libguile/fluids.h: Remove internal definitions. Add new struct definition. * libguile/threads.h (scm_i_thread): Use scm_t_dynamic_state for dynamic state. * libguile/threads.c (guilify_self_1, guilify_self_2): (scm_i_init_thread_for_guile, scm_init_guile): (scm_call_with_new_thread): (scm_init_threads, scm_init_threads_default_dynamic_state): Adapt to scm_i_thread change. (scm_i_with_guile, with_guile): Remove "and parent" suffix. (scm_i_reset_fluid): Remove unneeded function. * doc/ref/api-scheduling.texi (Fluids and Dynamic States): Remove scm_make_dynamic_state docs. Update current-dynamic-state docs. * libguile/vm-engine.c (vm_engine): Update fluid-ref and fluid-set! inlined fast paths for dynamic state changes. * libguile/vm.c (vm_error_unbound_fluid): Remove now-unused function. * NEWS: Update. * module/ice-9/deprecated.scm (make-dynamic-state): New definition. * libguile/deprecated.h: * libguile/deprecated.c (scm_make_dynamic_state): Move here. * libguile/__scm.h (scm_t_dynamic_state): New typedef. * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_push_fluid): (scm_dynstack_unwind_fluid): Take raw dynstate in these internal functions. * libguile/throw.c (catch): Adapt to dynstack changes. 2016-11-30 Andy Wingo Fix two wait-condition-variable race conditions * libguile/threads.c (timed_wait): When looping to reacquire mutex, check if mutex owner after dropping mutex to run asyncs when the reacquire is interrupted. Also for asyncs that interrupted the initial wait, just return #t directly, and allow the caller to loop. Fixes a deadlock in which a thread could have pending asyncs after dropping a mutex and which prevent it from going to wait on a cond, but then the broadcast comes while nobody is waiting and the mutex is dropped, then after reacquiring the mutex when we go to wait again, we wait forever. The correct thing to do is after reacquiring the mutex, to allow the application to check if waiting is appropriate. 2016-11-27 Andy Wingo Compile fluid-set! to VM opcode * libguile/vm-engine.c (fluid-set!): Fix name of opcode to correspond with name of Tree-IL primitive. Fixes compilation of fluid-set! to actually use the fluid-set! opcode. * doc/ref/vm.texi (Dynamic Environment Instructions): Update. * module/language/cps/compile-bytecode.scm (compile-function): Add fluid-set! case. * module/system/vm/assembler.scm: Update export name for emit-fluid-set!. Ensure autoconf doesn't downgrade us to C99 * configure.ac: Add -std=gnu11 if the compiler is GCC (or clang). This prevents AC_PROG_CC_C99 from downgrading us by adding -std=gnu99. Fixes regression whereby we were always using the fallback implementation of atomics. 2016-11-26 Andy Wingo Add weak-table fast path for update * libguile/weak-table.c (weak_table_put_x): If the key is the same and the table is weak-key, avoid re-setting disappearing links. Fix scm_weak_table_refq for undefined default * libguile/weak-table.c (scm_weak_table_refq): No need to default weak table result to #f; just use whatever was passed in. Remove special support for fluids in GDB interface * module/system/base/types.scm (inferior-fluid?, inferior-fluid-number) (): Remove. Fluids won't have numbers in the future. (cell->object): Adapt. * test-suite/tests/types.test ("opaque objects"): Update. 2016-11-23 Daniel Llorens Deprecate scm_from_contiguous_array scm_from_contiguous_array() was undocumented, unused within Guile, and can be replaced by make-array + array-copy! without requiring contiguity and without loss of performance. * libguile/arrays.c (scm_array_contents): Do not rely on SCM_I_ARRAY_CONTP. * test-suite/tests/arrays.test: Test array-contents with 0-rank array. * libguile/arrays.h: Declare scm_i_shap2ra(), SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG so that scm_from_contiguous_array() can keep using them. * libguile/deprecated.c (scm_from_contiguous_array): Move here from arrays.c. * libguile/deprecated.h (scm_from_contiguous_array): Deprecate. * NEWS: Add deprecation notice. 2016-11-23 Daniel Llorens Document new array functions, with provisional names * doc/ref/api-data.texi: New section 'Arrays as arrays of arrays'. Document array-from, array-from*, array-amend!, array-for-each-cell, array-for-each-cell-in-order. 2016-11-23 Daniel Llorens New functions (array-for-each-cell, array-for-each-cell-in-order) * libguile/array-map.c (scm_i_array_rebase, scm_array_for_each_cell): New functions. Export scm_array_for_each_cell() as (array-for-each-cell). (array-for-each-cell-in-order): Define additional export. * libguile/array-map.h (scm_i_array_rebase, scm_array_for_each_cell): Add prototypes. * test-suite/tests/array-map.test: Renamed from test-suite/tests/ramap.test, fix module name. Add tests for (array-for-each-cell). * test-suite/Makefile.am: Apply rename array-map.test -> ramap.test. 2016-11-23 Daniel Llorens New functions array-from, array-from*, array-amend! * libguile/arrays.h (scm_array_from, scm_array_from_s, scm_array_amend_x): New declarations. * libguile/arrays.c (scm_array_from, scm_array_from_s, scm_array_amend_x): New functions, export as array-from, array-from*, array-amend!. * test-suite/tests/arrays.test: Tests for array-from, array-from*, array-amend!. Replace with-test-prefix/c&e with with-test-prefix where the array read syntax isn't used. 2016-11-23 Daniel Llorens Do not use array handles in scm_vector * libguile/vectors.c (scm_vector): Use SCM_I_VECTOR_WELTS on new vector instead of generic scm_vector_elements; cf. scm_vector_copy(). (scm_vector_elements): Forward to scm_vector_writable_elements(). (scm_vector_writable_elements): Remove special error message for weak vector arg. * libguile/generalized-vectors.c (SCM_VALIDATE_VECTOR_WITH_HANDLE): Remove unused macro. * libguile/array-handle.c (scm_array_handle_elements): Forward to scm_array_handle_writable_elements(). 2016-11-23 Daniel Llorens Special case for array-map! with three arguments Benchmark: (define type #t) (define A (make-typed-array 's32 0 10000 1000)) (define B (make-typed-array 's32 0 10000 1000)) (define C (make-typed-array 's32 0 10000 1000)) before: scheme@(guile-user)> ,time (array-map! C + A B) ;; 0.792653s real time, 0.790970s run time. 0.000000s spent in GC. after: scheme@(guile-user)> ,time (array-map! C + A B) ;; 0.598513s real time, 0.597146s run time. 0.000000s spent in GC. * libguile/array-map.c (ramap): Add special case with 3 arguments. 2016-11-23 Daniel Llorens Speed up for multi-arg cases of scm_ramap functions This patch results in a 20%-40% speedup in the > 1 argument cases of the following microbenchmarks: (define A (make-shared-array #0(1) (const '()) #e1e7)) ; 1, 2, 3 arguments. (define a 0) ,time (array-for-each (lambda (b) (set! a (+ a b))) A) (define a 0) ,time (array-for-each (lambda (b c) (set! a (+ a b c))) A A) (define a 0) ,time (array-for-each (lambda (b c d) (set! a (+ a b c d))) A A A) (define A (make-shared-array (make-array 1) (const '()) #e1e7)) (define B (make-shared-array #0(1) (const '()) #e1e7)) ; 1, 2, 3 arguments. ,time (array-map! A + B) ,time (array-map! A + B B) ,time (array-map! A + B B B) * libguile/array-map.c (scm_ramap): Note on cproc arguments. (rafill): Assume that dst's lbnd is 0. (racp): Assume that src's lbnd is 0. (ramap): Assume that ra0's lbnd is 0. When there're more than two arguments, compute the array handles before the loop. Allocate the arg list once and reuse it in the loop. (rafe): Do as in ramap(), when there's more than one argument. (AREF, ASET): Remove. 2016-11-23 Daniel Llorens Support typed arrays in some sort functions * libguile/sort.c (sort!, sort, restricted-vector-sort!, sorted?): Support arrays of rank 1, whatever the type. * libguile/quicksort.i.c: Fix accessors to handle typed arrays. * test-suite/tests/sort.test: Test also with typed arrays. 2016-11-23 Daniel Llorens Remove deprecated array functions * libguile/array-map.c (scm_array_fill_int, scm_array_fill_int, scm_ra_eqp, scm_ra_lessp scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum, scm_ra_difference, scm_ra_product, scm_ra_divide, scm_array_identity): Remove deprecated functions. * libguile/array-map.h: Remove declaration of deprecated functions. * libguile/generalized-vectors.h, libguile/generalized-vectors.c (scm_is_generalized_vector, scm_c_generalized_vector_length, scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x): These functions were deprecated in 2.0.9. Remove. * doc/ref/api-compound.texi: Remove uniform-array-read!, uniform-array-write from the manual. These procedures where removed in fc7bd367ab4b5027a7f80686b1e229c62e43c90b (2011-05-12). 2016-11-23 Daniel Llorens Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle * libguile/bytevectors.h (SCM_BYTEVECTOR_TYPE_SIZE, SCM_BYTEVECTOR_TYPED_LENGTH): Moved from libguile/bytevectors.c. * libguile/array-handle.c (scm_array_get_handle): Reuse SCM_BYTEVECTOR_TYPED_LENGTH. 2016-11-23 Daniel Llorens Avoid unneeded internal use of array handles * libguile/arrays.c (scm_shared_array_root): Adopt uniform check order. (scm_shared_array_offset, scm_shared_array_increments): Use the array fields directly just as scm_shared_array_root does. (scm_c_array_rank): Moved from libguile/generalized-arrays.c. Don't use array handles, but follow the same type check sequence as the other array functions (shared-array-root, etc). (scm_array_rank): Moved from libguile/generalized-arrays.h. * libguile/arrays.h: Move prototypes here. * test-suite/tests/arrays.test: Tests for shared-array-offset, shared-array-increments. 2016-11-23 Daniel Llorens Fix compilation of rank 0 typed array literals * module/system/vm/assembler.scm (simple-uniform-vector?): array-length fails for rank 0 arrays; fix the shape condition. * test-suite/tests/arrays.test: Test reading of #0f64(x) in compilation context. 2016-11-22 Andy Wingo Merge api-{data,compound}.texi * doc/ref/api-compound.texi: Remove. * doc/ref/api-data.texi: Fold "Compound Data Types" and "Simple Data Types" into just "Data Types". The distinction didn't work. * doc/ref/guile.texi: * doc/ref/Makefile.am: * doc/ref/srfi-modules.texi: Adapt. Add NEWS item about mutexes * NEWS: Add entry. 2016-11-21 Andy Wingo Deprecate dynamic roots * libguile/root.h: * libguile/root.c: Remove these files. * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_cwdr, scm_call_with_dynamic_root) (scm_dynamic_root, scm_apply_with_dynamic_root): Deprecate. Remove all root.h usage, which was vestigial. * module/ice-9/serialize.scm: Use (current-thread) instead of (dynamic-root). 2016-11-21 Andy Wingo Update join-thread docs * doc/ref/api-scheduling.texi (Threads): Joining a foreign thread is an error. * NEWS: Update. 2016-11-19 Andy Wingo Add asyncs test * test-suite/tests/asyncs.test: New file. Inline interrupts * libguile/async.c: * libguile/async.h (scm_i_async_push, scm_i_async_pop): Make internally available. * libguile/vm-engine.c (vm_engine): Invoke interrupts inline. Add return-from-interrupt instruction. * libguile/vm.c (vm_handle_interrupt_code): New "builtin". 2016-11-18 Andy Wingo Refactor async handling to be FIFO * libguile/async.c (scm_i_async_push, scm_i_async_pop): New helpers. (scm_async_tick, scm_system_async_mark_for_thread): Use the new helpers. 2016-11-18 Andy Wingo Remove SCM_DEBUG_CELL_ACCESSES==1 Since the move to BDW-GC this option has not been useful. * libguile/__scm.h (SCM_DEBUG_CELL_ACCESSES): Remove default definition. * libguile/gc.h: Add comment about cells. (SCM_VALIDATE_CELL): Remove. I did a search on the internet and I found no external users. (SCM_CELL_WORD, SCM_CELL_OBJECT, SCM_SET_CELL_WORD) (SCM_SET_CELL_OBJECT, SCM_CELL_OBJECT_LOC): Remove SCM_VALIDATE_CELL uses. * libguile/gc.c (scm_debug_cell_accesses_p) (scm_expensive_debug_cell_accesses_p) (scm_debug_cells_gc_interval, scm_i_expensive_validation_check) (scm_assert_cell_valid): Remove bindings only available when SCM_DEBUG_CELL_ACCESSES was 1. * libguile/list.c (scm_list_n): Remove SCM_VALIDATE_CELL usage. 2016-11-17 Andy Wingo Explicit interrupt handling in VM * libguile/foreign.c (CODE, get_foreign_stub_code): Add explicit handle-interrupts and return-values calls, as foreign-call will fall through. * libguile/gsubr.c (A, B, C, AB, AC, BC, ABC, SUBR_STUB_CODE) (scm_i_primitive_call_ip): Same. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline into handle-interrupts. (RETURN_ONE_VALUE, RETURN_VALUE_LIST): Inline into callers, and fall through instead of returning. (BR_BINARY, BR_UNARY, BR_ARITHMETIC, BR_U64_ARITHMETIC): Remove conditional VM_HANDLE_INTERRUPTS, as the compiler already inserted the handle-interrupts calls if needed. (vm_engine): Remove VM_HANDLE_INTERRUPTS invocations except in the handle-interrupts instruction. 2016-11-16 Andy Wingo Add handle-interrupts inst and compiler pass * libguile/vm-engine.c (vm_engine): Remove initial VM_HANDLE_INTERRUPTS call; surely our caller already handled interrupts. Add handle-interrupts opcode. * am/bootstrap.am (SOURCES): * module/Makefile.am (SOURCES): Add handle-interrupts.scm. * module/system/vm/assembler.scm (system): * module/language/cps/compile-bytecode.scm (compile-function): (lower-cps): Add handle-interrupts support. * module/language/cps/handle-interrupts.scm: New file. 2016-11-14 Andy Wingo Slim thread cleanup * libguile/threads.c (on_thread_exit): Clean up the cleanup. We no longer need to re-enter Guile mode, and some of the comments were incorrect. join-thread in Scheme * module/ice-9/threads.scm (join-thread): Implement in Scheme. (call-with-new-thread): Arrange to record values in a weak table and signal the join cond. (with-mutex): Move up definition; call-with-new-thread needs it. (How was this working before?) * libguile/threads.c (guilify_self_1, guilify_self_2, do_thread_exit): Remove join queue management. * libguile/threads.c (scm_join_thread, scm_join_thread_timed): Call out to Scheme. (scm_init_ice_9_threads): Capture join-thread var. scm_spawn_thread uses call-with-new-thread * libguile/throw.h (scm_i_make_catch_body_closure) (scm_i_make_catch_handler_closure): Add scm_i_ prefix and make available for internal use. * libguile/throw.c: Adapt. * libguile/threads.c (scm_spawn_thread): Rewrite in terms of scm_call_with_new_thread. 2016-11-13 Andy Wingo Fix crasher in scm_system_async_mark_for_thread * libguile/async.c (scm_system_async_mark_for_thread): Only signal the cond if there is a wait mutex. More comments in threads.c * libguile/threads.c (struct scm_mutex): Better comments. Optimize lock-mutex * libguile/threads.c (lock_mutex, scm_timed_lock_mutex): As with unlock_mutex before, optimize by specializing to the mutex kind. Also, avoid lock thrashing after a return from block_self. Improve mutexes / condition variable implementation * libguile/threads.c (scm_timed_lock_mutex): Use "level" field only for recursive mutexes. (unlock_mutex, scm_unlock_mutex): Factor implementation back out of scm_unlock_mutex (doh?), but in such a way that can specialize against mutex type. (scm_mutex_level): Only look at level for recursive mutexes. (scm_mutex_locked_p): Look at owner field, not level field. (timed_wait, scm_timed_wait_condition_variable): Factor implementation out, as above with unlock-mutex. Specialize relocking of the Guile mutex. Refactor GC implications of thread sleep * libguile/async.c (struct scm_thread_wake_data): Move definition here. (scm_i_setup_sleep): Remove "sleep_object". Caller now responsible for scm_remember_upto_here_1 as appropriate. (scm_system_async_mark_for_thread): Remove scm_remember_upto_here_1 call. * libguile/async.h (scm_i_setup_sleep): Adapt prototype. * libguile/threads.h (struct scm_thread_wake_data): Remove definition. * libguile/threads.c (block_self): Remove sleep_object argument. (scm_join_thread_timed, scm_timed_lock_mutex) (scm_timed_wait_condition_variable, scm_std_select): Adapt. Unlocked mutexes don't have owners * libguile/threads.c (scm_unlock_mutex) (scm_timed_wait_condition_variable): Unlocked mutexes should never have owners. Put mutex kind in SMOB flags * libguile/threads.c (struct scm_mutex, SCM_MUTEX_KIND, scm_make_mutex) (scm_timed_lock_mutex, scm_unlock_mutex) (scm_timed_wait_condition_variable): Mutex kind in SMOB flags. Rename Guile's internal mutexes and condvars * libguile/threads.c: Rename fat_mutex to struct scm_mutex, and likewise for scm_cond. Internal threads refactor * libguile/threads.c: Inline "fat mutexes" and "fat conds" into their users. These are just Guile mutexes and Guile condition variables. 2016-11-07 Christopher Allan Webber doc: Adjust capitalization for "HTTPS" and "GnuTLS". * doc/ref/web.texi (open-socket-for-uri): Adjust capitalization. 2016-11-07 Christopher Allan Webber web: Add https support through gnutls. Since importing gnutls directly would result in a dependency cycle, we load gnutls lazily. This uses code originally written for Guix by Ludovic Courtès. * module/web/client.scm: (%http-receive-buffer-size) (gnutls-module, ensure-gnutls, gnutls-ref, tls-wrap): New variables. (open-socket-for-uri): Wrap in tls when uri scheme is https. * doc/ref/web.texi (open-socket-for-uri): Document gnutls usage. 2016-11-06 Andy Wingo Update NEWS. * NEWS: Update. Minor editing in api-scheduling.texi * doc/ref/api-scheduling.texi: Fix a couple editing mistakes. Update documentation on mutexes * doc/ref/api-scheduling.texi (Mutexes and Condition Variables): Update. 2016-11-05 Andy Wingo scm_timed_lock_mutex replaces scm_lock_mutex_timed * libguile/deprecated.h: * libguile/deprecated.c (scm_lock_mutex_timed): Deprecate. * libguile/threads.h: * libguile/threads.c (scm_timed_lock_mutex): New function. (scm_join_thread): Fix formatting. (scm_lock_mutex): Fix formatting and update to scm_timed_lock_mutex change. (scm_try_mutex): Update to scm_timed_lock_mutex. Update mutex documentation * doc/ref/api-scheduling.texi (Mutexes and Condition Variables): Add foreboding preface. Separate fat mutex unlock and wait operations * libguile/threads.c (fat_mutex_unlock, fat_mutex_wait): Separate wait from unlock. (scm_unlock_mutex, scm_timed_wait_condition_variable): Adapt. Back to simple unlock-mutex * libguile/threads.c (scm_unlock_mutex): Bind to unlock-mutex. * libguile/threads.h: Remove scm_unlock_mutex_timed. * libguile/deprecated.h: Add scm_unlock_mutex_timed. * libguile/deprecated.c (scm_unlock_mutex_timed): Deprecate. * test-suite/tests/threads.test: Update unlock-mutex tests to use wait-condition-variable if they would wait on a cond. Replace scm_make_mutex_with_flags * libguile/threads.c (enum fat_mutex_kind): New data type, replacing separate flags. (struct fat_mutex): Adapt. (make_fat_mutex): Fat mutexes can only be one of three kinds, not one of 4 kinds. (Recursive unowned mutexes are not a thing.) (scm_make_mutex): Adapt. (scm_make_mutex_with_kind): New function, replacing scm_make_mutex_with_flags. Still bound to make-mutex. (scm_make_recursive_mutex): Adapt. (fat_mutex_lock, fat_mutex_unlock): Adapt. * libguile/threads.h (scm_make_mutex_with_kind): New decl. * libguile/deprecated.h: * libguile/deprecated.c (scm_make_mutex_with_flags): Deprecate. Remove unchecked-unlock facility from Guile mutexes * libguile/threads.c (fat_mutex): Remove unchecked_unlock member. (make_fat_mutex): Adapt. (scm_make_mutex_with_flags): Remove unchecked-unlock flag. (scm_make_recursive_mutex): Likewise. (fat_mutex_unlock): Remove unchecked-unlock case. * test-suite/tests/threads.test: Remove unchecked-unlock test. Recursively locking a SRFI-18 mutex blocks * libguile/threads.c (fat_mutex_lock): allow-external-unlock mutexes can't be recursive, but a recursive lock attempt can be unblocked by an external thread, so these mutexes shouldn't throw an error on recursive lock attempts. * test-suite/tests/srfi-18.test: Add tests. SRFI-18 mutexes are not recursive * module/srfi/srfi-18.scm (make-mutex): Not recursive. Move more functionality to SRFI-18 mutex-unlock! * module/srfi/srfi-18.scm (mutex-unlock!): Implement the ignore-unlock-errors and wait-condition-variable behavior of mutex-unlock! directly, without relying on Guile. Remove fat mutex abandoned mutex error * libguile/threads.c (fat_mutex_lock): Remove abandoned mutex error, as SRFI-18 is responsible for this. * test-suite/tests/threads.test: Update test. Remove thread held pthread_mutex field * libguile/threads.h (scm_i_thread): * libguile/threads.c (guilify_self_1, on_thread_exit) (scm_pthread_cond_wait, scm_pthread_cond_timedwait): The thread-local held_mutex field is no longer needed, now that we cancel threads via interrupts instead of pthread_cancel. Remove thread-local weak mutex set * libguile/threads.h (scm_i_thread): * libguile/threads.c (guilify_self_1, do_thread_exit, fat_mutex_lock): Remove thread-local weak mutex set. SRFI-18 manages own mutex "abandoned" state * module/srfi/srfi-18.scm (, with-thread-mutex-cleanup) (make-mutex, mutex-state, abandon-mutex!, mutex-lock!): Manage "abandoned" bit on Scheme side with no need for thread cleanup handler. 2016-11-04 Andy Wingo Remove lock-mutex owner facility * libguile/threads.c (scm_lock_mutex_timed): Deprecate "owner" argument. (fat_mutex_lock): Remove owner argument. (fat_mutex_unlock): Don't pass owner to scm_lock_mutex_timed. * test-suite/tests/threads.test: Remove tests of mutex-owner. SRFI-18 threads disjoint from guile threads * doc/ref/srfi-modules.texi (SRFI-18 Threads): Update. * module/srfi/srfi-18.scm (): Add owner field. (): New data type. (make-thread): Adapt for boxed threads. (thread-start!, thread-terminate!): Likewise. (mutex-state): Adapt for boxed threads. (mutex-lock!, mutex-unlock!): Update owner field. Update SRFI-18 documentation. * doc/ref/srfi-modules.texi (SRFI-18): Update documentation for disjoint mutexes and cond variables. srfi-18 condition variables disjoint * module/srfi/srfi-18.scm (): New data type. (make-thread): Use srfi-18 interfaces. (mutex-unlock!): Adapt to optional cond argument being disjoint from Guile condition variables. (make-condition-variable, condition-variable-signal!) (condition-variable-broadcast!): Adapt. Remove export srfi-18 never had * module/srfi/srfi-18.scm (condition-variable-wait!): Remove undefined export. SRFI-18 mutexes disjoint from Guile mutexes * module/srfi/srfi-18.scm (): Define as a wrapper type around Guile mutexes. (thread-mutexes): New variable. (with-thread-mutex-cleanup): New facility to abandon mutexes on SRFI-18 thread exit. Not yet used. (make-thread): Use SRFI-18 interfaces. (make-mutex): Reimplement for our boxed mutexes. (mutex-state): Adapt. (mutex-lock!): Adapt. (mutex-unlock!): Adapt. * test-suite/tests/srfi-18.test: Don't assume that SRFI-18 mutexes are the same as Guile mutexes. 2016-11-02 Andy Wingo try-mutex in terms of mutex-lock * libguile/threads.c (scm_try_mutex): Just call scm_lock_mutex_timed with a zero timeout. * module/ice-9/threads.scm (try-mutex): Likewise. Fix typo in threads documentation * doc/ref/api-scheduling.texi (Threads): Fix typo. 2016-11-01 Andy Wingo Deprecate critical sections * NEWS: Deprecate critical sections. * doc/ref/api-scheduling.texi (Critical Sections): Remove. * libguile/async.c: * libguile/async.h: * libguile/deprecated.c: * libguile/deprecated.h: * libguile/threads.c: * libguile/threads.h: Deprecate critical section API. Threads no longer track critical section level * libguile/threads.h (scm_i_thread): * libguile/threads.c (guilify_self_1): Remove critical_section_level member of scm_i_thread. * libguile/async.c (scm_critical_section_end) (scm_critical_section_start): Remove bookkeeping. Remove call/cc assertion about critical sections * libguile/continuations.c (scm_dynthrow): Remove assertion about critical section level; it's just a mutex anyway. Remove last critical section use * libguile/scmsigs.c (signal_handler_lock): New variable. (scm_sigaction_for_thread): Block asyncs and use a mutex instead of using scm_dynwind_critical_section. Mutex in dynamic linker * libguile/dynl.c (scm_dynamic_link, scm_dynamic_unlink) (scm_dynamic_pointer): Use a mutex to provide thread-safety. Remove critical section in scm_debug_options * libguile/debug.c (scm_debug_options): Remove critical section. There is no memory corruption hazard and racing callers to debug options won't produce sensible results anyway; or anyway they will be the same as racing vector-set!. Mutex instead of critical section in gc.c * libguile/gc.c (scm_gc_protect_object, scm_gc_unprotect_object): Use a mutex instead of a critical section. Remove dead code. Mutex instead of critical section in GOOPS * libguile/goops.c (scm_sys_modify_instance) (scm_sys_modify_class): Use a mutex instead of a critical section. Simplify critical section implementation * libguile/async.h (SCM_CRITICAL_SECTION_START) (SCM_CRITICAL_SECTION_END): Define in just one way. * libguile/async.c (critical_section_mutex): New static variable. (scm_critical_section_start, scm_critical_section_end): Inline internal body of critical section gates. (scm_init_async): Init critical_section_mutex. * libguile/threads.c (scm_threads_prehistory): Don't declare critical section mutex here. Mutex instead of critical sectoin in symbol->keyword * libguile/keywords.c (scm_symbol_to_keyword): Use a mutex in a dynwind instead of a critical section. Mutexes instead of critical sections in stime.c * libguile/stime.c (scm_current_time): No need for a critical section around time(). (tz_lock): New mutex. (scm_localtime): Use tz_lock in a dynwind. Fixes bug in which critical section was never left on error. (scm_gmtime, scm_mktime, scm_strftime, scm_strptime): Use a normal mutex instead of a critical section. Remove unused internal definitions * libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs) (scm_i_pthread_mutex_unlock_unblock_asyncs): Remove unused internal definitions. regexec comment fix * libguile/regex-posix.c (SCM_DEFINE): Remove comment about threadsafety, given that regexec does appear to be threadsafe. sigaction critical section refactor. * libguile/scmsigs.c (scm_sigaction_for_thread): Use critical section dynwinds instead of SCM_CRITICAL_SECTION_START. threads: Use a mutex instead of a critical section. * libguile/threads.c: Replace uses of critical sections with a dedicated mutex. Add scm_yield to manual alongside yield * doc/ref/api-scheduling.texi (Threads): Mention scm_yield. api-scheduling.texi: Syntactic cleanups. * doc/ref/api-scheduling.texi: Remove vestigial comments. 2016-10-31 Andy Wingo Remove thread cleanup facility * NEWS: Add entry. * doc/ref/api-scheduling.texi (Threads): Remove thread-cleanup docs. * libguile/threads.c (guilify_self_1, do_thread_exit): (scm_set_thread_cleanup_x, scm_thread_cleanup): Remove these. * libguile/threads.h (scm_i_thread): Remove cleanup_handler. * module/ice-9/threads.scm: * module/ice-9/deprecated.scm (thread-cleanup, set-thread-cleanup!): Remove. * test-suite/tests/threads.test: Adapt to test cancel-thread return values and not test thread-cleanup procs. REPL server avoids thread cleanup handlers * module/system/repl/server.scm (serve-client): Avoid thread cleanup handlers. srfi-18: thread-terminate! without cleanup handlers * module/srfi/srfi-18.scm (%cancel-sentinel, thread-terminate!): Just use cancel-thread to cause the thread to return a sentinel value. (%timeout-sentinel): Rename from %sentinel. (thread-join!): Adapt and transform %cancel-sentinel to a &terminated-thread-exception. cancel-thread can take arguments * doc/ref/api-scheduling.texi (Threads): * module/ice-9/threads.scm (cancel-thread): Additional args to cancel-thread will be returned by the thread. Trim srfi-18 thread startup machinery * module/srfi/srfi-18.scm (make-thread): Use just one cond/mutex pair for signalling in both directions: waiting for launch and waiting for start. Refactor thread-join! to use optional args. * module/srfi/srfi-18.scm (thread-join!): Use optional args. Also don't treat false return values from threads as meaning anything. Rationalize exception handling in srfi-18 * module/srfi/srfi-18.scm (make-thread): Inline some helpers, and use just one catch block. (thread->exception): Move up definition. (exception-handler-for-foreign-threads): Use this as the default handler, not the one that squirrels away exceptions in thread->exception. (thread-terminate!): Don't instate an exception handler for the thread cleanup proc. srfi-18: Avoid call/cc. * module/srfi/srfi-18.scm (with-exception-handlers-here): New function. (wrap): Remove. (thread-join!, mutex-lock!): Use with-exception-handlers-here instead of the call/cc+wrap mess. 2016-10-30 Andy Wingo srfi-18: Inline uses of srfi-18-exception-preserver. * module/srfi/srfi-18.scm (srfi-18-exception-preserver): Inline into call sites. srfi-18: Use srfi-35 conditions. * module/srfi/srfi-18.scm: Use srfi-35 conditions instead of our home-grown equivalent system. (thread-exception-handlers): Remove unused table. (srfi-18-exception-handler): Always capture key consed to args; no special case for bare key. * test-suite/tests/srfi-18.test (provided?): Adapt to reason always being key+args. srfi-18: Use parameters. * module/srfi/srfi-18.scm: Use srfi-34 internally with srfi-34: prefix. (current-exception-handler): Be a parameter. (with-exception-handler): Adapt to current-exception-handler change. (thread-join!, mutex-lock!): Adapt to use srfi-34: prefix. srfi-18: Use lambda* optional arguments. * module/srfi/srfi-18.scm (make-mutex, make-condition-variable): Use optional arguments. srfi-18: Simplify thread-sleep!, thread-terminate!. * module/srfi/srfi-18.scm (thread-sleep!): Use `when'. (thread-terminate!): Simplify. srfi-18: Use `match' in thread-start!. * module/srfi/srfi-18.scm (thread-start!): Use `match'. srfi-18: Improve style. * module/srfi/srfi-18.scm (raise): Rely on SRFI-34 to #:replace raise. (make-thread): Use lambda* and when. Fix srfi-34 indentation * module/srfi/srfi-34.scm (with-exception-handler): Fix indentation. 2016-10-27 Andy Wingo cancel-thread via asyncs, not pthread_cancel * module/ice-9/threads.scm (cancel-tag): New variable. (cancel-thread): New Scheme function. (call-with-new-thread): Install a prompt around the thread. * libguile/threads.h (scm_i_thread): Remove cancelled member. * libguile/threads.c (scm_cancel_thread): Call out to Scheme. Always available, and works on the current thread too. (scm_set_thread_cleanup_x, scm_thread_cleanup): Adapt. (scm_init_ice_9_threads): Capture cancel-thread var. * doc/ref/api-scheduling.texi (Threads): Update. * NEWS: Update. 2016-10-26 Andy Wingo Use atomics for async interrupts * libguile/__scm.h (SCM_TICK): Always define as scm_async_tick(). * libguile/error.c (scm_syserror, scm_syserror_msg): * libguile/fports.c (fport_read, fport_write): * libguile/_scm.h (SCM_SYSCALL): Replace SCM_ASYNC_TICK with scm_async_tick (). (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE) (SCM_ASYNC_TICK_WITH_GUARD_CODE): Remove internal definitions. We inline into vm-engine.c, the only place where it matters. * libguile/async.h: * libguile/async.c (scm_async_tick, scm_i_setup_sleep): (scm_i_reset_sleep, scm_system_async_mark_for_thread): * libguile/threads.h (struct scm_thread_wake_data): * libguile/threads.h (scm_i_thread): * libguile/threads.c (block_self, guilify_self_1, scm_std_select): Rewrite to use sequentially-consistent atomic references. * libguile/atomics-internal.h (scm_atomic_set_pointer): (scm_atomic_ref_pointer): New definitions. * libguile/finalizers.c (queue_finalizer_async): We can allocate, so just use scm_system_async_mark_for_thread instead of the set-cdr! shenanigans. * libguile/scmsigs.c (take_signal): * libguile/gc.c (queue_after_gc_hook): Adapt to new asyncs mechanism. Can't allocate but we're just manipulating the current thread when no other threads are running so we should be good. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Inline the async_tick business. Move call-with-new-thread to Scheme * libguile/threads.c (scm_call_with_new_thread): Trampoline to Scheme. (launch_data, really_launch, scm_sys_call_with_new_thread): Simplify. (scm_init_ice_9_threads): Capture call-with-new-thread variable. * module/ice-9/threads.scm (call-with-new-thread): Add implementation in Scheme. Should allow for easier cancel-thread via prompt abort. 2016-10-25 Julian Graham Fix tree-il code generation for ECMAscript `new' expression. The compiler was producing `((toplevel foo))' instead of `(toplevel foo)'. Changed to use `call' form with target type and spliced constructor arguments. * module/language/ecmascript/compile-tree-il.scm (comp): Replace `@impl' shorthand with `call' + `@implv' for better control over resulting tree-il. * test-suite/tests/ecmascript.test (compiler): Add test for "new Object();" 2016-10-23 Andy Wingo Move thread bindings to (ice-9 threads) * libguile/init.c (scm_i_init_guile): Don't call scm_init_thread_procs. * libguile/threads.c (scm_init_ice_9_threads): Rename from scm_init_thread_procs, make static. (scm_init_threads): Register scm_init_thread_procs extension. * libguile/threads.h (scm_init_thread_procs): Remove decl. * module/ice-9/boot-9.scm: Load (ice-9 threads), so that related side effects occur early. * module/ice-9/deprecated.scm (define-deprecated): Fix to allow deprecated bindings to appear in operator position. Export deprecated bindings. (define-deprecated/threads, define-deprecated/threads*): Trampoline thread bindings to (ice-9 threads). * module/ice-9/futures.scm: Use ice-9 threads. * module/ice-9/threads.scm: Load scm_init_ice_9_threads extension. Reorder definitions and imports so that the module circularity with (ice-9 futures) continues to work. * module/language/cps/intmap.scm: * module/language/cps/intset.scm: * module/language/tree-il/primitives.scm: Use (ice-9 threads). * module/language/cps/reify-primitives.scm: Reify current-thread in (ice-9 threads) module. * module/srfi/srfi-18.scm: Use ice-9 threads with a module prefix, and adapt all users. Use proper keywords in module definition form. * test-suite/tests/filesys.test (test-suite): * test-suite/tests/fluids.test (test-suite): * test-suite/tests/srfi-18.test: Use ice-9 threads. * NEWS: Add entry. * doc/ref/api-scheduling.texi (Threads): Update. * doc/ref/posix.texi (Processes): Move current-processor-count and total-processor-count docs to Threads. Deferred module observers via a parameter * module/ice-9/boot-9.scm (module-defer-observers): Instead of being a global flag, change to be a parameter. (module-defer-observers-mutex, module-defer-observers-table): Remove. (module-modified): Adapt. (call-with-deferred-observers): Adapt. Allow nested called. 2016-10-19 Andy Wingo Adapt run-server* to change to `accept'. * module/system/repl/server.scm (run-server*): Adapt to new #f return value of accept on non-blocking ports. (errs-to-retry): Remove variable. 2016-10-18 Andy Wingo Small api-scheduling.texi reorder * doc/ref/api-scheduling.texi: Put "Threads" section at beginning of scheduling chapter. Update "Asyncs" section of manual. * doc/ref/api-scheduling.texi (Asyncs): Update. 2016-10-17 Andy Wingo NEWS item for deprecated user asyncs * NEWS: Add news. Deprecate user asyncs * libguile/async.c: * libguile/async.h: * libguile/deprecated.c: * libguile/deprecated.h (scm_async, scm_async_mark, scm_run_asyncs): Deprecate these functions, which comprise the "users asyncs" facility. * module/oop/goops.scm: Adapt to deprecation. * doc/ref/api-scheduling.texi: * doc/ref/libguile-concepts.texi: * doc/ref/libguile-foreign-objects.texi: * doc/ref/posix.texi: Remove documentation on user asyncs, and replace references to "system asyncs" to be just "asyncs". Deprecate arbiters * libguile/arbiters.c: * libguile/arbiters.h: * test-suite/tests/arbiters.test: Delete files. * libguile/deprecated.c: * libguile/deprecated.h: Move arbiters code here. * doc/ref/api-scheduling.texi: Remove section on arbiters. * libguile.h: * libguile/Makefile.am: * libguile/init.c: * module/oop/goops.scm: * test-suite/Makefile.am: Remove mention of arbiters. * NEWS: Update. Fold 2.1.4 news into 2.2 news * NEWS: Fold 2.1.4 news into main 2.2 news. 2016-10-11 Andy Wingo Fix slot allocation for prompts * module/language/cps/slot-allocation.scm (add-prompt-control-flow-edges): Fix to add links from prompt bodies to handlers, even in cases where the handler can reach the body but the body can't reach the handler. * test-suite/tests/compiler.test ("prompt body slot allocation"): Add test case. Texinfo serialization: add braces when needed * module/texinfo/serialize.scm (include, empty-command, inline-text): (inline-args, inline-text-args, eol-text-args, eol-text, eol-args) (environ, table-environ, paragraph, item, entry, fragment, serialize) (stexi->texi): Pass extra rest? parameter around to indicate arguments that can take any number of subforms without being surrounded by braces. (embrace, serialize-text-args): Surround non-rest arguments with braces. * test-suite/tests/texinfo.serialize.test: Add tests. Remove .gnuploadrc. * .gnuploadrc: Remove file. 2016-09-14 Andy Wingo Fix compile warning in posix.c * libguile/posix.c (scm_system_star): Fix SIG_IGN usage to not emit a warning. Still broken on Windows64 and similar systems though! Bump version to 2.1.4 * GUILE-VERSION (GUILE_MICRO_VERSION): Bump to 2.1.4. Update NEWS. * NEWS: Update. Avoid deprecated _IONBF in http tests * test-suite/tests/web-http.test ("chunked encoding"): Avoid deprecated _IONBF. Avoid deprecated statprof interface in test * test-suite/tests/statprof.test ("return values"): Avoid deprecated with-statprof. 2016-09-06 Andy Wingo Fix cross-compilation of negative fixnums * module/system/vm/assembler.scm (encoder): Use immediate-bits instead of object-address, to fix cross-compilation. 2016-09-06 Andy Wingo Compiler support for atomics * doc/ref/vm.texi (Inlined Atomic Instructions): New section. * libguile/vm-engine.c (VM_VALIDATE_ATOMIC_BOX, make-atomic-box) (atomic-box-ref, atomic-box-set!, atomic-box-swap!) (atomic-box-compare-and-swap!): New instructions. * libguile/vm.c: Include atomic and atomics-internal.h. (vm_error_not_a_atomic_box): New function. * module/ice-9/atomic.scm: Register primitives with the compiler. * module/language/cps/compile-bytecode.scm (compile-function): Add support for atomic ops. * module/language/cps/effects-analysis.scm: Add comment about why no effects analysis needed. * module/language/cps/reify-primitives.scm (primitive-module): Add case for (ice-9 atomic). * module/language/tree-il/primitives.scm (*effect-free-primitives*): (*effect+exception-free-primitives*): Add atomic-box?. * module/system/vm/assembler.scm: Add new instructions. * test-suite/tests/atomic.test: Test with compilation and interpretation. 2016-09-06 Andy Wingo Fix fixnum min/max for assembler * module/system/vm/assembler.scm (immediate-bits): I am a complete and total idiot and got the fixnum mins and maxes swapped. Add atomic boxes * doc/ref/api-scheduling.texi (Atomics): New manual section. * libguile.h: Include atomic.h. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Add atomic. * libguile/atomic.c: * libguile/atomic.h: New files. * libguile/atomics-internal.h (scm_atomic_set_scm, scm_atomic_ref_scm) (scm_atomic_swap_scm, scm_atomic_compare_and_swap_scm): New facilities. * libguile/goops.c (class_atomic_box, scm_sys_goops_early_init): Add support for . Remove duplicate fetch. * libguile/init.c (scm_i_init_guile): Call scm_register_atomic_box. * libguile/print.c (iprin1): Add atomic box case. * libguile/tags.h (scm_tc7_atomic_box): New tag. * libguile/validate.h (SCM_VALIDATE_ATOMIC_BOX): New macro. * module/Makefile.am (SOURCES): Add ice-9/atomic.scm. * module/ice-9/atomic.scm: New file. * module/oop/goops.scm (): New var. Reorder tc7 type codes * libguile/tags.h: Reorder type codes so that they are in numeric order in the header file; no type code value is changed. Tweak value of tc7-smob. * libguile/tags.h (scm_tc7_smob): * module/system/base/types.scm (%tc7-smob): Tweak this value, just to prove that it can be done. Remove scary comment. Convert tc7 values to hex in tags.h and elsewhere * libguile/tags.h: * module/system/base/types.scm: * module/system/vm/assembler.scm: Convert tc7 values to hex. No change otherwise. 2016-09-05 Wilfred Hughes Clarify bootstrap docs * doc/ref/vm.texi: Add a sentence stating which parts of the bytecode toolchain are in C, and which are in Scheme. This avoids confusion if users assume Guile==Scheme and so assume the whole toolchain is in Scheme. 2016-09-03 Robin Templeton Check for missing debug info in print-program * module/system/vm/program.scm (print-program): Check the return value of find-program-debug-info. Fixes #24320. 2016-09-02 Andy Wingo Fix typo in Nil documentation * doc/ref/api-languages.texi (Nil): Fix typo. Thanks to Wilfred Hughes for the report. Fixes #24342. Better char Better unboxing * module/language/cps/specialize-numbers.scm (truncate-u64): New helper, truncates a SCM value. (specialize-u64-binop): Add ulogxor case. (sigbits-union, sigbits-intersect, sigbits-intersect3) (next-power-of-two, range->sigbits, inferred-sigbits) (significant-bits-handlers, define-significant-bits-handler): (significant-bits-handler, compute-significant-bits): Add facility to compute the bits in a value that are significant. (specialize-operations): Unbox in more cases, when only u64 bits are significant. Unbox logxor. Elide logand where it has no effect. Fabricated expression tweak in CSE * module/language/cps/cse.scm (compute-equivalent-subexpressions): u64->scm fabricates equivalence for scm->u64/truncate too. Add unboxed logxor on u64 values * libguile/vm-engine.c (ulogxor): New instruction. * module/language/cps/effects-analysis.scm (ulogxor): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/types.scm (ulogxor): * module/system/vm/assembler.scm (emit-ulogxor): Add support for new instruction. * doc/ref/vm.texi (Unboxed Integer Arithmetic): Document ulogxor. 2016-08-31 Andy Wingo GC of non-blocking port does not block * libguile/ports.h (SCM_F_PORT_FINALIZING) (SCM_PORT_FINALIZING_P, SCM_SET_PORT_FINALIZING): New private definitions. * libguile/ports.c (finalize_port): Set the port-finalizing flag. (scm_i_write_bytes): If the port is finalizing but output returned EWOULDBLOCK, warn and discard the output. Only ptob->close() after read/write finish * libguile/Makefile.am (noinst_HEADERS): Add atomics-internal.h. * libguile/atomics-internal.h: New file. * libguile/ports-internal.h (refcount): New member. * libguile/ports.c (release_port, scm_dynwind_acquire_port): New facility for acquiring a port within a dynwind. (scm_port_poll, scm_i_read_bytes, scm_setvbuf, scm_end_input) (scm_i_write_bytes, scm_char_ready_p, scm_seek) (scm_truncate_file, trampoline_to_c_read) (trampoline_to_c_write): Acquire port. (scm_c_make_port_with_encoding): Init refcount to 1. (scm_close_port): Release port. * doc/ref/api-io.texi (I/O Extensions): Add documentation 2016-08-31 Christopher Allan Webber Fix example in make-custom-binary-input-port documentation * doc/ref/api-io.texi (Custom Ports): Add additional argument to example's invocation of make-custom-binary-input-port. Previously had mismatched arity by missing "closed" argument. 2016-08-31 Andy Wingo Set rw_random correctly for all custom binary port types * libguile/r6rs-ports.c (custom_binary_port_random_access_p): Rename from custom_binary_input_output_port_type, and use for all custom binary port types. Avoid flushing buffers for ftell * libguile/ports.c (scm_seek): Avoid flushing buffers for an ftell. Also allows non-random-access ports to ftell() if they have a seek implementation, as is the case for custom binary ports with a get-position function but no set-position function. * test-suite/tests/ports.test: Adapt expectations, reverting changes made in April by me in b77fb752dd7e14876741ecb6360ef0319eae18e0. Require C99 to build Guile. * configure.ac: Require C99 or later. Emacs does, therefore so can we. Note that by default GCC compiles in "gnu11" mode these days, and this declaration doesn't change that. 2016-08-31 Christopher Allan Webber Add tests for make-custom-binary-input/output-port * test-suite/tests/r6rs-ports.test ("8.2.13 Input/output ports"): Add tests for custom binary input/output ports, copied from existing binary input and binary output tests. Correct section number for "Input Ports" tests. * test-suite/tests/r6rs-ports.test: Correct "Input Ports" section heading from "7.2.7" -> "8.2.7", "7.2.5" -> "8.2.5", "7.2.8" -> "8.2.8", and "7.2.11" -> "8.2.11". 2016-08-31 Andy Wingo Move system* to posix.c, impl on open-process * libguile/simpos.c: Trim includes. (scm_system_star): Move to posix.c. * libguile/simpos.h (scm_system_star): Remove. * libguile/posix.h (scm_system_star): Add. * libguile/posix.c (scm_system_star): Move here and implement in terms of open-process. This lets system* work on Windows. Inspired by a patch by Eli Zaretskii. (start_child): Exit with 127 if the command isn't found. 2016-08-30 Andy Wingo Add file descriptor finalizers * doc/ref/posix.texi (Ports and File Descriptors): Document new interfaces. * libguile/filesys.c (scm_close, scm_close_fdes) * libguile/fports.c (fport_close): * libguile/ioext.c (scm_primitive_move_to_fdes): Call scm_run_fdes_finalizers. * module/ice-9/fdes-finalizers.scm: * test-suite/tests/fdes-finalizers.test: * libguile/fdes-finalizers.h: * libguile/fdes-finalizers.c: New files. * module/Makefile.am: * test-suite/Makefile.am: * libguile/Makefile.am: * libguile.h: * libguile/init.c: Wire up new files. 2016-08-28 Andy Wingo Remove duplicate documentation * doc/ref/posix.texi (Ports and File Descriptors): Remove duplicate documentation for port-mode and setvbuf. Remove SCM_I_MAX_PORT_TYPE_COUNT * libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): Remove unused CPP definition. ETag list headers accept sloppy etags * module/web/http.scm (parse-entity-tag): Add #:sloppy-delimiters keyword argument, and return a second value indicating the end position. (parse-entity-tag-list): Use parse-entity-tag, so that we also accept sloppy etags that aren't qstrings. * test-suite/tests/web-http.test ("request headers"): Add a test. Add prebuilt alias for x86_64-pc-linux-gnu * prebuilt/x86_64-pc-linux-gnu: Add as alias to x86_64-unknown-linux-gnu. 2016-08-25 Andy Wingo Tweak to conversion strategy access * libguile/strings.c (scm_from_port_stringn, scm_to_port_stringn): Access the conversion_strategy directly to make sure these functions can run while the port is flushing on close. Fixes web-http.test to allow the closed flag to be atomically cleared on a port before flushing. Fix exception when running ",help debug" * module/system/repl/command.scm (*command-table*): Remove entry for ",procedure", a command removed a few months ago. 2016-08-08 sirgazil Fix typo about open-pipe * doc/ref/posix.texi (Pipes): Fix typo. 2016-08-08 James Clarke Recognize alpha as compilation target * module/system/base/target.scm (cpu-endianness): Add case for "alpha". (triplet-pointer-size): Likewise. 2016-08-08 sirgazil Fix typo about variable definitions * doc/ref/api-binding.texi (Top Level Variable Definitions): Fix typo. 2016-08-07 Ethan Stefan Day Documentation fixes * doc/ref/api-compound.texi: * doc/ref/api-control.texi: * doc/ref/api-data.texi: Fix typos and clarify. 2016-08-07 David Kastrup Let assv/assoc shortcircuit to assq where feasible * libguile/alist.c (scm_sloppy_assv, scm_sloppy_assoc): (scm_assv, scm_assoc): Shortcircuit to scm_assq where feasible. 2016-08-07 Marek Vasut Recognize nios2 as compilation target Add support for the nios2 architecture. 2016-08-07 Andy Wingo Capture full path to GUILE_FOR_BUILD. * acinclude.m4: Capture full path to GUILE_FOR_BUILD. Fixes #22342. 2016-08-07 Calvin Heim Fix grammar in api-compound.texi * doc/ref/api-compound.texi: Fix grammar. 2016-08-07 sirgazil Fix typo about pattern variables * doc/ref/sxml-match.texi (Matching XML Elements): Fix typo. 2016-08-07 Andy Wingo Manual recommends against SRFI-10 * doc/ref/srfi-modules.texi (SRFI-10): Deprecate, or at least recommend against. 2016-08-04 Andy Wingo Implement R6RS custom binary input/output ports * NEWS: Add new feature. * doc/ref/r6rs.texi (rnrs io ports): * doc/ref/api-io.texi (Custom Ports): Document new procedure. * libguile/r6rs-ports.h: * libguile/r6rs-ports.c (make_custom_binary_input_output_port) (scm_make_custom_binary_input_output_port) (custom_binary_input_output_port_random_access_p) (initialize_custom_binary_input_output_ports) (scm_init_r6rs_ports): Implement custom binary input/output ports. * module/rnrs/io/ports.scm (rnrs): * module/ice-9/binary-ports.scm (ice-9): Export make-custom-binary-input/output-port. Fix compilation of `continue' in `while'. * module/language/cps/rotate-loops.scm (rotate-loops-in-function): Don't attempt to rotate a loop whose header is a $prompt. Fixes use of `continue' in `while'. Thanks to Nala Ginrut for the report :) 2016-07-25 Eli Zaretskii Avoid compilation warnings about alloca in read.c * libguile/read.c: Include alloca.h. 2016-07-25 Andy Wingo Fix --without-threads against threaded BDW-GC * libguile/gc.c (scm_storage_prehistory): Prevent BDW-GC from spawning marker threads if Guile was built without threading support. Reimplement null-threads as inline functions * libguile/null-threads.h: Reimplement null-threads stubs for pthread data types, initializers, and functions in terms of types and inline functions instead of CPP macros. Fixes unused-value warnings, and tightens things up in general. (scm_i_pthread_cleanup_push, scm_i_pthread_cleanup_pop): Remove these, as they were unused and incorrect -- they would never run the cleanup handler even if 1 was passed to pop. Use non-deprecated HAVE_STRUCT_TM_TM_ZONE * libguile/stime.c: Change uses of the deprecated HAVE_TM_ZONE to the new HAVE_STRUCT_TM_TM_ZONE. Use gnulib for basename / dirname * libguile/filesys.c (scm_dirname, scm_basename): Rewrite to use gnulib's dirname-lgpl. Gnulib: Add dirname-lgpl. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Add dirname-lgpl. 2016-07-25 Ludovic Courtès doc: Add unquote and unquote-splicing examples. Suggested by Vincent Legoll . * doc/ref/api-evaluation.texi (Expression Syntax): Add an unquote and an unquote-splicing example. 2016-07-25 Eli Zaretskii Untabify posix-w32.c Improve process handling on MS-Windows * libguile/posix-w32.c: Include gc.h and threads.h. (proc_record): New structure tag. : New static variables. (find_proc, proc_handle, record_proc, delete_proc): New utility functions. (start_child): Return value is now pid_t, as it is on Posix platforms. Record the new process and returns its PID, instead of returning a handle. Fix the recursive call. (waitpid, kill, getpriority, setpriority, sched_getaffinity) (sched_setaffinity): Look up the PID in the recorded subprocesses before trying to open a process that is not our subprocess. Make sure any open handle is closed before returning, unless it's our subprocess. 2016-07-25 Andy Wingo Allow mkstemp! to have optional "mode" argument * m4/mkstemp.m4: Remove. * lib/mkstemp.c: Remove. * lib/mkostemp.c: New file. * m4/mkostemp.m4: New file. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Remove mkstemp module, replace with mkostemp. * libguile/fports.h: * libguile/fports.c (scm_i_mode_to_open_flags): Factor out helper to parse mode string to open flags. (scm_open_file_with_encoding): Use the new helper. * libguile/filesys.c: (scm_i_mkstemp): Adapt to take optional second argument, being a mode string. Use mkostemp. (scm_mkstemp): Backwards compatible shim that calls scm_i_mkstemp. * doc/ref/posix.texi: * NEWS: Update. * module/system/base/compile.scm (call-with-output-file/atomic): Pass "wb" as mode, to cause O_BINARY to be added on MinGW. 2016-07-25 Ricardo Wurmus doc: Do not gender the programmer. * doc/ref/api-foreign.texi: Replace "his" with "their". * doc/ref/sxml.texi: Likewise. 2016-07-25 Eli Zaretskii Update uname implementation in posix-w32 * libguile/posix-w32.c (uname): Update to modern processors (ia64 and x86_64) and OS versions (Vista to Windows 10). Delete trailing whitespace. 2016-07-25 Andy Wingo Fix unused static variables in net_db.c * libguile/net_db.c (SCM_DEFINE_CONSTANT): New helper. Use it to define constants and avoid the unneeded static variables that were used before, named "sym_" but actually holding variables. Thanks to Eli Zaretskii for the report. Fix MinGW build error * configure.ac: Fix for recent rename of win32-uname.c to posix-w32.c. Update NEWS * NEWS: Update. Add popen feature * doc/ref/api-options.texi (Common Feature Symbols): Document the popen feature. * doc/ref/posix.texi (Pipes): Depend on the popen feature, not fork. * libguile/posix.c (scm_init_posix): Add popen feature if we can. 2016-07-25 Eli Zaretskii Add POSIX shims for MinGW * libguile/posix-w32.h: * libguile/posix-w32.c (kill, waitpid, getpriority, setpriority) (sched_getaffinity, sched_setaffinity): Add MinGW implementations. Also, provides macros that on Posix hosts are in sys/wait.h, like WIFEXITED and WTERMSIG. (start_child): Add implementation. 2016-07-25 Andy Wingo Rename win32-uname.[ch] to posix-w32.[ch] * libguile/posix-w32.c: * libguile/posix-w32.h: Rename from win32-uname.c and win32-uname.h. * libguile/posix.c: * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES) (noinst_HEADERS): Adapt. Ignore meta/build-env * .gitignore: Ignore meta/build-env. Factor start_child out of open_process * libguile/posix.c (start_child): Factor out from open_process. Based on initial work by Eli Zaretskii. More specific status:exit-val et al compilation guards * libguile/posix.c (scm_status_exit_val, scm_status_term_sig) (scm_status_stop_sig): Guard on WIFEXITED et al macros instead of on MinGW. getaffinity, setaffinity docstring cleanup * libguile/posix.c (scm_getaffinity, scm_setaffinity): Clean up docstrings. Obviously if you have the function, you don't need to be told that you have it in the docstring. Provide `kill' only if supported by the host * libguile/posix.c (scm_kill): Only provide if the host has `kill'. An incompatible change on MinGW, where this function would work only if the PID was the current PID, but that will be fixed by the next process. More robust setuid, setgid, etc detection * configure.ac: Check for getuid, getgid, setuid, and setgid. * libguile/posix.c (scm_getuid, scm_getgid, scm_setuid, scm_setgid): Only provide Scheme functions if the OS provides these facilities. (scm_geteuid, scm_getegid, scm_seteuid, scm_setegid): Provide if the host has getuid, getgid, etc, instead of being in a MinGW guard. 2016-07-25 Ludovic Courtès Add missing 'const' qualifier. * libguile/stime.c (tzvar): Add 'const'. Unconditionally include from Gnulib. * libguile/stime.c: Unconditionally include . build: Remove unneeded check for 'unsetenv'. * configure.ac: Remove check for 'unsetenv', which is unneeded since we use Gnulib's 'unsetenv'. 2016-07-11 Andy Wingo build-env: prebuilt .go files are in srcdir * meta/build-env.in (GUILE_LOAD_COMPILED_PATH): Look for prebuilt files in the srcdir, not the builddir. 2016-07-10 Andy Wingo Add meta/build-env * meta/build-env.in: New file which sets up an environment that does not inherit GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH (unless cross-compiling). * doc/ref/Makefile.am (autoconf-macros.texi): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.go): * test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE): * am/bootstrap.am (.scm.go): * am/guilec (.scm.go): Use build-env. * configure.ac: Create build-env. Avoid Gnulib unistr/* modules (unistr/base, unistr/u8-mbtouc, unistr/u8-mbtouc-unsafe) (unistr/u8-mbtoucr, unistr/u8-prev unistr/u8-uctomb, unitypes): --avoid these modules. 2016-07-07 Andy Wingo Update Gnulib to 68b6ade. Also add --conditional-dependencies to the flags. See: https://lists.gnu.org/archive/html/guile-devel/2016-07/msg00012.html Update git-version-gen.diff for current gnulib * gnulib-local/build-aux/git-version-gen.diff: Update. 2016-06-29 Andy Wingo Update NEWS * NEWS: Add 2.0.12 NEWS. Fold 2.1.3 NEWS into main 2.2.0 NEWS. 2016-06-28 Jan Nieuwenhuizen tests-suite: resurrect invoking check-guile --coverage. * test-suite/guile-test (main): remove (the-vm) from with-code-coverage call. 2016-06-27 Andy Wingo psyntax can trace expand-time changes to the current module * module/ice-9/psyntax.scm (expand-top-sequence): Support expand-time changes to the current module. * module/ice-9/psyntax-pp.scm: Regenerate. Fix uninstalled-env bug that put prebuilt/ in front * meta/uninstalled-env.in (top_builddir): Fix bug whereby meta/uninstalled-env run within meta-uninstalled-env, as happens sometimes, would move the prebuilt dir to the front. 2016-06-27 David Pirotte Fixing GUILE_PROGS wrong versioning checks * meta/guile.m4: Fixing GUILE_PROGS versioning checks were wrong and incomplete, leading to false errors like: "... checking for Guile version >= 2.0.11... configure: error: Guile 2.0.11 required, but 2.1.3 found". thanks to Colomban Wendling, aka b4n, who also suggested this fix during a chat on #autotools while helping me wrt another autotool related problem I was nvestigating. 2016-06-27 David Pirotte Do not track some test-suite files * .gitignore: Adding test-smob-mark-race to the list of the test-suite files we do not track. 2016-06-27 Taylan Ulrich Bayırlı/Kammer Fix 'monitor' macro. * module/ice-9/threads.scm (monitor-mutex-table) (monitor-mutex-table-mutex, monitor-mutex-with-id): New variables. (monitor): Fix it. 2016-06-25 Andy Wingo Add -Wmacro-use-before-definition * module/ice-9/boot-9.scm (%auto-compilation-options): * am/guilec (GUILE_WARNINGS): Add -Wmacro-use-before-definition. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use match-lambda. (, macro-use-before-definition-analysis): New analysis. * module/system/base/message.scm (%warning-types): Add macro-use-before-definition warning type. * module/language/tree-il/compile-cps.scm (%warning-passes): Add support for macro-use-before-definition. Fix duplicate case in peval * module/language/tree-il/peval.scm (singly-valued-expression?): Fix duplicate case. Spotted by "mejja" on IRC. Add documentation pointer from getopt-long to SRFI-37. * doc/ref/mod-getopt-long.texi (getopt-long): Point to SRFI-37. 2016-06-24 Andy Wingo Favor "escape continuation" over "one-shot continuation" in manual * doc/ref/api-control.texi (Prompt Primitives): Remove mention of one-shot continuations, as it's possible to invoke them multiple times if the continuation is re-entered through other means. 2016-06-24 Andy Wingo Check for strtod_l before using it. Based on a patch by Andy Stormont . * configure.ac: Check for strtod_l. * libguile/i18n.c (scm_locale_string_to_integer): Fix style. (scm_locale_string_to_inexact): Check for strtod_l. 2016-06-24 Andy Wingo Constant-folding eq? and eqv? uses deduplication * test-suite/tests/peval.test ("partial evaluation"): Add tests. * module/language/tree-il/peval.scm (peval): Constant-fold eq? and eqv? using equal?, anticipating deduplication. Prevent (@ (ice-9 boot-9) x) * module/ice-9/boot-9.scm: Prevent re-loading, perhaps via (@ (ice-9 boot-9) foo). (ice-9 boot-9) isn't a module. Fixes #21801. 2016-06-24 Daniel Llorens On Darwin, skip tests that depend on setrlimit On Darwin, setrlimit is ignored, and these tests do not terminate. There doesn't seem to be another way to limit the memory allocated by a process. * test-suite/standalone/test-stack-overflow: Skip this test on Darwin. * test-suite/standalone/test-out-of-memory: Skip this test on Darwin. 2016-06-24 Andy Wingo Fix texinfo->html for @acronym, @itemize * module/texinfo/html.scm (itemize, acronym, tag-replacements, rules): Fix HTML serialization of @itemize and @acronym. Fixes #21772. * test-suite/tests/texinfo.html.test: New file. * test-suite/Makefile.am: Add new file. Parse bytecode to determine minimum arity * libguile/programs.c (try_parse_arity): New helper, to parse bytecode to determine the minimum arity of a function in a cheaper way than grovelling through the debug info. Should speed up all thunk? checks and similar. (scm_i_program_arity): Simplify. * libguile/gsubr.h: * libguile/gsubr.c (scm_i_primitive_arity): * libguile/foreign.h: * libguile/foreign.c (scm_i_foreign_arity): Fix include-from-path when file found in relative path * module/ice-9/psyntax.scm (include-from-path): Canonicalize result of %search-load-path. Otherwise a relative path passed to `include' would be treated as relative to the directory of the file that contains the `include-from-path'. Fixes #21347. * module/ice-9/psyntax-pp.scm: Regenerate. 2016-06-24 Daniel Llorens Avoid stifling readline history when looking up options With this patch, history is never stifled unless (readline-set!) is used. * src/guile-readline/readline.c (scm_readline_options) 2016-06-24 Andy Wingo Fix typo about `keywords' read option * doc/ref/api-data.texi (Keyword Read Syntax): Fix typo. Thanks to Glenn Michaels for the report and fix. Fix ,profile in pure modules * libguile/scmsigs.c (close_1): Make the async closure in an environment where `lambda' has its usual meaning. Fixes #21013. Add with-input-from-port, etc documentation * doc/ref/api-io.texi (Default Ports): Add documentation for with-input-from-port, with-output-to-port, and with-error-to-port. Fixes #20919. Clarify use of the term "scanning" in the manual * doc/ref/api-memory.texi (Garbage Collection Functions): * doc/ref/libguile-concepts.texi (Garbage Collection): Attempt to be clear that scanning is a thing that happens in the mark phase. Fixes #20907 I think. Locale is default port encoding * libguile/ports.c (scm_init_ports): Use the locale as the default charset. After the switch to default GUILE_INSTALL_LOCALE=1, this harmonizes the default port encoding with the installed locale. 2016-06-23 Andy Wingo Add weak hash table documentation * doc/ref/api-memory.texi (Weak hash tables): Update documentation. Fixes #20551. Fix R6RS fold-left documentation * doc/ref/r6rs.texi (rnrs lists): Fix documentation of fold-left. Static default for define-module #:duplicates * module/ice-9/boot-9.scm (define-module*): Leaving off #:duplicates defaults to installing the duplicate binding handlers specified in the manual, not the value of some other dynamic parameter. (default-duplicate-binding-procedures): (default-duplicate-binding-handler): Instead of closing over a separate fluid, close over the handlers of the current module. That way when a user does (default-duplicate-binding-handler ...) in a script, then it applies to the right module. Fix default-duplicate-binding-handlers for compilation * module/ice-9/boot-9.scm (define-module*): Capture value of `default-duplicate-binding-procedures' when the module is created. Fixes #20093. Don't serialize uninterned symbols * module/system/vm/assembler.scm (intern-constant): Don't serialize uninterned symbols. * test-suite/tests/rtl.test ("bad constants"): Add a test. Fix memory leak in scm_from_{u,}int64 on 32-bit platforms * libguile/conv-integer.i.c (SCM_FROM_TYPE_PROTO): * libguile/conv-uinteger.i.c (SCM_FROM_TYPE_PROTO): Fix a big in which scm_from_int64 and scm_from_uint64 on a 32-bit platform leaked memory if they needed to allocate a bignum. Fixes #20079. 2016-06-23 Daniel Llorens Remove unused doc/maint 2016-06-23 Andy Wingo Fix race between SMOB marking and finalization * libguile/smob.c (clear_smobnum): New helper. (finalize_smob): Re-set the smobnum to the "finalized smob" type before finalizing. Fixes #19883. (scm_smob_prehistory): Pre-register a "finalized smob" type, which has no mark procedure. * test-suite/standalone/test-smob-mark-race.c: New file. * test-suite/standalone/Makefile.am: Arrange to build and run the new test. Fix relative file name canonicalization on paths with "." * libguile/filesys.c (scm_i_relativize_path): Canonicalize the file names elements that we will be using as prefixes. Fixes the case where a load path contains a relative file name: #19540. * test-suite/tests/ports.test ("%file-port-name-canonicalization"): Add tests that elements of the load path are canonicalized. 2016-06-22 Andy Wingo Remove unused internal i18n functions * libguile/i18n.c (str_upcase, str_downcase, str_upcase_l) (str_downcase_l): Remove unused inline functions. Based on a patch by Pedro Aguilar . Fixes #19172. Remove a stale variable use in libguile/Makefile.am * libguile/Makefile.am (BUILT_SOURCES): Remove a use of a variable that doesn't exist in 2.2. Fix SCM_DEBUG_TYPING_STRICTNESS bug * libguile/ports.c (scm_setvbuf): Fix bad use of SCM as a test value. Actually all ports have read buffers, so we can remove the condition entirely. Thanks Hydra for building in this way :) 2016-06-21 Andy Wingo Fix (< 'foo) compilation * module/language/tree-il/primitives.scm (expand-chained-comparisons): Fix (< 'foo) compilation. * test-suite/tests/compiler.test ("regression tests"): Add test case. Fix srfi-64.test for #:select borkage. The irony... * test-suite/tests/srfi-64.test: Fix for recent #:select borkage. `define!' instruction returns the variable * doc/ref/vm.texi (Top-Level Environment Instructions): Update documentation. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, sadly. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. * libguile/vm-engine.c (define!): Change to store variable in dst slot. * module/language/tree-il/compile-cps.scm (convert): * module/language/cps/compile-bytecode.scm (compile-function): Adapt to define! change. * module/language/cps/effects-analysis.scm (current-module): Fix define! effects. Incidentally here was the bug: in Guile 2.2 you can't have effects on different object kinds in one instruction, without reverting to &unknown-memory-kinds. * test-suite/tests/compiler.test ("regression tests"): Add a test. Use source file permissions for compiled files * module/system/base/compile.scm (call-with-output-file/atomic): Use the permissions of the source file, if available, as the permissions of the compiled file. Fixes #18477. Document pretty-print #:max-expr-width * doc/ref/misc-modules.texi (Pretty Printing): Document #:max-expr-width keyword argument. Fixes #17657. Importing modules with #:select no longer grovels private bindings * module/ice-9/boot-9.scm (resolve-interface): Don't look in private interface for #:select bindings. Fixes #17418. * module/system/repl/coop-server.scm: Don't rely on bad #:select behavior. * NEWS: Add entry. Detect too-old libunistring at configure-time. * configure.ac: Detect too-old libunistring at configure-time. Fixes #17399. Update and-let-star.test * test-suite/tests/and-let-star.test ("and-let*"): Update test expectations. 2016-06-21 Taylan Ulrich Bayırlı/Kammer Add SRFI-2 (and-let*) test suite. * test-suite/tests/srfi-2.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it. Fix SRFI-2 (and-let*) implementation. * module/ice-9/and-let-star.scm (%and-let*): Re-implemented this in a more verbose but accurate way. 2016-06-21 Andy Wingo Add R6RS bytevector->string, string->bytevector * module/rnrs/io/ports.scm (string->bytevector): (bytevector->string): New procedures. * module/rnrs.scm: Export new procedures. * test-suite/tests/r6rs-ports.test: Add string->bytevector and bytevector->string tests. Export &i/o-decoding, &i/o-encoding from (rnrs) * module/rnrs/io/ports.scm (&i/o-decoding, &i/o-encoding): Rename from &i/o-decoding-error and &i/o-encoding-error, to conform to R6RS. * module/rnrs.scm (rnrs): Export &i/o-decoding, &i/o-encoding, their accessors and constructors. Implement R6RS output-port-buffer-mode * module/rnrs/io/ports.scm (r6rs-open): Set buffer-mode on new port. (output-port-buffer-mode): Implement and export. * module/rnrs.scm (rnrs): Export output-port-buffer-mode * test-suite/tests/r6rs-ports.test (test-output-file-opener): Add tests. 2016-06-21 Taylan Ulrich Bayırlı/Kammer (rnrs hashtables): Hash functions of eq? and eqv? hashtables Also pinging this thread with a (very slightly) updated patch. :-) [2. text/x-diff; 0001-Hashtable-hash-function-returns-f-on-eq-and-eqv-tabl.patch] From 17599f6ce7ba0beb100e80455ff99af07333d871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= Date: Tue, 21 Jun 2016 00:23:29 +0200 Subject: [PATCH] Hashtable-hash-function returns #f on eq and eqv tables. * module/rnrs/hashtables.scm (r6rs:hashtable)[type]: New field. (r6rs:hashtable-type): New procedure. * test-suite/tests/r6rs-hashtables.test: Add related tests. 2016-06-21 Taylan Ulrich Bayırlı/Kammer (rnrs hashtables): Mutation of immutable hashtable ignored Pinging this thread with a (very slightly) updated patch. :-) [2. text/x-diff; 0001-Hashtable-set-errors-on-immutable-hashtable.patch] From 7f35d515d711e255bba5a89a013d9d92034edf41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= Date: Tue, 21 Jun 2016 00:25:19 +0200 Subject: [PATCH] Hashtable-set! errors on immutable hashtable. * module/rnrs/hashtables.scm (hashtable-set!): Raise an assertion violation error when the hashtable is immutable. * test-suite/tests/r6rs-hashtables.test: Fix accordingly. 2016-06-21 Andy Wingo Fix fixnum-range changes in R6RS fixnum bitops * module/rnrs/arithmetic/fixnums.scm (fxcopy-bit, fxbit-field) (fxcopy-bit-field, fxarithmetic-shift) (fxarithmetic-shift-left, fx-arithmetic-shift-right) (fxrotate-bit-field, fxreverse-bit-field): Enforce range on amount by which to shift. Fixes #14917. * test-suite/tests/r6rs-arithmetic-fixnums.test ("fxarithmetic-shift-left"): Update test to not shift left by a negative amount. Add another code coverage test * test-suite/tests/coverage.test ("line-execution-counts"): Add a test from Taylan Ulrich B, from bug #14849. Document sigaction + SA_RESTART * doc/ref/posix.texi (Signals): Document interaction between Guile's signal handling and SA_RESTART. Fixes #14640. 2016-06-20 Andy Wingo Fix peval on (call-with-values foo (lambda (x) x)) * module/language/tree-il/peval.scm (peval): Don't inline (call-with-values foo (lambda (x) exp)) to (let ((x (foo))) exp). The idea is that call-with-values sets up an explicit context in which we are requesting an explicit return arity, and that dropping extra values when there's not a rest argument is the wrong thing. Fixes #13966. * test-suite/tests/peval.test ("partial evaluation"): Update test. Document char-ready? limitations. * doc/ref/api-io.texi (Venerable Port Interfaces): Document limitations of char-ready?. See http://debbugs.gnu.org/10627. 2016-06-20 Andy Wingo Fix size measurement in bytevector_large_set * libguile/bytevectors.c (bytevector_large_set): Fix computation of value size in words. * test-suite/tests/bytevectors.test: Add test. Thanks to Ben Rocer for the bug report and fix. 2016-06-20 Andy Wingo Fix uri-decode behavior for "+" * module/web/uri.scm (uri-decode): Add #:decode-plus-to-space? keyword argument. (split-and-decode-uri-path): Don't decode plus to space. * doc/ref/web.texi (URIs): Update documentation. * test-suite/tests/web-uri.test ("decode"): Add tests. * NEWS: Add entry. Based on a patch by Brent . 2016-06-19 Diogo F. S. Ramos Add reference to the lack of "non-greedy" variants While describing special characters, remind the reader that "non-greedy" variants are not supported. They might not be familiar with POSIX extended regular expression and expect it to work. * doc/ref/api-regex.texi: Add "non-greedy" observation 2016-06-19 Diogo F. S. Ramos Remove link to Emacs' regexp syntax Linking to Emacs' regexps as an example of regexp syntax gives the wrong impression that Guile supports it, which is not true. * doc/ref/api-regex.texi: Remove link to Emacs' regexp syntax 2016-06-18 Andy Wingo Bump version to 2.1.3 * GUILE-VERSION (GUILE_MICRO_VERSION): Bump to 2.1.3. Minor NEWS updates * NEWS: Minor updates. Fix ports bug when size_t is 32 bits * libguile/ports.c (scm_end_input): I am a complete idiot. I had no idea that `- (uint32_t) x' is actually still a uint32_t. 2016-06-17 Andy Wingo Fix 64->32 bit cross-compilation of large-ish fixnums * module/system/vm/assembler.scm (immediate-bits): Fix a bug whereby compiling to a 32-bit target from a 64-bit host would treat all integers whose representation fit into 32 bits as immediates. This would result in integer constants between #x20000000 and 0x3fffffff being residualized in such a way that they would be loaded as negative numbers. 2016-06-12 Andy Wingo Skip incompatible .go files * libguile/load.c (load_thunk_from_path, try_load_thunk_from_file): New functions. (search_path): Simplify. (scm_primitive_load_path, scm_init_eval_in_scheme): Use the new functions to load compiled files. * module/ice-9/boot-9.scm (load-in-vicinity): Skip invalid .go files. Inspired by a patch from Jan Nieuwenhuizen . 2016-06-11 Andy Wingo Remove unused static definitions * libguile/expand.c: * libguile/vm.c: Remove unused static definitions. Fix shuffling of unboxed stack elements on 32-bit systems * libguile/vm-engine.c (SP_REF_SLOT, SP_SET_SLOT): New defines. (push, pop, mov, long-mov): Move full slots. Fixes 32-bit with unboxed 64-bit stack values; before when shuffling these values around, we were only shuffling the lower 32 bits on 32-bit platforms. VM type checking refactor * libguile/vm-engine.c (VM_VALIDATE): Refactor some type-related assertions to use a common macro. (vector-length, vector-set!/immediate): Fix the proc mentioned in the error message. vm: Make sure IP is stored before potentially GCing. * libguile/vm-engine.c: Add a number of SYNC_IP calls that were missing before calls that could GC. 2016-06-10 Andy Wingo Fix bad backtraces * libguile/vm-engine.c (BV_REF, BV_BOUNDED_SET, BV_SET, integer->char) (char->integer): Use VM_ASSERT so that we save the IP before erroring out. Minor VM fixes * libguile/vm-engine.c (string-ref): Unpack the index into a 64-bit integer. (br-if-u64-<-scm): Tighten up the fast path. Type inference: Use &u64-max instead of #xffff... * module/language/cps/types.scm: Use &u64-max where possible. Types refactor for unboxed char ranges * module/language/cps/types.scm (*max-codepoint*): Factor codepoint range restrictions to use this value. 2016-06-09 Andy Wingo Non-blocking accept/connect Scheme support * module/ice-9/sports.scm (accept, connect): New Scheme functions. Support `connect' on nonblocking sockets * libguile/socket.c (scm_connect): * doc/ref/posix.texi (Network Sockets and Communication): Support connect on nonblocking ports. `accept' on nonblocking socket can return #f * doc/ref/posix.texi (Network Sockets and Communication): * libguile/socket.c (scm_accept): Return #f if the socket is nonblocking and no connection is ready. put-char in Scheme * libguile/ports.c (scm_port_encode_char): New function. * module/ice-9/ports.scm (port-encode-char): Export port-encode-char to the internals module. * module/ice-9/sports.scm (put-char): New function. (port-bindings): Add put-char and put-string. Update port documentation, rename sports to suspendable ports * module/ice-9/suspendable-ports.scm: Rename from ice-9/sports.scm, and adapt module names. Remove exports that are not related to the suspendable ports facility; we want people to continue using the port operations from their original locations. Add put-string to the replacement list. * module/Makefile.am: Adapt to rename. * test-suite/tests/suspendable-ports.test: Rename from sports.test. * test-suite/Makefile.am: Adapt to rename. * module/ice-9/textual-ports.scm (unget-char, unget-string): New functions. * doc/ref/api-io.texi (Textual I/O, Simple Output): Flesh out documentation. (Line/Delimited): Undocument write-line, read-string, and read-string!. This is handled by (ice-9 textual-ports). (Bytevector Ports): Fix duplicated section. (String Ports): Move the note about encodings down to the end. (Custom Ports): Add explanatory text. Remove mention of C functions; they should use the C port interface. (Venerable Port Interfaces): Add text, and make documentation refer to recommended interfaces. (Using Ports from C): Add documentation. (Non-Blocking I/O): Document more fully and adapt to suspendable-ports name change. 2016-06-08 Andy Wingo Big ports documentation update * doc/ref/api-io.texi: Update to document ports more thoroughly. Still some work needed. * doc/ref/r6rs.texi: Move ports documentation back to r6rs.texi, now that Guile has a more thorough binary/textual I/O story, heavily based on R6RS. * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-options.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/srfi-modules.texi: Update references. 2016-06-08 Andy Wingo Undocument (ice-9 rw) * doc/ref/api-io.texi (Block Reading and Writing): Undocument (ice-9 rw). The R6RS routines do the same job and are not so clunky. Add (ice-9 textual-ports) * module/ice-9/textual-ports.scm: New module. * module/Makefile.am: Add new module. put-char, put-string in (ice-9 ports internals) * libguile/ports.h (scm_put_char): * libguile/ports.c (scm_put_char): New function. (scm_put_string): Add docstrings, and expose to the internal ports module. * module/ice-9/ports.scm (put-char, put-string): Expose these bindings only through the internals module. 2016-06-04 Andy Wingo socket: TCP_CORK, TCP_NODELAY * libguile/socket.c (scm_init_socket): Define TCP_NODELAY and TCP_CORK if they are available. * doc/ref/posix.texi (Network Sockets and Communication): Add documentation. * NEWS: Add entry. 2016-06-01 Andy Wingo put-string in Scheme * module/ice-9/ports.scm: Export port-encode-chars and port-clear-stream-start-for-bom-write via the internals module. * module/ice-9/sports.scm (put-string): New function. Rework text encoding to be more Scheme-friendly * libguile/ports.c (scm_port_clear_stream_start_for_bom_write): Instead of returning the BOM, take an optional buffer in which to write the BOM. Return number of bytes written. (port_clear_stream_start_for_bom_write): Remove. (scm_i_write): Adapt scm_port_clear_stream_start_for_bom_write call. (try_encode_char_to_iconv_buf, encode_latin1_chars_to_latin1_buf): (encode_latin1_chars_to_utf8_buf, encode_latin1_chars_to_iconv_buf): (encode_latin1_chars, encode_utf32_chars_to_latin1_buf): (encode_utf32_chars_to_utf8_buf, encode_utf32_chars_to_iconv_buf): (encode_utf32_chars, port_encode_chars): New helpers. (scm_port_encode_chars): New procedure. (scm_c_put_latin1_chars, scm_c_put_utf32_chars): Rework to use new encoding helpers. (scm_lfwrite): Use scm_c_put_latin1_chars. 2016-05-30 Andy Wingo Simplify string, symbol, char display/write impls * libguile/print.h: * libguile/print.c: Use the new routines from ports.[ch]. Add scm_c_put_escaped_char, scm_c_can_put_char * libguile/ports.h: * libguile/ports.c (scm_c_put_escaped_char, scm_c_can_put_char): New helpers. iprin1 uses scm_c_put_string * libguile/print.c (iprin1): Use scm_c_put_string for strings. * test-suite/test-suite/lib.scm (exception:encoding-error): Add an additional expected error string for `encoding-error'. print_normal_symbol uses new port functions * libguile/print.c (print_normal_symbol): Use new port functions. Beginnings of supporting encoding text in ports.c * libguile/ports.h (scm_c_put_latin1_chars, scm_c_put_utf32_chars) (scm_c_put_char, scm_c_put_string, scm_print_string): New public functions. The plan is to move encoding to ports.c and out of print.c. * libguile/ports.c (UTF8_BUFFER_SIZE, ESCAPE_BUFFER_SIZE): New internal defines. (update_port_position): Take a position instead of a port. Update callers. (utf8_to_codepoint): Allow lengths that are larger than necessary. (port_clear_stream_start_for_bom_write): Require that io_mode be BOM_IO_TEXT to write a BOM. (scm_fill_input): Add a related comment about BOM handling. (scm_i_write): use BOM_IO_TEXT, at least for now. (encode_escape_sequence, codepoint_to_utf8, utf8_to_codepoint) (put_utf8_chars_to_iconv_port, put_latin1_chars_to_utf8_port) (put_latin1_chars_to_iconv_port, put_utf32_chars_to_latin1_port) (put_utf32_chars_to_utf8_port, put_utf32_chars_to_iconv_port): New helpers. (scm_putc, scm_puts): Use scm_c_put_char and scm_put_latin1_chars. 2016-05-25 Andy Wingo Add port-line-buffered? * libguile/ports.c (scm_port_line_buffered_p): New function. * module/ice-9/ports.scm: Plump port-line-buffered? and port-auxiliary-write-buffer through to the internals module port_clear_stream_start_for_bom_write refactor * libguile/ports.c (port_clear_stream_start_for_bom_write): Rework to be friendly to Scheme write implementations. 2016-05-24 Andy Wingo Speed up scm_c_write / scm_lfwrite * libguile/ports-internal.h (scm_t_port): Add write_buf_aux field. * libguile/ports.h (scm_port_auxiliary_write_buffer): New internal decl. * libguile/ports.c (AUXILIARY_WRITE_BUFFER_SIZE): New constant. (initialize_port_buffers): Init aux write buf. (scm_port_auxiliary_write_buffer): Lazily allocate an aux write buffer. (scm_c_write): Arrange to write through an aux buffer if the port is unbuffered. Speed golf on Scheme put-u8, put-bytevector * module/ice-9/sports.scm (put-u8, put-bytevector): Speed hack. Add put-u8 implementation in Scheme * module/ice-9/sports.scm (put-u8): Add implementation. (port-bindings): Add put-u8. `put-bytevector' in Scheme * module/ice-9/sports.scm (flush-input): New helper. (put-bytevector): New function. (port-bindings): Add put-bytevector. Wire up non-blocking support in sport writes * module/ice-9/sports.scm (write-bytes): Support non-blocking writes. (force-output, flush-output): Rearrange placement. close-port implementation in sports * module/ice-9/sports.scm (close-port): New function. (port-bindings): Add close-port. Add force-output to sports * module/ice-9/sports.scm (force-output): New implementation. (port-bindings): Add force-output. 2016-05-23 Andy Wingo Thread-safety fixes for iconv and ports * libguile/ports-internal.h (scm_t_port): Rework to store iconv descriptors inline, so that the port finalizer doesn't race with the iconv descriptor finalizer. Access is serialized through a lock. Fixes a bug whereby if the port finalizer and the descriptor finalizer run on different threads, the close-port run by the port finalizer could try to free the iconv descriptors at the same time as the descriptor finalizer. * libguile/ports.c (iconv_lock): New static variable. (scm_c_make_port_with_encoding): Initialize iconv-related fields. (scm_close_port): Lock while frobbing iconv descriptors. (prepare_iconv_descriptors): Adapt. (scm_specialize_port_encoding_x, scm_i_set_port_encoding_x): Lock while preparing iconv descriptors. (scm_port_acquire_iconv_descriptors) (scm_port_release_iconv_descriptors): New functions, which replace scm_i_port_iconv_descriptors. (scm_port_decode_char): Lock around iconv operations. (port_clear_stream_start_for_bom_write): Acquire iconv descriptors before checking precise_encoding, to make sure precise_encoding is initialized. * libguile/print.c (display_string_using_iconv): Adapt to use the new interface to get iconv descriptors from a port. 2016-05-22 Andy Wingo get-bytevector-n in Scheme. * module/ice-9/sports.scm (fill-input): Add io-mode optional arg. (get-bytevector-n): New implementation. (port-bindings): Add get-bytevector-n. * test-suite/tests/sports.test: Add r6rs-ports tests. Fix range checking in new Scheme-to-C port code * libguile/ports.c (trampoline_to_c_read, trampoline_to_c_write): Fix bugs checking ranges of start and count parameters. 2016-05-22 Andy Wingo More thorough ice-9 sports testing * module/ice-9/sports.scm: Export read-line, %read-line, and read-delimited. Add these latest three to install-sports!, and fix install-sports! if the current module isn't (ice-9 sports). * test-suite/tests/sports.test: Use install-sports! instead of lexical bindings, to allow us to nicely frob bindings in rdelim. Include rdelim tests. 2016-05-22 Andy Wingo Merge from stable-2.0 This cherry-picks changes from stable-2.0, starting from acd2c8e36a25d77e9e9c9b6782780b23a1764973 and ending in 461b62efc90135d3ca8719ba0f3b6ced4ad13754, inclusively. I did not cherry-pick patches that were already on master and did not cherry-pick ones that don't make sense on master (for example because of the port re-write). I did pick all tests though. I also did not cherry-pick the "Revert foreign objects" patch from ff98cbb643d43c9f8c6ee0e0b4e1bad72aced62e; further discussion necessary. 2016-05-22 Luribert doc: Fix typo in Web documentation. * doc/ref/web.texi (Http Headers): Fixed typo. 2016-05-22 Ludovic Courtès http: Accept date strings with a leading space for hours. Fixes . Reported by Ricardo Wurmus . * module/web/http.scm (parse-rfc-822-date): Add two clauses for hours with a leading space. * test-suite/tests/web-http.test ("general headers"): Add two tests. 2016-05-22 Mark H Weaver Bump user-visible copyright years to 2016. * doc/ref/guile.texi: Add 2016 to user-visible copyright notice. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2016. * module/system/repl/common.scm (*version*): Add 2016 to the range of copyright years. SRFI-19: Update the table of leap seconds. * module/srfi/srfi-19.scm (leap-second-table): Update to include the most recent leap second. 2016-05-22 Ludovic Courtès http: Use 'read-header-line' instead of 'read-line*'. * module/web/http.scm (read-line*): Remove. (read-continuation-line, read-header, read-request-line): Use 'read-header-line' instead of 'read-line*'. 2016-05-22 Ludovic Courtès http: Accept empty reason phrases. Fixes . Reported by Ricardo Wurmus . * module/web/http.scm (read-header-line): New procedure. (read-response-line): Use it instead of 'read-line*'. * test-suite/tests/web-http.test ("read-response-line"): Add test. 2016-05-22 Ludovic Courtès http: Test that responses lacking CR/LF are rejected. * test-suite/tests/web-http.test ("read-response-line")["missing CR/LF"]: New test. 2016-05-22 Mark H Weaver Bump user-visible copyright years to 2015. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2015. * module/system/repl/common.scm (*version*): Add 2015 to the range of copyright years. 2016-05-22 Mark H Weaver Fix getsockopt/setsockopt handling of SO_SNDBUF/SO_RCVBUF options. Reported by Park SungMin in . * libguile/socket.c (scm_getsockopt, scm_setsockopt): Remove code that incorrectly assumed that the argument for SO_SNDBUF and SO_RCVBUF options was of type 'size_t'. Both the Linux and POSIX documentation indicates that the argument is of type 'int', as is the case for most options. 2016-05-22 Ludovic Courtès Regenerate SRFI-14 character set data. Suggested by Mike Gran . * libguile/srfi-14.i.c: Regenerate for Unicode 8.0.0, with SHA256 38b17e1118206489a7e0ab5d29d7932212d38838df7d3ec025ecb58e8798ec20. 2016-05-22 Mark H Weaver build: Add SCM_T_OFF_MAX and SCM_T_OFF_MIN to scmconfig.h. * libguile/gen-scmconfig.c (main): Add SCM_T_OFF_MAX and SCM_T_OFF_MIN to the generated 'scmconfig.h' file. 2016-05-22 Ludovic Courtès doc: Mention a known-good Flex version number. Suggested by Jamil Egdemir . * HACKING: Mention a Flex version number. 2016-05-22 Ludovic Courtès Thank David and Kouhei. 2016-05-22 Ludovic Courtès build: Remove libguile/mkstemp.c, redundant with Gnulib. Fixes . Reported by Kouhei Sutou . * configure.ac: Remove 'AC_REPLACE_FUNCS' for 'mkstemp'. * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove mkstemp.c. * libguile/mkstemp.c: Remove. 2016-05-22 David Michael Remove SIGEV constant definitions. * libguile/Makefile.am (chknew-E chknew-SIG): Anchor the end of the signal/error name pattern to only match alphanumeric symbols. * libguile/cpp-SIG.syms (SIGEV_MAX_SIZE, SIGEV_NONE): Remove. (SIGEV_PAD_SIZE, SIGEV_SIGNAL, SIGEV_THREAD): Likewise. (SIGEV_THREAD_ID): Likewise. Add Hurd signal and error constants. * libguile/cpp-E.syms (EAUTH, EBACKGROUND): New definitions. (EBADRPC, ED, EDIED, EFTYPE, EGRATUITOUS, EGREGIOUS): Likewise. (EIEIO, ENEEDAUTH, EPROCLIM, EPROCUNAVAIL): Likewise. (EPROGMISMATCH, EPROGUNAVAIL, ERPCMISMATCH): Likewise. * libguile/cpp-SIG.syms (SIGEMT, SIGEV_MAX_SIZE): Likewise. (SIGEV_PAD_SIZE, SIGINFO, SIGLOST): Likewise. Add new Linux errno constants. * libguile/cpp-E.syms (EHWPOISON, ERFKILL): New definitions. 2016-05-22 David Michael Fix the rule to check for new signals and errors Fixes . * libguile/Makefile.am (chknew-E chknew-SIG): Remove the line continuation after the targets, and include numbers in the recipe's signal/error regexp to catch names like E2BIG. 2016-05-22 Ludovic Courtès i18n: Add new collation test for posterity. * test-suite/tests/i18n.test ("text collation (Czech)"): New test prefix. web: Gracefully handle premature EOF when reading chunk header. * module/web/http.scm (read-chunk-header): Return 0 when 'read-line' returns EOF. 2016-05-22 Mark H Weaver docs: Fix external representation of in tree-il. * doc/ref/compiler.texi (Tree-IL): Provide the correct external representation of . 2016-05-22 Ludovic Courtès web: Fix 'close' method of delimited input ports. * module/web/response.scm (make-delimited-input-port)[close]: Replace erroneous self-recursive call with a call to 'close-port'. * test-suite/tests/web-response.test ("example-1")["response-body-port + close"]: New test. Thank Ricardo. doc: Fix menu order for SXML. * doc/ref/sxml.texi (SXML): Add missing quotes in example. Fix node order in menu. 2016-05-22 Ricardo Wurmus doc: Add SXPath documentation from sources Fixes . * doc/ref/sxml.texi (SXPath): Add procedure documentation from sources. 2016-05-22 Mark H Weaver psyntax: Fix bug in match-each+. Reported by Panicz Maciej Godek in . * module/ice-9/psyntax.scm (match-each+): Fix the case where a non-pair syntax object is encountered in a dotted tail. * module/ice-9/psyntax-pp.scm: Regenerate. 2016-05-22 Taylan Ulrich Bayırlı/Kammer Clarify datum->syntax documentation. * doc/ref/api-macros.texi (Syntax Case): Make it clear that the first argument to datum->syntax must be an identifier. 2016-05-22 Mark H Weaver Fix uses of 'scm_gc_protect', which does not exist, in the manual. * doc/ref/api-memory.texi (Garbage Collection Functions), doc/ref/libguile-concepts.texi (Garbage Collection): Change 'scm_gc_protect' --> 'scm_gc_protect_object'. 2016-05-22 Andreas Rottmann Heed the reader settings implied by #!r6rs When encountering the #!r6rs directive, apply the appropriate reader settings to the port. * libguile/read.scm (read-string-as-list): New helper procedure. (scm_read_shebang): Set reader options implied by the R6RS syntax upon encountering the #!r6rs directive. * test-suite/tests/reader.test (per-port-read-options): Add tests for the #!r6rs directive. 2016-05-22 Mark H Weaver Fix atan procedure when applied to complex numbers. Fixes a regression introduced in commit ad79736c68a803a59814fbfc0cb4b092c2b4cddf. * libguile/numbers.c (scm_atan): Fix the complex case. * test-suite/tests/numbers.test ("atan"): Add test. 2016-05-22 Mathieu Lirzin doc: Fix parameter of 'set-record-type-printer!'. * doc/ref/api-compound.texi (SRFI-9 Records)[set-record-type-printer!]: Fix parameter name. 2016-05-22 Natanael Copa i18n: Check for non-POSIX strtol_l. * configure.ac: Check for strtol_l. * libguile/i18n.c: Check HAVE_STRTOL_L before using strtol_l. 2016-05-22 Alex Kost Fix typo in the man page. * doc/guile.1: "--no-autocompile" -> "--no-auto-compile". Fix typo in manual. * doc/ref/api-modules.texi (Using Guile Modules): Remove extra "yet". 2016-05-22 Ludovic Courtès doc: Update libgc URL. * doc/ref/data-rep.texi (Conservative GC): Update libgc URL. 2016-05-22 Mark H Weaver Add more R6RS port encoding tests Originally applied to stable-2.0 as "Fix bytevector and custom binary ports to actually use ISO-8859-1 encoding.", commit d574d96f879c147c6c14df43f2e4ff9e8a6876b9. Related to http://bugs.gnu.org/20200, which was introduced in in stable-2.0 but never existed on master. Test modified by Andy Wingo to add a `force-output' where needed. * test-suite/tests/r6rs-ports.test: Add tests. 2016-05-22 Mark H Weaver Handle zero-length bytevectors correctly in (system base types). * module/system/base/types.scm (cell->object): Use 'get-bytevector-n' instead of 'get-bytevector-all', so that the zero-length case does not return EOF. Work around requirement that size be non-zero in GDB 'open-memory'. * module/system/base/types.scm (memory-port): Handle zero size case specially. 2016-05-22 Ludovic Courtès web: Export 'server-impl' procedures and the 'http' server implementation. * module/web/server.scm: Export the 'server-impl' procedures. * module/web/server/http.scm: Export 'http'. 2016-05-22 Taylan Ulrich Bayırlı/Kammer Correct docstring of 'symlink'. * libguile/filesys.c (symlink): Correct the docstring, which had 'oldpath' and 'newpath' confused. 2016-05-22 Ludovic Courtès tests: Gracefully handle ENOSYS return for 'setaffinity'. Fixes . Reported by John Paul Adrian Glaubitz . * test-suite/tests/posix.test ("affinity")["setaffinity"]: Wrap in 'catch' and throw 'unresolved upon ENOSYS. 2016-05-22 Ludovic Courtès tests: Make 'test-guild-compile' more reliable. Before that it would occasionally fail because the "$target" (not the intermediate temporary file) would be produced. * test-suite/standalone/test-guild-compile: Call 'pause' before 'sleep' in test program. 2016-05-22 Mark H Weaver Don't return expressions from void functions in numbers.c Although popular compilers allow it as long as the expression is of type void, it violates C99 and some compilers choke on it. * libguile/numbers.c (scm_euclidean_divide, scm_floor_divide) (scm_ceiling_divide, scm_truncate_divide, scm_centered_divide) (scm_round_divide): Don't use the return statement with an expression from functions with return type void. 2016-05-22 Mark H Weaver Implement 'string-utf8-length' and 'scm_c_string_utf8_length'. * libguile/strings.c (utf8_length, scm_c_string_utf8_length) (scm_string_utf8_length): New functions. * libguile/strings.h (scm_c_string_utf8_length, scm_string_utf8_length): New prototypes. * doc/ref/api-data.texi (Bytevectors as Strings): Add docs. * doc/ref/guile.texi: Update manual copyright date to 2015. * test-suite/tests/strings.test (string-utf8-length): Add tests. 2016-05-22 Ludovic Courtès http: Do not buffer HTTP chunks. Fixes . * module/web/http.scm (read-chunk, read-chunk-body): Remove. (make-chunked-input-port)[next-chunk, buffer-, buffer-size, buffer-pointer]: Remove. [chunk-size, remaining]: New variables. [read!]: Rewrite to write directly to BV. * test-suite/tests/web-http.test ("chunked encoding")["reads chunks without buffering", "reads across chunk boundaries"]: New tests. 2016-05-22 Ludovic Courtès tests: Use 'pass-if-equal' in web-http chunked encoding tests. * test-suite/tests/web-http.test ("chunked encoding"): Use 'pass-if-equal' where appropriate. 2016-05-22 Andy Wingo Speed up port position access from Scheme * libguile/ports-internal.h (scm_port_buffer_position): (scm_port_position_line, scm_port_position_set_line): (scm_port_position_column, scm_port_position_set_column): New helpers. (scm_t_port): Ports now hold position as a pair, so that Scheme can access it easily. (SCM_LINUM, SCM_COL, SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL) (SCM_DECCOL, SCM_TABCOL): Remove. * libguile/ports.c (make_port_buffer): Rename from scm_c_make_port_buffer, make static, and take port as an argument so we can initialize the position field. (initialize_port_buffers): Adapt make_port_buffer change. (scm_c_make_port_with_encoding): Initialize position. (update_port_position): Rename from update_port_lf, and operate on port position objects. (scm_ungetc): Operate on port position objects. (scm_setvbuf, scm_expand_port_read_buffer_x): Adapt to make_port_buffer change. (scm_lfwrite): Adapt to call update_port_position. (scm_port_line, scm_set_port_line_x, scm_port_column) (scm_set_port_column_x): Adapt to use port positions. * libguile/ports.h (scm_c_make_port_buffer): Remove internal decl. * libguile/read.c: Adapt to use scm_port_line / scm_port_column instead of SCM_LINUM et al. * module/ice-9/ports.scm (port-buffer-position, port-position-line) (port-position-column, set-port-position-line!) (set-port-position-column!): New accessors for the internals module. * module/ice-9/sports.scm (advance-port-position!): Rename from port-advance-position! and use the new accessors. (read-char, port-fold-chars/iso-8859-1): Adapt to use advance-port-position!. Implementation of read-delimited in Scheme * module/ice-9/sports.scm (port-fold-chars/iso-8859-1): (port-fold-chars, read-delimited, read-line, %read-line): Initial implementation of read-delimited. Sports refactor * module/ice-9/sports.scm (port-advance-position!): Factor out to a helper. (read-char): Use port-advance-position!. 2016-05-20 Andy Wingo Add install-sports!, uninstall-sports! functions * module/ice-9/sports.scm (install-sports!, uninstall-sports!): New functions. Support for non-blocking I/O * doc/ref/api-io.texi (I/O Extensions): Document read_wait_fd / write_wait_fd members. (Non-Blocking I/O): New section. * libguile/fports.c (fport_read, fport_write): Return -1 if the operation would block. (fport_wait_fd, scm_make_fptob): Add read/write wait-fd implementation. * libguile/ports-internal.h (scm_t_port_type): Add read_wait_fd / write_wait_fd. * libguile/ports.c (default_read_wait_fd, default_write_wait_fd): New functions. (scm_make_port_type): Initialize default read/write wait fd impls. (trampoline_to_c_read, trampoline_to_scm_read) (trampoline_to_c_write, trampoline_to_scm_write): To Scheme, a return of #f indicates EWOULDBLOCk. (scm_set_port_read_wait_fd, scm_set_port_write_wait_fd): New functions. (port_read_wait_fd, port_write_wait_fd, scm_port_read_wait_fd) (scm_port_write_wait_fd, port_poll, scm_port_poll): New functions. (scm_i_read_bytes, scm_i_write_bytes): Poll if the read or write would block. * libguile/ports.h (scm_set_port_read_wait_fd) (scm_set_port_write_wait_fd): Add declarations. * module/ice-9/ports.scm: Shunt port-poll and port-{read,write}-wait-fd to the internals module. * module/ice-9/sports.scm (current-write-waiter): (current-read-waiter): Implement. * test-suite/tests/ports.test: Adapt non-blocking test to new behavior. * NEWS: Add entry. 2016-05-18 Andy Wingo Fix sports.test * test-suite/tests/sports.test (include-tests): Fix encoding when reading ports.test. 2016-05-16 Andy Wingo Test Scheme port implementation * module/ice-9/ports.scm: Add port-decode-char to internals export list. * test-suite/Makefile.am: * test-suite/tests/sports.test: Add new test. U+FFFD is the input substitution character * libguile/ports.c (UNICODE_REPLACEMENT_CHARACTER): * libguile/ports.c (peek_utf8_codepoint) (scm_port_decode_char, peek_iconv_codepoint): * module/ice-9/sports.scm (peek-char-and-len/utf8): (peek-char-and-len/iconv): Return U+FFFD when we get a decoding error when reading, instead of '?', in accordance with Unicode recommendations. * test-suite/tests/iconv.test: * test-suite/tests/ports.test: * test-suite/tests/rdelim.test: Update tests. * NEWS: Update. Bump objcode version * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump for Guile 2.1.3. 2016-05-15 Andy Wingo Update NEWS for release * NEWS: Try to tell the port story better. 2016-05-14 Andy Wingo Remove unused type from ports-internal * libguile/ports-internal.h: Remove unused scm_t_port_rw_active. * libguile/deprecated.h (scm_port_rw_active): Remove deprecation shim, as this thing is just gone now. Document scm_c_make_port and friends * doc/ref/api-io.texi (I/O Extensions): Document scm_c_make_port and friends, and document "mode bits". Update port mode bits documentation. * libguile/ports.h: Update documentation of port mode bits. Add SCM_OPN to mode bits when making ports * libguile/ports.c (scm_c_make_port_with_encoding): Add SCM_OPN to mode bits, so that users don't have to. (scm_i_mode_bits_n): * libguile/print.c (scm_simple_format) * libguile/r6rs-ports.c (make_bytevector_input_port) (make_custom_binary_input_port, make_bytevector_output_port) (make_custom_binary_output_port, make_transcoded_port) * libguile/strports.c (scm_object_to_string, scm_open_input_string) (scm_open_output_string, scm_c_read_string): Remove now-unneeded SCM_OPN mentions. 2016-05-13 Andy Wingo Update port type documentation * doc/ref/api-io.texi (I/O Extensions): Update for port type change. 2016-05-13 Andy Wingo Use heap-allocated port types instead of ptobnums This removes a limitation on the number of port types, simplifies the API, and removes a central point of coordination. * libguile/ports-internal.h (struct scm_t_port_type): Rename from scm_t_ptob_descriptor, now that it's private. Add GOOPS class fields. (struct scm_t_port): Rename from struct scm_port, especially considering that deprecated.h redefines scm_port using the preprocessor :(. * libguile/ports.h: Add definitions of SCM_PORT and SCM_PORT_TYPE, though the scm_t_port and scm_t_port_type types are incomplete. (SCM_TC2PTOBNUM, SCM_PTOBNUM, SCM_PTOBNAME): Remove, as there are no more typecodes for port types. (scm_c_num_port_types, scm_c_port_type_ref, scm_c_port_type_add_x): Remove. (scm_make_port_type): Return a scm_t_port_type*. All methods adapted to take a scm_t_port_type* instead of a ptobnum. (scm_c_make_port_with_encoding, scm_c_make_port): Take a port type pointer instead of a tag. (scm_new_port_table_entry): Remove; not useful. * libguile/ports.c: Remove things related to the port kind table. Adapt uses of SCM_PORT_DESCRIPTOR / scm_t_ptob_descriptor to use SCM_PORT_TYPE and scm_t_port_type. * libguile/deprecated.c: * libguile/deprecated.h: * libguile/filesys.c: * libguile/fports.c: * libguile/fports.h: * libguile/print.c: * libguile/r6rs-ports.c: * libguile/strports.c: * libguile/strports.h: * libguile/tags.h: * libguile/vports.c: * test-suite/standalone/test-scm-c-read.c: Adapt to change. * libguile/goops.c (scm_class_of, make_port_classes) (scm_make_port_classes, create_port_classes): Adapt to store the classes in the ptob. 2016-05-13 Andy Wingo Make scm_t_ptob_descriptor private. * libguile/goops.c: Use port internals header. * libguile/ports-internal.h (scm_t_port_type_flags) (struct scm_t_ptob_descriptor): Make private. * libguile/ports.h: Adapt. Update port documentation * doc/ref/api-io.texi: Update for refactorings. Remove scm_t_port_internal * libguile/ports-internal.h (SCM_PORT): Rename from SCM_PTAB_ENTRY. (scm_t_port_internal, SCM_PORT_GET_INTERNAL): Remove. (SCM_FILENAME, SCM_SET_FILENAME, SCM_LINUM, SCM_COL): Adapt. * libguile/ports.c: * libguile/poll.c: * libguile/ioext.c: * libguile/fports.c: * libguile/filesys.c: * libguile/print.c: * libguile/read.c: * libguile/rw.c: * libguile/strings.c: Adapt. Make scm_t_port private * libguile/ports-internal.h (enum scm_port_encoding_mode): Remove unused enum. (scm_t_port_internal, scm_t_port): Make encoding and conversion_strategy private. Instead of scm_t_port_internal containing scm_t_port, now that all members are private, we can store the user's "stream" in a word in the port object itself and make the whole of scm_t_port private. The next commit will remove scm_t_port_internal. (SCM_PTAB_ENTRY, SCM_PORT_DESCRIPTOR): Make private. * libguile/ports.c (scm_c_make_port_with_encoding): Adapt to new port layout. (scm_port_print): Use SCM_PTAB_ENTRY when printing. * libguile/ports.h: Remove scm_t_port definition. * libguile/ioext.c (get_matching_port): Simplify. * libguile/fports.c (scm_i_evict_port): Simplify. Make port buffering fields private * libguile/ports-internal.h (enum scm_port_buffer_field) (scm_t_port_internal): Make port buffering fields private. * libguile/ports.h (scm_t_port): Adapt. * libguile/filesys.c (set_element): * libguile/ioext.c (scm_redirect_port): * libguile/poll.c (scm_primitive_poll): * libguile/ports.c: * libguile/read.c (scm_i_scan_for_encoding): * libguile/rw.c (scm_write_string_partial): Adapt users. Make file/line/column fields of ports private * libguile/ports-internal.h (scm_t_port_internal): Move file_name, line_number, and column_number here. (SCM_FILENAME, SCM_SET_FILENAME, SCM_LINUM, SCM_COL, SCM_INCLINE): (SCM_ZEROCOL, SCM_INCCOL, SCM_DECCOL, SCM_TABCOL): Make internal. * libguile/ports.c (scm_c_make_port_with_encoding) (scm_set_port_line_x, scm_set_port_column_x): Adapt to change. Embed scm_t_port in scm_t_port_internal * libguile/ports-internal.h (scm_t_port_internal) * libguile/ports.h (scm_t_port): Embed scm_t_port in scm_t_port_internal so that we have just one allocation. * libguile/ports-internal.h (SCM_PORT_GET_INTERNAL): Adapt. * libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x) (scm_c_make_port_with_encoding): Adapt. Remove SCM backlink in port structure * libguile/ports.h (scm_t_port): Remove port backlink. * libguile/ports.c (scm_c_make_port_with_encoding, scm_fill_input) (scm_seek): Adapt. Add random_access_p port type method * doc/ref/api-io.texi (I/O Extensions): Update documentation on implementing port types. Document get_natural_buffer_sizes. Document the new random_access_p. * libguile/fports.c (scm_i_fdes_to_port, fport_random_access_p): (scm_make_fptob): Instead of frobbing rw_random manually, implement a random_access_p function. * libguile/ports.c (default_random_access_p) (scm_set_port_random_access_p): New functions. scm_make_port_type, scm_c_make_port_with_encoding): Arrange for random_access_p to work. Add (ice-9 sports) module * module/ice-9/sports.scm: New module. * module/Makefile.am (SOURCES): Add new module. 2016-05-13 Andy Wingo Beginnings of shunting ports-in-scheme off to a module * libguile/ports.c (scm_specialize_port_encoding_x): Add some sanity checks. (scm_unget_bytes): Use scm_expand_port_read_buffer_x. (port_clear_stream_start_for_bom_read): Use scm_specialize_port_encoding_x. (scm_fill_input): Use scm_expand_port_read_buffer_x. (scm_expand_port_read_buffer_x): Rename from scm_set_port_read_buffer_x and actually expand the buffer. * libguile/ports.h: Adapt to scm_expand_port_read_buffer_x change. * module/ice-9/ports.scm: Remove ports-in-scheme stuff, and instead expose the ports internals via an auxiliary module. This will let ports-in-scheme live in a module during Guile 2.2. 2016-05-12 Andy Wingo Implement lookahead-u8, get-u8 in Scheme * module/ice-9/ports.scm (%lookahead-u8, %get-u8): Scheme implementations. 2016-05-10 Andy Wingo %read-char speedup * module/ice-9/ports.scm (%read-char): Always call update-position! with the same continuation, so that it will contify. Implement read-char in Scheme. * module/ice-9/ports.scm (%read-char): New function. %peek-char port argument optional. * module/ice-9/ports.scm (%peek-char): Port argument is optional. peek-char-and-len/iconv uses both returns from fill-input * module/ice-9/ports.scm (peek-char-and-len/iconv): Use buffered value from fill-input. Fix bad-utf8-len bug. * module/ice-9/ports.scm (bad-utf8-len): Fix bug. clear-stream-start-for-bom-read refactor * module/ice-9/ports.scm (clear-stream-start-for-bom-read): Use the "buffered" value that fill-input returns. Fix port-clear-stream-start-for-bom-read logic. * libguile/ports.c (scm_port_clear_stream_start_for_bom_read): Fix logic. Scheme peek-char can handle iconv encodings * module/ice-9/ports.scm (peek-char-and-len/iconv): Fully implement. Factor out iconv to port-decode-char * libguile/ports.c (scm_port_decode_char): New helper, exported to (ice-9 ports). (peek_iconv_codepoint): Use scm_port_decode_char. Simplify decoding error handling * libguile/ports.c (peek_utf8_codepoint, peek_latin1_codepoint): (peek_iconv_codepoint, peek_codepoint): Refactor to push error handling to the leaves, where errors happen. Just return the (possibly substituted) codepoint, without an error code; if there's really an error, we should raise it. (scm_getc, scm_peek_char): Adapt. Decoding errors do not advance read pointer * libguile/ports.c (scm_getc): If the port conversion strategy is 'error, signal an error before advancing the read pointer. This is a change from previous behavior; before, we advanced the read pointer under an understanding that that was what R6RS required. But, that seems to be not the case. * test-suite/tests/ports.test ("string ports"): Update decoding-error tests to assume that read-char with an error doesn't advance the read pointer. * test-suite/tests/rdelim.test ("read-line"): Likewise. Fix bug in trampoline_to_c_read * libguile/ports.c (trampoline_to_c_read): Fix bug comparing SCM values. 2016-05-07 Andy Wingo Speed refactors to Scheme %peek-char * module/ice-9/ports.scm (peek-bytes): New helper. (peek-byte): Use peek-bytes helper. (decoding-error): Don't inline; no need. (decode-utf8, bad-utf8-len): New helpers. (peek-char-and-len/utf8): Use new helpers. (peek-char-and-len): No fast paths, and not inline. Peek-char has its own fast path. (%peek-char): Use helpers to make fast path. Fix port-clear-stream-start-for-bom-read bug * libguile/ports.c (scm_port_clear_stream_start_for_bom_read): Fix to return SCM_BOOL_F instead of 0. 2016-05-05 Andy Wingo Fix use of port-encoding * module/ice-9/ports.scm (clear-stream-start-for-bom-read): Fix to use %port-encoding, which works in symbols. Speed up peek-char * module/ice-9/ports.scm (peek-char-and-len): Only inline fast path for UTF-8. Port to Scheme of new BOM handling * libguile/ports.c (scm_specialize_port_encoding_x) (scm_port_clear_stream_start_for_bom_read): New functions exported to (ice-9 ports). * module/ice-9/ports.scm (clear-stream-start-for-bom-read): (fill-input, peek-char-and-len): Rework to handle BOM in fill-input instead of once per peek-char. Handle BOM around fill/flush instead of peek/put * libguile/print.c (display_string_using_iconv): Remove BOM handling; this is now handled by scm_lfwrite. * libguile/ports.c (open_iconv_descriptors): Refactor to take encoding as a symbol. (prepare_iconv_descriptors): New helper. (scm_i_port_iconv_descriptors): Remove scm_t_port_rw_active argument, and don't sniff UTF-16/UTF-32 byte orders here. Instead BOM handlers will call prepare_iconv_descriptors. (scm_c_read_bytes): Call new port_clear_stream_start_for_bom_read helper. (port_maybe_consume_initial_byte_order_mark) (scm_port_maybe_consume_initial_byte_order_mark): Remove. Leaves Scheme %peek-char broken but it's unused currently so that's OK. (peek_iconv_codepoint): Fetch iconv descriptors after doing fill-input because it's fill-input that will sniff the BOM. (peek_codepoint): Instead of handling BOM at every character, handle in fill-input instead. (maybe_consume_bom, port_clear_stream_start_for_bom_read) (port_clear_stream_start_for_bom_write): New helpers. (scm_fill_input): Slurp a BOM if needed. (scm_i_write): Clear the start-of-stream-for-bom-write flag. (scm_lfwrite): Write a BOM if needed. 2016-05-04 Andy Wingo Spead tweaks to Scheme peek-char * module/ice-9/ports.scm: Speed tweaks to %peek-char. Ultimately somewhat fruitless; I can get 1.4s instead of 1.5s by only half-inlining the UTF-8 case though. Add integer->char and char->integer opcodes * libguile/vm-engine.c (integer_to_char, char_to_integer): New opcodes. * libguile/vm.c (vm_error_not_a_char): New error case. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/types.scm: * module/language/tree-il/compile-cps.scm (convert): * doc/ref/vm.texi (Inlined Scheme Instructions): * module/system/vm/assembler.scm: Add support for new opcodes. Initial peek-char implementation in Scheme * module/ice-9/ports.scm (EILSEQ, decoding-error, peek-char-and-len/utf8): (peek-char-and-len/iso-8859-1, peek-char-and-len/iconv): (peek-char-and-len, %peek-char): New definitions. Missing iconv1 for peek-char, but enough to benchmark. Port refactors to help Scheme peek-char * libguile/ports.h (scm_sys_port_encoding, scm_sys_set_port_encoding): New functions, to expose port encodings as symbols directly to (ice-9 ports). (scm_port_maybe_consume_initial_byte_order_mark): New function. * libguile/ports.c (scm_port_encoding): Dispatch to %port-encoding. (scm_set_port_encoding_x): Dispatch to %set-port-encoding!. (port_maybe_consume_initial_byte_order_mark): New helper, factored out of peek_codepoint. (scm_port_maybe_consume_initial_byte_order_mark, peek_codepoint): Call port_maybe_consume_initial_byte_order_mark. * module/ice-9/ports.scm (port-encoding): Implement in Scheme. Port conversion strategies internally are symbols * libguile/ports.h (scm_t_port): Represent the conversion strategy as a symbol, to make things easier for Scheme. Rename to "conversion_strategy". (scm_c_make_port_with_encoding): Change to take encoding and conversion_strategy arguments as symbols. (scm_i_string_failed_conversion_handler): New internal helper, to turn a symbol to a scm_t_string_failed_conversion_handler. (scm_i_default_port_encoding): Return the default port encoding as a symbol. (scm_i_default_port_conversion_strategy) (scm_i_set_default_port_conversion_strategy): Rename from scm_i_default_port_conversion_handler et al. Take and return Scheme symbols. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Use scm_i_default_string_failed_conversion_handler instead of scm_i_default_port_conversion_handler. * libguile/print.c (PORT_CONVERSION_HANDLER): Update definition. (print_normal_symbol): Use PORT_CONVERSION_HANDLER. * libguile/r6rs-ports.c (make_bytevector_input_port): (make_custom_binary_input_port, make_bytevector_output_port): Adapt to changes in scm_c_make_port_with_encoding. * libguile/strings.h: * libguile/strings.c (scm_i_default_string_failed_conversion_handler): New helper. (scm_from_locale_stringn, scm_from_port_stringn): (scm_to_locale_stringn, scm_to_port_stringn): Adapt to interface changes. * libguile/strports.c (scm_mkstrport): Adapt to scm_c_make_port_with_encoding change. * libguile/ports.c (scm_c_make_port): Adapt to scm_c_make_port_with_encoding change. (ascii_toupper, encoding_matches, canonicalize_encoding): Move down in the file. (peek_codepoint, get_codepoint, scm_ungetc): Adapt to port conversion strategy change. Remove duplicate case in get_codepoint. (scm_init_ports): Move symbol initializations to the same place. 2016-05-03 Andy Wingo Port encoding internally represented as symbol * libguile/ports-internal.h (scm_t_port_internal): Remove encoding_mode member. * libguile/ports.h (scm_t_port): "encoding" member is now a SCM symbol. * libguile/ports.c (scm_init_ports): Define symbols for the encodings that we handle explicitly. (encoding_matches): Adapt to check against an encoding as a symbol. (canonicalize_encoding): Return an encoding as a symbol. (scm_c_make_port_with_encoding, scm_i_set_default_port_encoding) (decide_utf16_encoding, decide_utf32_encoding) (scm_i_port_iconv_descriptors, scm_i_set_port_encoding_x) (scm_port_encoding, peek_codepoint, scm_ungetc): Adapt to encoding change. * libguile/print.c (display_string_using_iconv, display_string): * libguile/read.c (scm_read_character): * libguile/strings.c (scm_from_port_stringn, scm_to_port_stringn): Adapt to port encoding change. 2016-05-01 Andy Wingo Minor tweak to Scheme peek-byte. * module/ice-9/ports.scm (peek-byte): Use second return from fill-input. Changes to Scheme fill-input corresponding to C * module/ice-9/ports.scm (fill-input): Rewrite to make changes like the ones made to the C scm_fill_input: allow callers to specify a minimum amount of buffering. Char readers peek into read buffer * libguile/ports.c (scm_i_set_pending_eof): Remove now-unused helper. (peek_utf8_codepoint, peek_latin1_codepoint, peek_iconv_codepoint): (peek_codepoint): Refactor the fundamental character readers in Guile to peek into the read buffer instead of reading then unreading. This will allow Scheme to use the port buffer to convert, when we port this to Scheme. (get_codepoint): Use peek_codepoint. (scm_getc): Adapt. (scm_peek_char): Use peek_codepoint. scm_fill_input can guarantee a minimum fill amount * libguile/ports.h (scm_fill_input): Add "minimum_size" argument. Adapt all callers to pass 0 as this argument. * libguile/ports.c (scm_i_read): Inline into scm_fill_input. (scm_fill_input): "minimum_size" argument ensures that there are a certain number of bytes available, or EOF. Instead of shrinking the read buffer, only fill by the read_buffering amount, or the minimum_size, whichever is larger. * libguile/r6rs-ports.c: * libguile/read.c: Adapt scm_fill_input callers. 2016-04-30 Andy Wingo peek-byte in Scheme * libguile/ports.c (trampoline_to_c_read, trampoline_to_c_write): Since C might assume that the indices are within bounds of the bytevector, verify them more here. (scm_port_random_access_p, scm_port_read_buffering) (scm_set_port_read_buffer, scm_port_read, scm_port_write): New helpers exposed to (ice-9 ports). (scm_port_read_buffer, scm_port_write_buffer): Don't flush or validate port mode; we do that in Scheme. * module/ice-9/ports.scm: Implement enough of port machinery to implement peek-byte in Scheme. Not yet exported. Tweak port initialization order * libguile/init.c (scm_i_init_guile): Initialize ports before strports/fports, so that we have initialized the read/write trampolines before making port types. Refactor way the-eof-object is defined * libguile/ports.c (scm_init_ice_9_ports): Define the-eof-object here. Update a comment. * module/ice-9/ports.scm: Use the-eof-object definition from C. Add SCM port read/write functions * libguile/ports.h (scm_t_ptob_descriptor): Add "scm_read" and "scm_write" members, for calling from Scheme. (scm_set_port_scm_read, scm_set_port_scm_write): New procedures. * libguile/ports.c (trampoline_to_c_read_subr) (trampoline_to_c_write_subr): New static variables. * libguile/ports.c (scm_make_port_type): Initialize scm_read and scm_write members to trampoline to C. (trampoline_to_c_read, trampoline_to_scm_read) (trampoline_to_c_write, trampoline_to_scm_write): New helpers. (scm_set_port_scm_read, scm_set_port_scm_write): New functions. (default_buffer_size): Move definition down. (scm_i_read_bytes, scm_i_write_bytes): Use new names for read and write procedures. (scm_init_ports): Initialize trampolines. 2016-04-28 Andy Wingo Remove port locks * libguile/ports.h (scm_t_port): Remove lock field. (scm_dynwind_lock_port, scm_c_lock_port, scm_c_try_lock_port): Remove. * libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x): Remove locking. * libguile/ports.c (scm_c_make_port_with_encoding): Remove lock. (scm_i_read_bytes, scm_i_read, scm_i_write_bytes, scm_i_write): Remove "_unlocked" from names and adapt callers. Optimize peek-char * libguile/ports.c (scm_peek_char): Optimize. A loop calling peek-char on a buffered string port 10e6 times goes down from 50ns/iteration to 32ns/iteration. Remove port locking around write, display * libguile/print.c (scm_write, scm_display): * libguile/read.c (set_port_read_option): Remove port locking. Reading and writing to the same port from multiple threads just must not crash; it doesn't have to make sense. 2016-04-26 Andy Wingo scm_lfwrite, not scm_lfwrite_unlocked * libguile/ports.h (scm_lfwrite_unlocked): Remove. * libguile/ports.c (scm_lfwrite): Rename from scm_lfwrite_unlocked. * libguile/numbers.c: * libguile/print.c: Adapt to call scm_lfwrite. Remove scm_c_write_unlocked * libguile/ports.h (scm_c_write_bytes_unlocked): Remove. * libguile/ports.c (scm_c_write_bytes): Rename from scm_c_write_bytes_unlocked, make public, and return void. (scm_c_write): Rename from scm_c_write_unlocked. Remove locked variant. (scm_lfwrite_unlocked): Call scm_c_write. * libguile/rw.c (scm_write_string_partial): Call scm_c_write. Remove scm_puts_unlocked. * libguile/ports.h (scm_puts_unlocked): Remove. * libguile/ports.c (scm_puts): Replace implementation with scm_puts_unlocked's implementation. * libguile/arbiters.c: * libguile/backtrace.c: * libguile/bitvectors.c: * libguile/continuations.c: * libguile/deprecation.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/guardians.c: * libguile/hashtab.c: * libguile/hooks.c: * libguile/load.c: * libguile/macros.c: * libguile/mallocs.c: * libguile/print.c: * libguile/programs.c: * libguile/promises.c: * libguile/smob.c: * libguile/srcprop.c: * libguile/srfi-14.c: * libguile/stackchk.c: * libguile/struct.c: * libguile/threads.c: * libguile/throw.c: * libguile/values.c: * libguile/variable.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: Use scm_puts instead of scm_puts_unlocked. Remove scm_putc_unlocked. * libguile/ports.h (scm_putc_unlocked): Remove. * libguile/ports.c (scm_putc): Replace implementation with scm_putc_unlocked's implementation. (scm_port_print): Use scm_putc. * libguile/arbiters.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/hashtab.c: * libguile/hooks.c: * libguile/macros.c: * libguile/mallocs.c: * libguile/print.c: * libguile/programs.c: * libguile/promises.c: * libguile/r6rs-ports.c: * libguile/smob.c: * libguile/srcprop.c: * libguile/struct.c: * libguile/variable.c: * libguile/weak-set.c: * libguile/weak-table.c: Use scm_putc instead of scm_putc_unlocked. Remove scm_fill_input_unlocked * libguile/ports.h (scm_fill_input_unlocked): Remove. * libguile/ports.c (scm_fill_input): Rename from scm_fill_input_unlocked. Adapt callers. * libguile/r6rs-ports.c (scm_get_bytevector_some): Adapt. * libguile/read.c (scm_i_scan_for_encoding): Adapt. Remove locking in scm_end_input * libguile/ports.c (scm_end_input): Sadly, we can't naively lock around the scm_port_buffer_take, as it might throw. Will revisit in the future. 2016-04-23 Andy Wingo scm_ungetc, scm_ungets instead of _unlocked variants * libguile/ports.h (scm_ungetc_unlocked, scm_ungets_unlocked): Remove; replace with scm_ungetc, scm_ungets. * libguile/ports.c (scm_ungetc, scm_ungets, scm_unread_char) (scm_unread_string): Adapt. * libguile/rdelim.c (scm_read_delimited_x): Use scm_ungetc. * libguile/read.c: Unread characers with scm_ungetc, not scm_ungetc_unlocked. Remove scm_unget_{byte,bytes}_unlocked * libguile/ports.h (scm_unget_bytes_unlocked, scm_unget_byte_unlocked): Remove. * libguile/ports.c (looking_at_bytes): Use scm_unget_bytes instead of scm_i_unget_bytes_unlocked (scm_unget_bytes): Rename from scm_i_unget_bytes_unlocked. Remove other implementations of this function. (scm_unget_byte): Likewise. (scm_ungetc_unlocked, scm_peek_char): Use scm_unget_byte. * libguile/read.c (read_token): Use scm_unget_byte. Replace scm_getc with scm_getc_unlocked * libguile/ports.h (scm_getc_unlocked): Remove, or rather rename to scm_getc. This probably introduces some thread-related bugs but we'll fix them in a different way. * libguile/ports.c (scm_getc): Rename from scm_getc_unlocked, replacing the locky implementation. (scm_read_char): Use scm_getc. * libguile/r6rs-ports.c (scm_get_string_n_x): Use scm_getc. * libguile/rdelim.c (scm_read_delimited_x, scm_read_line): Use scm_getc. * libguile/read.c: Use scm_getc. Remove scm_c_read_bytes_unlocked * libguile/ports.c (scm_c_read_bytes_unlocked): Remove internal function. Remove scm_flush_unlocked / scm_end_input_unlocked * libguile/ports.h (scm_flush_unlocked, scm_end_input_unlocked): Remove. * libguile/ports.c (scm_c_read_bytes_unlocked): (scm_i_unget_bytes_unlocked, scm_setvbuf, scm_force_output) (scm_fill_input_unlocked, scm_c_write_bytes_unlocked) (scm_c_write_unlocked, scm_lfwrite_unlocked, scm_seek) (scm_truncate_file, flush_output_port): Call scm_flush / scm_end_input instead of the _unlocked variants. (scm_end_input): Lock while discarding the input buffer but not while calling out to the seek function. * libguile/filesys.c (scm_fsync): * libguile/ioext.c (scm_redirect_port): * libguile/read.c (scm_i_scan_for_encoding): * libguile/rw.c (scm_write_string_partial): Use scm_flush, not scm_flush_unlocked. 2016-04-22 Andy Wingo Remove port rw_active field * libguile/ports.h (scm_t_port_rw_active): Move type definition to ports-internal.h. (scm_t_port): Remove rw_active field. It's sufficient to check the port buffer cursors. * libguile/read.c (scm_i_scan_for_encoding): Just call scm_flush_unlocked; it's idempotent. * libguile/ports.c (scm_c_make_port_with_encoding): Remove rw_active field. (scm_c_read_bytes_unlocked, scm_c_read, scm_i_unget_bytes_unlocked) (scm_end_input_unlocked, scm_flush_unlocked, scm_fill_input_unlocked) (scm_port_write_buffer, scm_port_read_buffer) (scm_c_write_bytes_unlocked, scm_c_write_unlocked, scm_seek): Remove management of rw_active field. scm_c_read instead of scm_c_read_unlock * libguile/ports.h (scm_c_read_unlocked): Remove. * libguile/ports.c (scm_c_read): Rename from scm_c_read_unlocked. Remove old scm_c_read. Lock around access to the rw_active flag, and call scm_flush instead of scm_flush_unlocked, and scm_fill_input instead of scm_fill_input_unlocked. * libguile/read.c (scm_i_scan_for_encoding): Use scm_c_read instead of the _unlocked function. Refactor to internal get/peek-byte functions * libguile/ports.h (scm_get_byte_or_eof_unlocked) (scm_peek_byte_or_eof_unlocked): Remove inline functions. The important uses are in ports.c anyway and we will use a static function there. (scm_slow_get_byte_or_eof_unlocked) (scm_slow_peek_byte_or_eof_unlocked): Remove declarations without definitions. * libguile/ports.c (looking_at_bytes): Use scm_peek_byte_or_eof instead of the _unlocked variant. (get_byte_or_eof, peek_byte_or_eof): New static functions. (scm_get_byte_or_eof, scm_peek_byte_or_eof): Don't lock: the port buffer mechanism means that we won't crash. More comments to come. (get_utf8_codepoint, get_latin1_codepoint, get_iconv_codepoint): Use new static functions. * libguile/read.c (read_token, scm_read_semicolon_comment): Use scm_get_byte_or_eof, not scm_get_byte_or_eof_unlocked. Refactor thread safety for %port-property * libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x): Knowing that the critical section can't throw, use serial lock discipline. 2016-04-20 Andy Wingo Port buffers are Scheme values * libguile/ports-internal.h (scm_port_buffer_bytevector) (scm_port_buffer_cur, scm_port_buffer_set_cur) (scm_port_buffer_end, scm_port_buffer_set_end) (scm_port_buffer_has_eof_p, scm_port_buffer_set_has_eof_p): New helpers. * libguile/ports-internal.h (scm_port_buffer_size) (scm_port_buffer_reset, scm_port_buffer_reset_end) (scm_port_buffer_can_take, scm_port_buffer_can_put) (scm_port_buffer_can_putback, scm_port_buffer_did_take) (scm_port_buffer_did_put, scm_port_buffer_take_pointer) (scm_port_buffer_put_pointer, scm_port_buffer_take) (scm_port_buffer_put, scm_port_buffer_putback): Adapt to treat port buffers as SCM values and use helpers to access them. * libguile/ports.c (scm_i_clear_pending_eof, scm_i_set_pending_eof) (scm_c_make_port_buffer, scm_i_read_unlocked) (scm_c_read_bytes_unlocked, scm_i_unget_bytes_unlocked) (scm_setvbuf, scm_fill_input, scm_take_from_input_buffers) (scm_drain_input, scm_end_input_unlocked, scm_flush_unlocked) (scm_fill_input_unlocked, scm_i_write_unlocked) (scm_c_write_bytes_unlocked, scm_c_write_unlocked) (scm_char_ready_p): Adapt to treat port buffers as SCM values and use helpers to access them. (scm_port_read_buffer, scm_port_write_buffer): New functions, allowing (ice-9 ports) to access port buffers. * libguile/ports.h: Update comments on port buffers. Replace scm_t_port_buffer structure with a Scheme vector whose fields are enumerated by "enum scm_port_buffer_field". (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt these implementations to port buffer representation change. * libguile/r6rs-ports.c (scm_get_bytevector_some): * libguile/read.c (scm_i_scan_for_encoding): * libguile/rw.c (scm_write_string_partial): Port buffers are Scheme objects. 2016-04-19 Andy Wingo peek-u8 correctness and speed refactor * libguile/ports-internal.h (scm_port_buffer_size): Verify that the bytevector field is a bytevector, in anticipation of Schemification. (scm_port_buffer_can_take, scm_port_buffer_can_put) (scm_port_buffer_can_putback): Enforce invariants on cur and end here. (scm_port_buffer_did_take, scm_port_buffer_did_put): Relax to not call other functions. * libguile/ports.h (scm_get_byte_or_eof_unlocked) (scm_peek_byte_or_eof_unlocked): Refactor to call no functions on the fast path. Port buffer cur/next pointers are Scheme values * libguile/ports.h (scm_t_port_buffer): Change "cur" and "end" members to be SCM values, in preparation for changing port buffers to be Scheme vectors. (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt. * libguile/ports.c (scm_c_make_port_buffer): Initialize cur and end members. (looking_at_bytes): Use helper instead of incrementing cur. (scm_i_read_unlocked): Adapt to end type change. (CONSUME_PEEKED_BYTE): Use helper instead of incrementing cur. (scm_i_unget_bytes_unlocked): Use helper instead of comparing cur. (scm_i_write_unlocked): Fix for changing end/cur types. * libguile/read.c (scm_i_scan_for_encoding): Use helpers instead of addressing cursors directly. * libguile/rw.c (scm_write_string_partial): Likewise. * libguile/ports-internal.h (scm_port_buffer_reset): (scm_port_buffer_reset_end, scm_port_buffer_can_take): (scm_port_buffer_can_put, scm_port_buffer_can_putback): (scm_port_buffer_did_take, scm_port_buffer_did_put): (scm_port_buffer_take_pointer, scm_port_buffer_put_pointer): (scm_port_buffer_putback): Adapt to data types. 2016-04-18 Andy Wingo Remove "buf" field from port buffers * libguile/ports-internal.h (scm_port_buffer_reset_end): New helper. (scm_port_buffer_putback): New helper. * libguile/ports.h (scm_t_port_buffer): Remove "buf" field. (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt. * libguile/ports.c (scm_c_make_port_buffer): No more "buf" field. (scm_i_unget_bytes_unlocked): Use helper. * libguile/read.c (scm_i_scan_for_encoding): No more "buf" field. 2016-04-17 Andy Wingo Remove size field from port buffers * libguile/ports.h (scm_t_port_buffer): Remove size field. Instead use bytevector size. * libguile/ports-internal.h (scm_port_buffer_size) (scm_port_buffer_reset) (scm_port_buffer_can_take, scm_port_buffer_can_put) (scm_port_buffer_did_take, scm_port_buffer_did_put) (scm_port_buffer_take_pointer, scm_port_buffer_put_pointer) (scm_port_buffer_take, scm_port_buffer_put): New helpers. * libguile/filesys.c (set_element): Use new helpers. * libguile/poll.c (scm_primitive_poll): Use new helpers. * libguile/ports.c (scm_c_make_port_buffer): No more "size" field. (scm_i_read_unlocked, scm_c_read_bytes_unlocked) (scm_c_read_unlocked, scm_i_unget_bytes_unlocked) (scm_unget_bytes, scm_setvbuf, scm_take_from_input_buffers) (scm_drain_input, scm_end_input_unlocked, scm_flush_unlocked) (scm_fill_input_unlocked, scm_i_write_unlocked) (scm_c_write_bytes_unlocked, scm_c_write_unlocked) (scm_char_ready_p): Use new helpers. * libguile/r6rs-ports.c (scm_get_bytevector_some): Use new helpers. * libguile/rw.c (scm_write_string_partial): Use new helpers. Port buffer has-eof? field is SCM value * libguile/ports.h (scm_t_port_buffer): Rename has_eof member to has_eof_p, and be a Scheme value, in anticipation of moving the port buffers to be Scheme objects. Remove unrelated scm_t_port_buffer use in vports * libguile/vports.c (struct soft_port): Inline the encoding buffer so as to not use scm_t_port_buffer, in anticipation of changing the port buffer representations. Adapt users. 2016-04-15 Andy Wingo Load port bindings in separate (ice-9 ports) module * module/ice-9/ports.scm: New file. * am/bootstrap.am (SOURCES): Add ice-9/ports.scm. * libguile/fports.c (scm_init_ice_9_fports): New function. (scm_init_fports): Arrange for scm_init_ice_9_fports to be called via load-extension, and load snarfed things there. Move open-file definition early, to allow ports to bootstrap. * libguile/ioext.c (scm_init_ice_9_ioext): New function. (scm_init_ioext): Similarly, register scm_init_ice_9_ioext as an extension. * libguile/ports.c (scm_set_current_input_port) (scm_set_current_output_port, scm_set_current_error_port): Don't define Scheme bindings; do that in Scheme. * libguile/ports.c (scm_i_set_default_port_encoding): (scm_i_default_port_encoding, scm_i_default_port_conversion_handler): (scm_i_set_default_port_conversion_handler): Since we now init encoding early, remove the "init" flags on these encoding/strategy vars. (scm_init_ice_9_ports): New function. (scm_init_ports): Register scm_init_ice_9_ports extension, and define some bindings needed by the bootstrap. * module/Makefile.am (SOURCES): Add ice-9/ports.scm. * module/ice-9/boot-9.scm: Remove code that's not on the boot path, moving it to ice-9/ports.scm. At the end, load (ice-9 ports). * module/ice-9/psyntax.scm (include): Use close-port instead of close-input-port. * module/ice-9/psyntax-pp.scm (include): Regenerate. 2016-04-14 Andy Wingo Fix R6RS imports of interfaces that use interfaces * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): In Guile, a module's public interface is just another module, and that means that it can import other modules as well. Allow for R6RS modules that import module whose interfaces import other modules to access all visible bindings. * test-suite/tests/rnrs-libraries.test ("import features"): Update test. Fix scm_init_struct dependency on port conversion handlers * libguile/struct.c (scm_init_struct): Use scm_from_latin1_string to avoid locale-dependency for what is really a latin1 string. Also avoids an early dependency on the default port conversion handler, though I wonder if using port conversion handlers in strings is the right thing. 2016-04-13 Andy Wingo Fix error in exception printer when bootstrapping * module/ice-9/boot-9.scm (exception-printers): Fix error in which, for a pure bootstrap with no compiled files, the exception printer would use false-with-exception before it has been defined, which doesn't work for macros. We wouldn't see this problem normally because, oddly, the macro is indeed defined normally because of boot reasons. 2016-04-12 Andy Wingo Allow port "write" functions to only write a chunk * libguile/ports.c (scm_i_write_bytes_unlocked): Allow incomplete writes from the implementation. (scm_c_write_bytes_unlocked): Use scm_i_write_bytes_unlocked helper to call the write function. * libguile/r6rs-ports.c (custom_binary_output_port_write): Don't loop; core Guile will do that. Update port implementation documentation. * doc/ref/api-io.texi (I/O Extensions): Update read/write documentation. 2016-04-11 Andy Wingo Port read/write functions take bytevectors This will allow better Scheme integration for ports. * libguile/ports.h (scm_t_port_buffer): Change "holder" member to be a bytevector defined to have "buf" as its starting point. (scm_t_ptob_descriptor): Change read and write functions to take bytevectors as arguments and to return the number of octets read or written. (scm_make_port_type): Adapt accordingly. (scm_c_read_bytes, scm_c_write_bytes): New functions that take bytevectors. * libguile/ports.c (scm_make_port_type): Adapt to read/write function prototype change. (scm_c_make_port_buffer): Arrange to populate the "bytevector" field. (scm_i_read_bytes_unlocked): New function. (scm_i_read_unlocked): Use scm_i_read_bytes_unlocked. (scm_c_read_bytes_unlocked): New function. (scm_c_read_unlocked): Update comment, and always go through the buffer. (scm_c_read_bytes): New function. (scm_flush_unlocked): Use scm_i_write_unlocked instead of the port's write function. (scm_i_write_bytes_unlocked): New function. (scm_i_write_unlocked): Use scm_i_write_bytes_unlocked. (scm_c_write_bytes_unlocked): New function. (scm_c_write_unlocked): Always write through the buffer. (scm_c_write_bytes): New function. (scm_truncate_file): Remove unused variable. (void_port_read, void_port_write): Adapt to read/write prototype change. * libguile/fports.c (fport_read, fport_write): * libguile/r6rs-ports.c (bytevector_input_port_read) (custom_binary_input_port_read, bytevector_output_port_write) (custom_binary_output_port_write, transcoded_port_write) (transcoded_port_read): Adapt to read/write prototype change. (scm_get_bytevector_n, scm_get_bytevector_n_x) (scm_get_bytevector_all): Use scm_c_read_bytes. (scm_put_bytevector): Use scm_c_write_bytes. * libguile/strports.c (string_port_read, string_port_write): * libguile/vports.c (soft_port_write, soft_port_read): Adapt to read/write prototype change. * test-suite/standalone/test-scm-c-read.c (custom_port_read): Fix for read API change. 2016-04-11 Andy Wingo make-chunked-output-port buffering fix * module/web/http.scm (make-chunked-output-port): Add #:buffering argument, defaulting to 1200 (some random value under the MTU). This will force a flush every so often, and not every character as would otherwise be the case after this port rewrite. 2016-04-08 Andy Wingo Fold 2.1.2 NEWS items into cumulative 2.2 NEWS * NEWS: Update. Update NEWS for changes to port buffering. * NEWS: Update. 2016-04-06 Andy Wingo Generic port facility provides buffering uniformly * libguile/ports.h (struct scm_t_port_buffer): New data type. (struct scm_t_port): Refactor to use port buffers instead of implementation-managed read and write pointers. Add "read_buffering" member. (SCM_INITIAL_PUTBACK_BUF_SIZE, SCM_READ_BUFFER_EMPTY_P): Remove. (scm_t_ptob_descriptor): Rename "fill_input" function to "read", and take a port buffer, returning void. Likewise "write" takes a port buffer and returns void. Remove "end_input"; instead if there is buffered input and rw_random is true, then there must be a seek function, so just seek back if needed. Remove "flush"; instead all calls to the "write" function implicitly include a "flush", since the buffering happens in the generic port code now. Remove "setvbuf", but add "get_natural_buffer_sizes"; instead the generic port code can buffer any port. (scm_make_port_type): Adapt to read and write prototype changes. (scm_set_port_flush, scm_set_port_end_input, scm_set_port_setvbuf): Remove. (scm_slow_get_byte_or_eof_unlocked) (scm_slow_get_peek_or_eof_unlocked): Remove; the slow path is to call scm_fill_input. (scm_set_port_get_natural_buffer_sizes): New function. (scm_c_make_port_buffer): New internal function. (scm_port_non_buffer): Remove. This was a function for implementations that is no longer needed. Instead open with BUF0 or use (setvbuf port 'none). (scm_fill_input, scm_fill_input_unlocked): Return the filled port buffer. (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt to changes in buffering and EOF management. * libguile/ports.c: Adapt to port interface changes. (initialize_port_buffers): New function, using the port mode flags to set up appropriate initial buffering for all ports. (scm_c_make_port_with_encoding): Create port buffers here instead of delegating to implementations. (scm_close_port): Flush the port if needed instead of delegating to the implementation. * libguile/filesys.c (set_element): Adapt to buffering changes. * libguile/fports.c (fport_get_natural_buffer_sizes): New function, replacing scm_fport_buffer_add. (fport_write, fport_read): Update to let the generic ports code do the buffering. (fport_flush, fport_end_input): Remove. (fport_close): Don't flush in a dynwind; that's the core ports' job. (scm_make_fptob): Adapt. * libguile/ioext.c (scm_redirect_port): Adapt to buffering changes. * libguile/poll.c (scm_primitive_poll): Adapt to buffering changes. * libguile/ports-internal.h (struct scm_port_internal): Remove pending_eof flag; this is now set on the read buffer. * libguile/r6rs-ports.c (struct bytevector_input_port): New type. The new buffering arrangement means that there's now an intermediate buffer between the bytevector and the user of the port; this could lead to a perf degradation, but on the other hand there are some other speedups enabled by the buffering refactor, so probably the memcpy cost is dwarfed by the cost of the other parts of the ports machinery. (make_bytevector_input_port, bytevector_input_port_read): (bytevector_input_port_seek, initialize_bytevector_input_ports): Adapt to new buffering arrangement. (struct custom_binary_port): Remove read buffer, as Guile handles that now. (custom_binary_input_port_setvbuf): Remove; now handled by Guile. (make_custom_binary_input_port, custom_binary_input_port_read) (initialize_custom_binary_input_ports): Adapt. (scm_get_bytevector_some): Adapt to new EOF management. (scm_t_bytevector_output_port_buffer): Hold on to the underlying port, so we can flush it if it's open. (make_bytevector_output_port, bytevector_output_port_write): (bytevector_output_port_seek): Adapt. (bytevector_output_port_procedure): Flush the port as appropriate, so that we get all the bytes. (make_custom_binary_output_port, custom_binary_output_port_write): Adapt. (make_transcoded_port): Don't muck with buffering. (transcoded_port_write): Simply forward the write to the underlying port. (transcoded_port_read): Likewise. (transcoded_port_close): No need to flush. (initialize_transcoded_ports): Adapt. * libguile/read.c (scm_i_scan_for_encoding): Adapt to buffering changes. * libguile/rw.c (scm_write_string_partial): Adapt to buffering changes. * libguile/strports.c: Adapt to the fact that we don't manage the buffer. Probably room for speed improvements here... * libguile/vports.c (soft_port_get_natural_buffer_sizes): New function. Adapt the rest of the file for the new buffering regime. * test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Custom binary output ports need to be flushed before you can rely on the write! procedure having been called. Add necessary flush-port invocations. ("8.2.6 Input and output ports"): Transcoded ports now have an internal buffer by default. This test checks that the characters are transcoded one at a time, so to do that, call setvbuf on the transcoded port to remove the buffer. * test-suite/tests/web-client.test (run-with-http-transcript): Fix for different flushing regime on soft ports. (The vestigial flush procedure is now called after each write, which is not what the test was expecting.) * test-suite/standalone/test-scm-c-read.c: Update for changes to the C interface for defining port types. * doc/ref/api-io.texi (Ports): Update to discuss buffering in a generic way, and to remove a hand-wavey paragraph describing string ports as "interesting and powerful". (Reading, Writing): Remove placeholder comments. Document `scm_lfwrite'. (Buffering): New section. (File Ports): Link to buffering. (I/O Extensions): Join subnodes into parent and describe new API, including buffering API. * doc/ref/posix.texi (Ports and File Descriptors): Link to buffering. Remove unread-char etc, as they are documented elsewhere. (Pipes, Network Sockets and Communication): Link to buffering. 2016-04-05 Andy Wingo Port close functions return void * libguile/ports.h (scm_t_ptob_descriptor): The port close function now returns void. (scm_set_port_close): Adapt prototype. * libguile/ports.c (scm_close_port): Always return true if we managed to call the close function. There's no other sensible result; exceptions are handled, well, exceptionally. * libguile/fports.c (fport_close) * libguile/r6rs-ports.c (custom_binary_port_close, transcoded_port_close): * libguile/vports.c (soft_port_close): Adapt. * doc/ref/api-io.texi (Port Implementation): Update. 2016-04-05 Andy Wingo When making soft port, parse handlers into struct * libguile/vports.c (struct soft_port): New data structure. (scm_make_soft_port): Unpack vector into struct when making soft port. (soft_port_input_waiting, soft_port_close, soft_port_fill_input): (soft_port_write, soft_port_flush): Adapt. Remove an extraneous errno=0 in soft_port_close. 2016-04-04 Andy Wingo Cosmetic changes to vports.c * libguile/vports.c (soft_port_flush): Rename from sf_flush, and similar changes following. Fix POLLOUT assignment from port buffers * libguile/poll.c (scm_primitive_poll): A buffered port's buffer marks it as writable only when writing a byte would not block, which is the case only if there is more than one byte free in the buffer; writing the last byte would block. Flush buffered reads / writes before seeking * libguile/ports.c (scm_seek): Flush before seeking on a buffered port. * libguile/fports.c (fport_seek): * libguile/strports.c (st_seek): Remove code to flush buffers. * test-suite/tests/ports.test: Update test expectations that the putback buffer is flushed on a seek. Previously there was a special case for SEEK_CUR with an offset of 0 to avoid flushing buffers, but that's an arbitrary choice that differs from all other combinations of OFFSET and WHENCE. Whitespace fixes * libguile/ports.c: Fix whitespaces introduced when adding the port lock. Refactor to rw_random / rw_active port flags * libguile/fports.c (fport_flush, fport_end_input): Move rw_active handling to ports.c. * libguile/ioext.c (scm_redirect_port): Use scm_flush_unlocked instead of calling the flush function directly. * libguile/ports.c (scm_c_make_port_with_encoding): Ports default to "rw_random" mode when they have a seek function. (scm_c_read_unlocked, scm_i_unget_bytes_unlocked) (scm_slow_get_byte_or_eof_unlocked) (scm_slow_peek_byte_or_eof_unlocked): Flush write buffer and set rw_active always in the same way, and only if rw_random is true. (scm_end_input_unlocked, scm_flush_unlocked): Clear rw_active here unconditionally. (scm_c_write_unlocked): Flush read buffer and set rw_active always in the same way, but only if rw_random is true. (scm_c_write, scm_lfwrite): Whitespace fixes. (scm_lfwrite_substr): Don't flush read buffer; lower-level code will do this. (scm_truncate_file): Use scm_flush_unlocked instead of calling the flush function directly. * libguile/r6rs-ports.c (transcoded_port_flush): Don't muck with rw_active. * libguile/read.c (scm_i_scan_for_encoding): Flush write buffer if needed in same way as ports.c. * libguile/strports.c (st_end_input): Don't muck with rw_active. (scm_mkstrport): rw_random defaults to 1 now. Custom binary port internals refactor * libguile/r6rs-ports.c (struct custom_binary_port): Use a struct instead of a vector as the state for a custom binary port. Adapt all callers. Some whitespace fixes as well. Cosmetic changes to r6rs-ports.c * libguile/r6rs-ports.c: Expand out the acronyms "bip", "bop", "cbip", "cbop", and "tp". They always confused me, especially that the "b" in cbip/cbop wasn't the same as the one in bip/bop. Remove port equal functions * doc/ref/api-io.texi (Port Implementation): Remove mention of port equal functions. * NEWS: Update. * libguile/ports.c (scm_set_port_equalp): Remove. * libguile/ports.h (scm_t_ptob_descriptor): Remove equalp function. Remove port free functions; just close instead * libguile/ports.h (scm_t_port_type_flags): Replace SCM_PORT_TYPE_HAS_FLUSH with SCM_PORT_TYPE_NEEDS_CLOSE_ON_GC. (scm_t_ptob_descriptor): Remove free function. * libguile/ports.c (scm_set_port_needs_close_on_gc): New function. (scm_set_port_flush): Don't set flags. (scm_c_make_port_with_encoding, scm_close_port): Use the new flag to determine when to add a finalizer and also when to include the port in the weak set. (scm_set_port_free): Remove. (do_close, finalize_port): Close port instead of calling free function. * libguile/r6rs-ports.c (initialize_transcoded_ports): * libguile/vports.c (scm_make_sfptob): * libguile/fports.c (scm_make_fptob): Mark these ports as needing close on GC. * libguile/fports.c (fport_free): Remove. * NEWS: Update. * doc/ref/api-io.texi (Port Implementation): Update. Remove port mark functions * doc/ref/api-io.texi (Port Implementation): Remove documentation. * libguile/ports.c (scm_set_port_mark): Remove function. * libguile/ports.h (scm_t_ptob_descriptor): Remove mark function. * NEWS: Add entry. Move line-buffing machinery to ports.c * libguile/ports.c (scm_lfwrite_unlocked): * libguile/fports.c (fport_write): Move line-buffering from fport_write to scm_lfwrite_unlocked. Use symbols instead of _IONBF values as args to setvbuf * libguile/ports.c (scm_setvbuf): Use the symbols `none', `line', and `block' instead of the values `_IONBF', `_IOLBF', and `_IOFBF'. * NEWS: Update. * doc/ref/posix.texi (Ports and File Descriptors): Update setvbuf documentation. * module/ice-9/deprecated.scm (define-deprecated): New helper. (_IONBF, _IOLBF, _IOFBF): Define deprecated values. * benchmark-suite/benchmarks/read.bm ("read"): * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): * libguile/r6rs-ports.c (cbip_fill_input): * module/system/base/types.scm (%ffi-memory-backend): * module/web/client.scm (open-socket-for-uri): * module/web/server/http.scm (http-read): * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): ("setvbuf"): * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Update to use non-deprecated interfaces. Move setvbuf impl to ports.[ch] * libguile/fports.h (scm_setbuf0): Remove extraneous declaration. * libguile/fports.c: * libguile/ports.c: * libguile/ports.c (scm_setvbuf): Move setvbuf to ports.[ch]. (scm_init_ports): Move _IONBF, _IOLBF, _IOFBF definitions here. display-{application,-backtrace} delegate to Scheme * libguile/backtrace.h: * libguile/backtrace.c (print_frame_var, kw_count, print_frames_var) (frame_to_stack_vector_var): New variables. (init_print_frame_var) (init_print_frames_var_and_frame_to_stack_vector_var): New functions. (scm_set_print_params_x): Remove function. (scm_display_application): Delegate to print-frame. (display_backtrace_body, scm_display_backtrace_with_highlights): Delegate to print-frames. Fix frame->stack-vector when no stack is active * module/system/repl/debug.scm (frame->stack-vector): Handle the case where there is no active stack. 2016-03-14 Andy Wingo Fix lower-bound saturation in type inference * module/language/cps/types.scm (type-entry-saturating-union): Fix range saturation in the negative direction. Previously we were artificially truncating negative range ends to zero. 2016-02-03 Andy Wingo Release v2.1.2 * GUILE-VERSION (GUILE_MICRO_VERSION): Bump to 2.1.2. 2016-02-02 Andy Wingo Fix frame-call-representation for change to . * module/system/vm/frame.scm (frame-call-representation): Fix for change to . 2016-02-01 Andy Wingo Document new VM instructions * doc/ref/vm.texi (Stack Layout): Add a note about unboxed values. (Instruction Set): Update for new instructions. Update NEWS. * NEWS: Update. 2016-02-01 Andy Wingo Update statprof documentation; deprecate `with-statprof' * module/statprof.scm: Remove most of the commentary, as it was duplicated in the manual and was getting out of date. (stats): Remove self-secs-per-call and cum-secs-per-call fields as they can be computed from the other fields. (statprof-call-data->stats): Adapt. (statprof-stats-self-secs-per-call): (statprof-stats-cum-secs-per-call): New functions. (statprof-display/flat): Don't print the seconds-per-call fields, as we are no longer stopping the clock around call counters. Anyway these times were quite misleading. (with-statprof): Deprecate. It took its keyword arguments at the beginning; very complicated! Better to use the `statprof' function. (`statprof' was introduced after `with-statprof' and then `with-statprof' was adapted to use it.) * doc/ref/statprof.texi (Statprof): Port this documentation away from the automatically generated text and update it for the new interfaces like #:display-style. * module/system/base/syntax.scm (record-case): Remove comment that referenced with-statprof. Add comment indicating that record-case should be replaced. * doc/ref/scheme-using.texi (Profile Commands): Update to mention keyword arguments and to link to the statprof documentation. 2016-02-01 Andy Wingo Better call-counting profiles in statprof * module/statprof.scm: Update commentary. (count-call): Don't bother stopping and starting the timer. The overhead of call counting perturbs timing too much already, and somewhat paradoxically stopping and starting the timer takes too much time. (skip-count-call): New function. (stack-samples->procedure-data, stack-samples->callee-lists): If we are counting calls, skip any part of the stack that is inside count-call. 2016-01-31 Andy Wingo Frame objects capture frame, can ref value directly * module/system/repl/debug.scm (print-locals): Adapt to frame-binding-ref change. * module/system/vm/frame.scm (): Add `frame' field. (available-bindings): Capture the frame. (binding-ref, binding-set!): New functions, accessing a local variable value directly from a frame. (frame-binding-ref, frame-binding-set!): Remove. As these are very low-level debugging interfaces introduced in 2.0, never documented, and quite tied to the VM, we feel comfortable making this change. (frame-call-representation): Adapt to available-bindings change. (frame-environment, frame-object-binding): Adapt to binding-ref interface change. * doc/ref/vm.texi (Stack Layout): Mention that slots can be re-used. Update disassembly in example. * doc/ref/api-debug.texi (Frames): Remove documentation for frame-local-ref, frame-local-set!, and frame-num-locals. Replace with documentation for frame-bindings, binding accessors, and binding-ref / binding-set!. 2016-01-31 Andy Wingo Remove frame-local-ref, frame-local-set! * libguile/frames.h (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x): Remove. As long as we are changing the interface in a backward-incompatible way, we might as well remove these. * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x, scm_init_frames_builtins, scm_init_frames): Arrange to make frame-local-ref et al private to frames.scm. * module/system/vm/frame.scm: Load scm_init_frames_builtins extensions. (frame-instruction-pointer-or-primitive-procedure-name): New public function. (frame-binding-ref, frame-binding-set!): Allow binding objects as vars. * module/system/repl/debug.scm (print-locals): Pass binding directly to frame-binding-ref. * module/statprof.scm (sample-stack-procs, count-call): Use new frame-instruction-pointer-or-primitive-procedure-name function. 2016-01-29 Andy Wingo Dist the prebuilt .go files * prebuilt/i686-pc-linux-gnu/Makefile.am: * prebuilt/mips-unknown-linux-gnu/Makefile.am: * prebuilt/x86_64-unknown-linux-gnu/Makefile.am: Actually dist the .go files. Fix uniform vector compilation to foreign byte orders. * module/system/vm/assembler.scm (define-byte-order-swapper): New helper. (byte-swap/2!, byte-swap/4!, byte-swap/8!): New functions. (link-data): Swap bytes in uniform vectors on foreign byte orders. 2016-01-29 Andy Wingo Distribute prebuilt bootstraps for common hosts * am/bootstrap.am: New file, factored out of bootstrap/Makefile.am. * bootstrap/Makefile.am: Use bootstrap.am. * prebuilt/Makefile.am: * prebuilt/i686-pc-linux-gnu/Makefile.am: * prebuilt/mips-unknown-linux-gnu/Makefile.am: * prebuilt/x86_64-unknown-linux-gnu/Makefile.am: New files. * configure.ac: Output the prebuilt/ makefiles. * Makefile.am: Descend into prebuilt/ when making dist. * meta/uninstalled-env.in: Arrange to put prebuilt/ in the beginning of the GUILE_LOAD_COMPILED_PATH. Also fix a case where bootstrap/ wasn't being correctly added to the load path. 2016-01-29 Andy Wingo Fix cross-compilation of immediates to targets with different word sizes * module/system/vm/assembler.scm (immediate-bits): Rename from immediate?, and return the bits. Take asm argument so that we measure what's an immediate not on the host but for the target. Adapt all callers. (write-immediate): Take bits instead of SCM object. Adapt callers. (write-placeholder): New helper, to write bits for #f. Adapt callers that wrote #f to use write-placeholder. 2016-01-17 Andy Wingo Fix type inference of integer division * module/language/cps/types.scm (define-binary-result!): Fix inference of integer division. 2016-01-11 Andy Wingo statprof: Better tree-format profiles * module/statprof.scm (statprof-fetch-call-tree): Add #:precise? keyword argument, defaulting to false. Search for cycles after computing printable source locations instead of doing so over addresses -- it could be that two addresses map to the same source location, and from the user's perspective they are then indistinguishable in the printout. statprof: Add tree #:display-style. * module/statprof.scm (statprof-display/flat): Rename from statprof-display. Use real format; we have it. (statprof-display-anomalies): Likewise use real format. (procedure=?): Remove unused function. (collect-cycles): New helper. (statprof-fetch-call-tree): Fix to root the trees correctly -- it was interpreting them in the wrong order. Detect cycles so that it's not so terrible. Use precise locations for source locations. Probably need to add an option to go back to the per-function behavior. (statprof-display/tree): New helper, uses statprof-fetch-call-tree to display a profile in a nested tree. (statprof-display): Add #:style argument, which can be `flat', `anomalies', or `tree'. (statprof): Add #:display-style argument, proxying to #:style, defaulting to 'flat. 2016-01-07 Andy Wingo web: Be less strict when parsing entity tags. * module/web/http.scm (parse-entity-tag): Be less strict, accepting unquoted strings as well. * test-suite/tests/web-http.test ("response headers"): Add a test for etag parsing. 2016-01-04 Andy Wingo Remove unused function in simplify.scm * module/language/cps/simplify.scm (intset-add*): Remove unused function. Inline some helpers in intset.scm. * module/language/cps/intset.scm (round-down): Inline. (clone-branch-and-set): Inline, and inline the vector-move-left!. Include missing #:simplify? option in (language cps optimize). * module/language/cps/optimize.scm (cps-default-optimization-options): Add missing #:simplify? option. Otherwise the simplification pass was running even at -O0. 2016-01-03 Andy Wingo Don't serialize build through psyntax-pp.scm * bootstrap/Makefile.am: Don't serialize the build through psyntax-pp.scm. On a multicore make, this will result in higher total CPU time as multiple processes use an interpreted expander, but lower total build time, as all processes will take approximately the same time to load and run the compiler. Better CPS conversion for tests in tests * module/language/tree-il/compile-cps.scm (convert): Tests in tests have their consequents and alternates also converted in test context. Better partial evaluation of tests in tests * module/language/tree-il/peval.scm (peval): In test context, fold (let ((x EXP)) (if x x ALT)) to (if EXP #t ALT). This reduces the number of boolean literals that the compiler has to reify, by causing EXP to evaluate in test context instead of value context. Also, rotate `let' out of the test part of conditionals, for the same reason. Better folding of branches on $values * module/language/cps/type-fold.scm (local-type-fold): Fold branches on $values, if we can. Eta-reduce branches * module/language/cps/simplify.scm (compute-eta-reductions): Eta-reduce branches as well, so that passing a constant to a branch will fold to the true or false branch, provided that the test variable was just used in the branch. 2015-12-30 Andy Wingo Fix module for reification of srfi-4 primitives * module/language/cps/reify-primitives.scm (primitive-module): Add cases for SRFI-4 primitives. These primitives are only treated as such for the purposes of Tree-IL primitive expansion; perhaps the right fix is elsewhere, but it's here for now. 2015-12-26 Andy Wingo Type inference copes better with unsorted graphs * module/language/cps/types.scm (&min/0, &min/s64, &max/s64, &max/size) (&max/u64, &max/vector): New clamped variable range accessors. Use them in type inferrers. Fix bug in intmap-map * module/language/cps/utils.scm (intmap-map): Use transient intmap-add! on an empty intmap to build the result instead of intmap-replace! on the argument. Avoids spooky action-at-a-distance mutation of the argument if it happens to be a transient -- although the intmap-fold will correctly traverse a snapshot of the argument and the result will be correct, the argument value would be modified in place, causing strange results to calling code that passes in a transient. Assembler O(n) in instruction encodings, not instruction count * module/system/vm/assembler.scm: Change define encoders for all of the kinds of instructions and have the emit-foo procedures call the common encoders. No change to public interface. This decreases the amount of generated code in the assembler. Fix emit-receive* for many locals * module/system/vm/assembler.scm (emit-receive*): Fix to use FP-relative move instead of SP-relative move. 2015-12-26 Andy Wingo Assembler works on byte offsets, not u32 offsets * module/system/vm/assembler.scm (u32-ref, u32-set!, s32-ref, s32-set!): Remove these helpers. * module/system/vm/assembler.scm (): Track offsets in bytes, not u32 units. (emit, assembler, process-relocs, process-labels, link-text-object) (link-frame-maps, link-symtab, write-arities, link-docstrs) (link-procprops, link-debug): Adapt. * module/system/vm/linker.scm (process-reloc): Add addend before dividing by 4 for rel32/4 symbols. 2015-12-16 Andy Wingo Fix build when threads are disabled * module/language/cps/intmap.scm: Remove srfi-18 import. We just need current-thread which is actually defined in (guile), and importing (srfi srfi-18) raises an error if Guile is compiled without threads support. 2015-12-03 Andy Wingo Add another simplification pass to make rotate-loops work better * module/language/cps/optimize.scm (optimize-first-order-cps): Toss in another simplification pass. Add support for comparing u64 values with SCM values * libguile/vm-engine.c (BR_U64_SCM_COMPARISON): New helper. (br-if-u64-<=-scm, br-if-u64-<-scm, br-if-u64-=-scm) (br-if-u64->-scm, br-if-u64->=-scm): New instructions, to compare an untagged u64 with a tagged SCM. Avoids many u64->scm operations. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/type-fold.scm: * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm (code-annotation, compute-labels): * module/language/cps/primitives.scm (*branching-primcall-arities*): Add support for new opcodes. * module/language/cps/specialize-numbers.scm (specialize-u64-scm-comparison): New helper. * module/language/cps/specialize-numbers.scm (specialize-operations): Specialize u64 comparisons. * module/language/cps/types.scm (true-comparison-restrictions): New helper. (define-comparison-inferrer): Use the new helper. Add support for u64-<-scm et al. Small VM cleanups * libguile/vm-engine.c (BR_U64_ARITHMETIC): No need for a second argument. Adapt callers. (scm->u64/truncate): Remove extra SYNC_IP. 2015-12-02 Andy Wingo Refactor range checking in assembler instruction packers * module/system/vm/assembler.scm (check-urange, check-srange): New helpers. (pack-u8-u24, pack-u8-s24, pack-u1-u7-u24, pack-u8-u12-u12): (pack-u8-u8-u16, pack-u8-u8-u8-u8): Use the new helpers. Not only makes the code nicer but also reduces register pressure. Add ursh/immediate and ulsh/immediate ops * libguile/vm-engine.c (ursh/immediate, ulsh/immediate): New ops. * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations) (compute-needs-slot): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): * module/language/cps/compile-bytecode.scm (compile-function): * module/system/vm/assembler.scm: * module/language/cps/types.scm: Add support for new ops, and specialize ursh and ulsh. Assembler has a single growable vector * module/system/vm/assembler.scm (): Instead of writing words into a list of fixed-size buffers, use a growable vector. (expand, emit): Instead of assuming that there is enough space for only one word, check that there is space for the entire instruction at the beginning. More efficient assembler instructions * module/system/vm/assembler.scm (pack-u8-u24, pack-u8-s24): (pack-u1-u7-u24, pack-u8-u12-u12, pack-u8-u8-u16): Tweak to expose more possibilities for untagging u64 values. Specialize u64 bit operations * module/language/cps/specialize-numbers.scm (specialize-u64-binop): (specialize-operations): Specialize u64 bit operations. Add untagged bitwise operations * libguile/vm-engine.c (ulogand, ulogior, ulogsub, ulsh, ursh) (scm->u64/truncate): New ops. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): * module/language/cps/types.scm: * module/language/cps/utils.scm (compute-constant-values): * module/system/vm/assembler.scm: Wire up support for the new ops. Disable warnings on bootstrap build * bootstrap/Makefile.am (GUILE_WARNINGS): Don't enable warnings for the bootstrap build, as they probably slow things down. 2015-12-01 Andy Wingo Add logsub op. * libguile/vm-engine.c (logsub): New op. * module/language/cps/effects-analysis.scm (logsub): * module/language/cps/types.scm (logsub): * module/system/vm/assembler.scm (system): Add support for the new op. * module/language/tree-il/compile-cps.scm (canonicalize): Rewrite (logand x (lognot y)) to (logsub x y). 2015-12-01 Andy Wingo Add current-thread VM op * libguile/vm-engine.c (current-thread): New op. * module/language/cps/effects-analysis.scm (&thread): New memory kind. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm (current-thread): * module/language/cps/types.scm (current-thread): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): * module/system/vm/assembler.scm (emit-current-thread): Wire up the new op. 2015-12-01 Andy Wingo Unbox indexes of vectors, strings, and structs * libguile/vm-engine.c (string-length, string-ref) (make-vector, vector-ref, vector-set!) (allocate-struct, struct-ref, struct-set!): Take indexes and return lengths as untagged u64 values. * libguile/vm.c (vm_error_not_a_string): New helper. * module/language/tree-il/compile-cps.scm (convert): * module/language/cps/constructors.scm (inline-vector): * module/language/cps/closure-conversion.scm (convert-one): Untag arguments to {string,vector,struct}-{ref,set!}, make-vector, and allocate-struct. Tag return values from {string,vector}-length. * module/language/cps/slot-allocation.scm (compute-var-representations): vector-length and string-length define u64 slots. * module/language/cps/effects-analysis.scm: make-vector no longer causes a &type-check effect. * module/language/cps/types.scm: Update to expect &u64 values for lengths and indexes. 2015-12-01 Andy Wingo Untag values and indexes for all bytevector instructions * libguile/vm-engine.c (bv-s8-ref, bv-s16-ref, bv-s32-ref, bv-s64-ref): Unbox index and return unboxed S32 value. (bv-s8-set!, bv-s16-set!, bv-s32-set!, bv-s64-set!): Unbox index and take unboxed S32 value. (bv-u8-ref, bv-u16-ref, bv-u32-ref, bv-u64-ref) (bv-s8-set!, bv-s16-set!, bv-s32-set!, bv-s64-set!): Likewise, but with unsigned values. (bv-f32-ref, bv-f32-set!, bv-f64-ref, bv-f64-set!): Use memcpy to access the value so we don't have to think about alignment. GCC will inline this to a single instruction on architectures that support unaligned access. * libguile/vm.c (vm_error_out_of_range_uint64) (vm_error_out_of_range_int64): New helpers. * module/language/cps/slot-allocation.scm (compute-var-representations): All bytevector ref operations produce untagged values. * module/language/cps/types.scm (define-bytevector-accessors): Update for bytevector untagged indices and values. * module/language/cps/utils.scm (compute-constant-values): Fix s64 case. * module/language/tree-il/compile-cps.scm (convert): Box results of all bytevector accesses, and unbox incoming indices and values. 2015-12-01 Andy Wingo Add support for unboxed s64 values * libguile/frames.c (enum stack_item_representation): (scm_to_stack_item_representation): (scm_frame_local_ref, scm_frame_local_set_x): Support for S64 representations. * libguile/frames.h (union scm_vm_stack_element): Add signed 64-bit integer field. * libguile/vm-engine.c (scm->s64, s64->scm, load-s64): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/cse.scm (compute-equivalent-subexpressions): * module/language/cps/effects-analysis.scm: * module/language/cps/slot-allocation.scm (compute-var-representations) (compute-needs-slot, allocate-slots): * module/language/cps/utils.scm (compute-constant-values): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Add support for new primcalls. * module/language/cps/types.scm (&s64): New type. (&s64-min, &s64-max, &u64-max): New convenience definitions. (&range-min, &range-max): Use &s64-min and &u64-max names. (scm->s64, load-s64, s64->scm): Add support for new primcalls. * module/system/vm/assembler.scm (emit-scm->s64, emit-s64->scm) (emit-load-s64): New exports. * module/system/vm/assembler.scm (write-arities): Support for s64 slots. * module/system/vm/debug.scm (arity-definitions): Support for s64 slots. 2015-12-01 Andy Wingo New instructions load-f64, load-u64 * libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Add word types for immediate f64 and u64 values. (TYPE_WIDTH): Bump up by a bit, now that we have 32 word types. (NOP, parse_instruction): Use 64-bit meta type. * libguile/vm-engine.c (load-f64, load-u64): New instructions. * module/language/bytecode.scm (compute-instruction-arity): Add parser for new instruction word types. * module/language/cps/compile-bytecode.scm (compile-function): Add special-cased assemblers for new instructions, and also for scm->u64 and u64->scm which I missed before. * module/language/cps/effects-analysis.scm (load-f64, load-u64): New instructions. * module/language/cps/slot-allocation.scm (compute-needs-slot): load-f64 and load-u64 don't need slots. (compute-var-representations): Update for new instructions. * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Specialize scm->f64 and scm->u64 to make-f64 and make-u64. * module/language/cps/types.scm (load-f64, load-u64): Wire up to type inference, though currently type inference only runs before specialization. * module/language/cps/utils.scm (compute-defining-expressions): For some reason I don't understand, it's possible to see two definitions that are equal but not equal? here. Allow for now. (compute-constant-values): Punch through type conversions to get constant u64/f64 values. * module/system/vm/assembler.scm (assembler): Support for new word types. Export the new assemblers. 2015-12-01 Andy Wingo Add tagged and untagged arithmetic ops with immediate operands * libguile/vm-engine.c (add/immediate, sub/immediate) (uadd/immediate, usub/immediate, umul/immediate): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/slot-allocation.scm (compute-needs-slot): * module/language/cps/types.scm: * module/system/vm/assembler.scm (system): * module/language/cps/effects-analysis.scm: Support for new instructions. * module/language/cps/optimize.scm (optimize-first-order-cps): Move primcall specialization to the last step -- the only benefit of doing it earlier was easier reasoning about side effects, and we're already doing that in a more general way with (language cps types). * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Specialize add and sub to add/immediate and sub/immediate, and specialize u64 addition as well. U64 specialization doesn't work now though because computing constant values doesn't work for U64s; oh well. 2015-12-01 Andy Wingo Remove add1 and sub1 * libguile/vm-engine.c: Remove add1 and sub1 instructions. Will replace with add/immediate and sub/immediate. * module/language/tree-il/peval.scm (peval): If we reify a new , expand it. Removes 1- and similar primcalls. * module/language/tree-il/primitives.scm: Don't specialize (+ x 1) to 1+. (expand-primcall): New export, does a single primcall expansion. (expand-primitives): Use the new helper. * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm: * module/language/cps/types.scm: * module/system/vm/assembler.scm: Remove support for add1 and sub1 CPS primitives. * test-suite/tests/peval.test ("partial evaluation"): Adapt tests that expect 1+/1- to expect +/-. Specialize u64 arithmetic * module/language/cps/specialize-numbers.scm (specialize-operations): (specialize-u64-binop): Specialize u64 addition, subtraction, and multiplication. Better range inference for indexes of vector-ref, string-ref et al * module/language/cps/types.scm (vector-ref, vector-set!) (string-ref, string-set!, struct-ref, struct-set!) (define-bytevector-accessors, define-bytevector-uaccessors): Clamp range of object and index to be within the range of indices, with a maximum of *max-size-t*. Slower range saturation in type inference * module/language/cps/types.scm (*max-size-t*): New definition. (type-entry-saturating-union): Saturate more slowly, first stopping at [0,*max-size-t*] then at [&range-min, &range-max] before saturating to [-inf.0, +inf.0]. This allows most offset phi variables to have their range inferred within the u64 range. Add unsigned 64-bit arithmetic operators: uadd, usub, umul * libguile/vm-engine.c (uadd, usub, umul): New ops. * module/language/cps/effects-analysis.scm (uadd, usub, umul): Add effects analysis. * module/language/cps/slot-allocation.scm (compute-var-representations): The new ops define 'u64 values. * module/language/cps/types.scm (uadd, usub, umul): Add type checkers and inferrers. * module/system/vm/assembler.scm (emit-uadd, emit-usub, emit-umul): New assemblers. Unbox u64 phi values * module/language/cps/specialize-numbers.scm (compute-specializable-vars): Refactor to work on any kind of unboxable value, not just f64 values. (compute-specializable-f64-vars, compute-specializable-u64-vars): New helpers. (apply-specialization): Support for u64 values. Beginning of u64 phi unboxing * module/language/cps/specialize-numbers.scm (compute-specializable-u64-vars): New stub. * module/language/cps/specialize-numbers.scm (compute-specializable-phis): Rename from compute-specializable-f64-phis, and return an intmap instead of an intset. The values distinguish f64 from u64 vars. * module/language/cps/specialize-numbers.scm (apply-specialization): Start of u64 phi unboxing. * module/language/cps/specialize-numbers.scm (specialize-phis): (specialize-numbers): Adapt. Specialize u64 comparisons * module/language/cps/specialize-numbers.scm (specialize-u64-comparison): New function. * module/language/cps/specialize-numbers.scm (specialize-operations): Rename from specialize-f64-operations, as it will specialize both kinds. Add a case to specialize u64 comparisons. * module/language/cps/specialize-numbers.scm (specialize-numbers): Adapt to specialize-operations name change. 2015-12-01 Andy Wingo Add instructions to branch on u64 comparisons * libguile/vm-engine.c (BR_U64_ARITHMETIC): New helper. (br-if-u64-=, br-if-u64-<, br-if-u64->=): New instructions. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/language/cps/type-fold.scm: * module/language/cps/types.scm (u64-=, infer-u64-comparison-ranges): (define-u64-comparison-inferrer, u64-<, u64-<=, u64->=, u64->): * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm (code-annotation): (compute-labels): Compiler and toolchain support for the new instructions. 2015-12-01 Andy Wingo bv-f{32,64}-{ref,set!} take unboxed u64 index * module/language/tree-il/compile-cps.scm (convert): bv-f32-ref, bv-f32-set!, bv-f64-ref, and bv-f64-set! take the index as an untagged u64 value. * module/language/cps/types.scm (define-bytevector-uaccessors): New helper, used while migrating bytevectors to take unboxed indexes. Adapt f32/f64 accessors to use this definition helper. * libguile/vm-engine.c (BV_FLOAT_REF, BV_FLOAT_SET): The index is unboxed. Add bv-length instruction * libguile/vm-engine.c (bv-length): New instruction. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm (bv-length): * module/language/cps/primitives.scm (*instruction-aliases*): * module/language/cps/slot-allocation.scm (compute-var-representations): * module/language/cps/types.scm (bv-length): * module/language/tree-il/compile-cps.scm (convert): Add support for bv-length. * module/system/vm/assembler.scm: Export emit-bv-length. Range inference over the full U64+S64 range * module/language/cps/types.scm (*min-s32*, *max-s32*): Remove unused definitions. (&range-min, &range-max): New definitions, replacing min-fixnum and max-fixnum as the bounds of precise range analysis. (type-entry-min, type-entry-max): Store inf values directly as -inf.0/+inf.0. (type-entry-clamped-min, type-entry-clamped-max): Remove, as they are no longer needed. (clamp-min, clamp-max, make-type-entry): Clamp minimum and maximum half-ranges in different ways. (type-entry-union, type-entry-saturating-union) (type-entry-intersection): Adapt to type-entry-min / type-entry-max change. (bv-u32-ref, bv-u32-set!): (bv-s32-ref, bv-s32-set!): (bv-u64-ref, bv-u64-set!): (bv-s64-ref, bv-s64-set!): Precise range inference. This will allow robust unboxing. (ash): Infer 64-bit shifts. Remove frame->module * module/system/repl/debug.scm (frame->module): Remove. Has been broken for a while, had no callers, and was calling frame-procedure. We can revive again in a better way, like ice-9 local-eval. 2015-12-01 Andy Wingo Add low-level support for unboxed 64-bit unsigned ints * libguile/frames.c (enum stack_item_representation) * libguile/frames.c (scm_to_stack_item_representation): (scm_frame_local_ref, scm_frame_local_set_x): Support 'u64 slots. * libguile/frames.h (union scm_vm_stack_element): Add as_u64 member. * libguile/vm-engine.c (SP_REF_U64, SP_SET_U64): New helpers. (scm->u64, u64->scm): New instructions. * module/language/cps/cse.scm (compute-equivalent-subexpressions): Scalar replacement for u64->scm and scm->u64. * module/language/cps/effects-analysis.scm (scm->u64, u64->scm): Add cases. * module/language/cps/slot-allocation.scm (compute-var-representations): (allocate-slots): Represent the result of scm->u64 as a "u64" slot. * module/language/cps/types.scm (&u64): New type. (scm->u64, u64->scm): Add support for these ops. * module/system/vm/assembler.scm (write-arities): * module/system/vm/debug.scm (arity-definitions): Support u64 representations. 2015-12-01 Andy Wingo Remove frame-procedure * libguile/frames.h: * libguile/frames.c (scm_frame_procedure): Remove. * test-suite/tests/eval.test ("stacks"): Adapt test. * NEWS: Add news item. * doc/ref/api-debug.texi (Frames): Document frame-procedure-name instead of frame-procedure. 2015-12-01 Andy Wingo VM traps don't match on value of slot 0 * module/system/vm/traps.scm (frame-matcher): Always match on a procedure's code, instead of the value in slot 0. Prevents confusion with closure-optimized procedures, re-use of slot 0, and untagged values in slot 0. (trap-at-procedure-call, trap-in-procedure) (trap-instructions-in-procedure, trap-at-procedure-ip-in-range) (trap-at-source-location, trap-in-dynamic-extent) (trap-calls-in-dynamic-extent, trap-instructions-in-dynamic-extent): Update to adapt to frame-matcher change and remove #:closure? argument, effectively changing the default behavior to #:closure? #t. * doc/ref/api-debug.texi (Low-Level Traps): Update documentation. 2015-12-01 Andy Wingo Remove `procedure' repl command * doc/ref/scheme-using.texi (Debug Commands): * module/system/repl/command.scm (procedure): Remove REPL command. Since there is a closure binding and we have improved the ,registers output, this is no longer necessary and by removing it we remove another bogus use of frame-procedure. ,registers doesn't use frame-procedure * module/system/repl/debug.scm (print-registers): Avoid frame-procedure, and be more useful and print an offset in units of 4 bytes. Better frame-call-representation printing of GC clobbers * module/system/vm/frame.scm (frame-call-representation): Assume that unspecified values are GC clobbers rather than actual arguments, and print as _. More robust low-level frame printer * libguile/frames.c (scm_i_frame_print): Print using frame-procedure-name, not frame-procedure. frame-call-representation avoids frame-procedure. * module/system/vm/frame.scm (frame-call-representation): Never use frame-procedure, as we don't know that slot 0 is a SCM value and even if it were, we don't know that it corresponds to the procedure being applied, except in the case of primcalls. Print _ as the procedure name if we don't know it, instead of #f. 2015-12-01 Andy Wingo Add frame-procedure-name * libguile/frames.c (frame_procedure_name_var): New static definition. (init_frame_procedure_name_var): New helper. (scm_frame_procedure_name): New function that returns the name of the frame's procedure, as frame-procedure is to be deprecated. * libguile/frames.h (scm_frame_procedure_name): Export. * module/ice-9/boot-9.scm (exception-printers): Use frame-procedure-name instead of procedure-name on frame-procedure. * module/system/vm/frame.scm (frame-procedure-name): New private function, implementing scm_frame_procedure_name. (frame-call-representation): Use frame-procedure-name to get the procedure name to print. 2015-12-01 Andy Wingo Remove primitive?, add primitive-code? We need to be able to identify frames that are primitive applications without assuming that slot 0 in a frame is an SCM value and without assuming that value is the procedure being applied. * libguile/gsubr.c (scm_i_primitive_code_p): New helper. (scm_i_primitive_arity): Use the new helper. * libguile/gsubr.h: Declare the new helper. * libguile/programs.h: * libguile/programs.c (scm_program_code_p): New function, replacing scm_primitive_p. (scm_primitive_call_ip): Fix FUNC_NAME definition. * module/statprof.scm (sample-stack-procs, count-call): Identify primitive frames from the IP, not the frame-procedure. Avoids the assumption that slot 0 in a frame is a SCM value. (statprof-proc-call-data): Adapt to primitive-code? change. * module/system/vm/frame.scm (frame-call-representation): Identify primitive frames from the IP, not the closure. Still more work to do here to avoid assuming slot 0 is a procedure. * module/system/vm/program.scm: Export primitive-code? instead of primitive?. (program-arguments-alist, program-arguments-alists): Identify primitives from the code instead of the flags on the program. Not sure this is a great change, but it does avoid having to define a primitive? predicate in Scheme. 2015-12-01 Andy Wingo Apply of non-programs has IP that is not from prev frame * libguile/vm-engine.c (vm_engine) * libguile/vm.c (vm_apply_non_program_code): Arrange so that the code to apply a non-program has its own IP, so that frame-instruction-pointer for a non-program application doesn't point into the previously active frame. All arities serialize a "closure" binding * module/language/cps/compile-bytecode.scm (compile-function): Always define a 'closure binding in slot 0. * module/system/vm/frame.scm (available-bindings): No need to futz around not having a closure binding. * module/system/vm/debug.scm (arity-arguments-alist): Expect a closure binding. * test-suite/tests/rtl.test: Emit definitions for the closure. Identify boot continuations by code, not closure * libguile/vm.h: * libguile/vm.c (scm_i_vm_is_boot_continuation_code): New internal procedure. * libguile/stacks.c (scm_make_stack): * libguile/frames.c (scm_c_frame_previous): Use new helper to identify boot frames. 2015-11-12 Andy Wingo Remove br-if-equal opcode * libguile/vm-engine.c (br-if-equal): Remove opcode. Don't compile equal? to br-if-equal * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/language/cps/type-fold.scm (equal?): * module/language/cps/types.scm (equal?): * module/language/tree-il/compile-cps.scm (convert): `equal?' is no longer a branching primcall, because it isn't inline. The implementation could lead to bad backtraces also, as it didn't save the IP, and actually could lead to segfaults as it didn't reload the SP after the return. There is an eqv? fast-path, though. * module/system/vm/assembler.scm (br-if-equal): Remove interface. * module/system/vm/disassembler.scm (code-annotation): (compute-labels): No need to handle br-if-equal. 2015-11-11 Andy Wingo Fix miscompilation of closures allocated as vectors * module/language/cps/closure-conversion.scm (convert-one): Fix miscompilation of vector closure initialization. load-path will skip over stale .go files and keep going * libguile/load.c (compiled_is_fresh): Write warnings to warning port. Move up in the file. (search_path): Add ability to skip over matching files in the path that are stale, relative to some other corresponding file. (scm_search_path, scm_sys_search_load_path): Adapt to search_path changes. (do_try_auto_compile): Write status to warning port. (scm_primitive_load_path): Use new search_path ability to skip over stale files. Allows updates to source files to use freshly-compiled bootstrap files, when building Guile itself. Also allows simplification of fallback logic. (scm_init_eval_in_scheme): Skip stale eval.go files in the path. 2015-11-11 Andy Wingo Eval speedup for lexical-ref * module/ice-9/eval.scm (primitive-eval): Specialize lexical-ref for depths 0, 1, and 2. Speeds up this test by around 13%: (primitive-eval '(let lp ((n 0)) (when (< n #e1e7) (lp (1+ n))))) 2015-11-11 Andy Wingo Bump bytecode version * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump bytecode version to prevent 2.1.1 users from thinking that they don't need to make clean after pulling. Remove debug printout in specialize-numbers * module/language/cps/specialize-numbers.scm (apply-f64-specialization): Remove printout. I didn't see any when compiling Guile, which means that probably this optimization doesn't hit for any code in Guile itself, sadly :P Better f64 unboxing for loop vars that might flow to $ktail * module/language/cps/specialize-numbers.scm (compute-specializable-f64-vars): Tweak to allow f64 values to flow directly to return sites. The compiler can unbox float64 loop variables * module/language/cps/specialize-numbers.scm: Specialize phi variables as well. Fix slot representation computation for fadd, fmul, etc * module/language/cps/slot-allocation.scm (compute-var-representations): fadd, fmul and so on also define f64 values. 2015-11-11 Andy Wingo Add new pass to specialize "add" into "fadd" where possible * module/language/cps/specialize-numbers.scm: New pass, to turn "add" into "fadd", and similarly for sub, mul, and div. * module/language/cps/optimize.scm: * module/Makefile.am: * bootstrap/Makefile.am: Wire up the new pass. 2015-11-11 Andy Wingo Add fadd, fsub, fmul, fdiv instructions * libguile/vm-engine.c (fadd, fsub, fmul, fdiv): New instructions. * module/language/cps/effects-analysis.scm: * module/language/cps/types.scm: Wire up support for new instructions. * module/system/vm/assembler.scm: Export emit-fadd and friends. 2015-11-11 Andy Wingo Scalar replacement for f64->scm * module/language/cps/cse.scm (compute-equivalent-subexpressions): Scalar replacement for float boxes. 2015-11-11 Andy Wingo bv-{f32,f64}-{ref,set!} operate on raw f64 values * module/language/tree-il/compile-cps.scm (convert): Box results of bv-f32-ref and bv-f64-ref. Unbox the argument to bv-f32-set! and bv-f64-set!. * libguile/vm-engine.c (bv-f32-ref, bv-f64-ref): Results are raw. (bv-f32-set!, bv-f64-set!): Take unboxed arguments. * module/system/vm/assembler.scm (emit-scm->f64, emit-f64->scm): Export. * module/language/cps/compile-bytecode.scm (compile-function): * module/language/cps/effects-analysis.scm: Add support for scm->f64 and f64->scm. * module/language/cps/slot-allocation.scm (compute-var-representations): Add cases for primops returning raw values. * module/language/cps/types.scm (bv-f32-ref, bv-f32-set!) (bv-f64-ref, bv-f64-set!): Deal in &f64 values instead of reals. 2015-11-11 Andy Wingo Type inference distinguishes between untagged and tagged flonums * module/language/cps/types.scm (&f64): New type, for untagged f64 values. Having a distinct type prevents type folding from replacing an untagged 3.0 with a tagged 3.0. (scm->f64, f64->scm): Support these new primcalls. 2015-10-28 Andy Wingo Add VM ops to pack and unpack raw f64 values. * libguile/vm-engine.c (scm->f64, f64->scm): New ops. Stack slots can hold a double * libguile/frames.h (union scm_vm_stack_element): Add double member. * libguile/frames.c (scm_frame_local_ref, scm_frame_local_set_x): Wire up f64 support. 2015-10-28 Andy Wingo Reflection support for unboxed f64 slots * module/system/vm/assembler.scm (emit-definition): Add representation field. (write-arities): Emit representations into the arities section. * module/system/vm/debug.scm (arity-definitions): Read representations. * module/system/vm/frame.scm (): Add representation field and binding-representation getter. (available-bindings): Pass representation to make-binding. (frame-binding-set!, frame-binding-ref, frame-call-representation): Pass representation to frame-local-ref / frame-local-set!. * test-suite/tests/rtl.test: Update definition instructions. * module/language/cps/slot-allocation.scm ($allocation): Add representations field. (lookup-representation): New public function. (allocate-slots): Pass representations to make-$allocation. * module/language/cps/compile-bytecode.scm (compile-function): Adapt to emit-definition change. * libguile/frames.h: * libguile/frames.c (scm_frame_local_ref, scm_frame_local_set_x): Take representation argument. (scm_to_stack_item_representation): New internal helper. 2015-10-28 Andy Wingo VM support for raw slots * libguile/loader.c (scm_find_slot_map_unlocked): Rename from scm_find_dead_slot_map_unlocked. * libguile/vm.c (struct slot_map_cache_entry, struct slot_map_cache) (find_slot_map): Rename, changing "dead_slot" to "slot". (enum slot_desc): New type. (scm_i_vm_mark_stack): Interpret slot maps as having two bits per slot, allowing us to indicate that a slot is live but not a pointer. * module/language/cps/compile-bytecode.scm (compile-function): Adapt to emit-slot-map name change. * module/system/vm/assembler.scm (): Rename dead-slot-maps field to slot-maps. (emit-slot-map): Rename from emit-dead-slot-map. (link-frame-maps): 2 bits per slot. * module/language/cps/slot-allocation.scm (lookup-slot-map): Rename from lookup-dead-slot-map. (compute-var-representations): New function. (allocate-slots): Adapt to encode two-bit slot representations. 2015-10-28 Andy Wingo Treat tail $values as generating lazy allocations * module/language/cps/slot-allocation.scm (compute-lazy-vars): Returning values in tail position also generates lazy vars. Remove return opcode * libguile/vm-engine.c (return): Remove opcode. Remove use of return in disassembler.scm * module/system/vm/disassembler.scm (instruction-has-fallthrough?): Remove return from static opcode set. rtl.test uses return-values * test-suite/tests/rtl.test: Fix up to use return-values. 2015-10-28 Andy Wingo Always emit return-values * module/language/cps/compile-bytecode.scm (compile-function): Remove special cases for nullary and unary returns; instead always use return-values and rely on hinting to try to place values in the right slot already. * module/system/vm/assembler.scm (emit-init-constants): Use return-values. * module/system/vm/disassembler.scm (code-annotation): Add annotation for return-values. 2015-10-28 Andy Wingo Replace return primcalls with $values * module/language/cps/compile-bytecode.scm: * module/language/cps/contification.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/type-fold.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Never generate a return primcall. Instead use $values. Don't emit redundant reset-frame before return * module/language/cps/compile-bytecode.scm (compile-function): Don't emit reset-frame before return-values. 2015-10-28 Andy Wingo return-values opcode resets the frame * libguile/vm-engine.c (return-values): Change to also reset the frame, if nlocals is nonzero. * doc/ref/vm.texi (Procedure Call and Return Instructions): Updated docs. * module/language/cps/compile-bytecode.scm (compile-function): Adapt to call emit-return-values with the right number of arguments. 2015-10-28 Andy Wingo Fix slot-allocation to make 'return' not need to alloc-frame * module/language/cps/slot-allocation.scm (compute-frame-sizes): Ensure that frames with `return' have space to shuffle the arg into return position. Run CSE to clean up after closure conversion * module/language/cps/optimize.scm: Enable CSE over first-order CPS. CSE can run on first-order CPS * module/language/cps/cse.scm (compute-truthy-expressions): (compute-equivalent-subexpressions): (eliminate-common-subexpressions): Refactor to be able to work on first-order CPS. Revert "Bootstrap build doesn't have to expand CPS optimizations" This reverts commit ce36fb16fff30ba1915dbd9d52d2325acedd54c7. Bootstrap build doesn't have to expand CPS optimizations * module/language/cps/optimize.scm (define-optimizer) (optimize-higher-order-cps, optimize-first-order-cps): Obfuscate a bit so that the bootstrap build won't have to expand optimization passes. Might marginally speed up the bootstrap process. 2015-10-25 Andy Wingo Release v2.1.1 * GUILE-VERSION (GUILE_MICRO_VERSION): Bump to v2.1.1. Fix distcheck issues * bootstrap/Makefile.am: * libguile/Makefile.am: Fix distcheck issues. Fix uninstalled-env bug that preferred bootstrap/ to module/ * meta/uninstalled-env.in (top_builddir): Whoops! We were preferring bootstrap/ unoptimized .go files to module/ optimized .go files. Fix! 2015-10-25 Andy Wingo Revert "Update Gnulib to v0.1-603-g1d16a7b" This reverts commit 2d4da30fdefbcdb065d4b1f48f2a77d06f69e3c3. This Gnulib update was causing failures related to timezones in stime.c. I tried to fix it by adopting the time_rz module from gnulib but that then caused other failures. We can try again later. 2015-10-23 Andy Wingo Bootstrap makefile tweaks * bootstrap/Makefile.am (.scm.go): Fix -L options to point to /module. (SOURCES): Move up psyntax-pp.scm. Sadly a bug while I was developing the bootstrap makefile meant that there was a stale psyntax-pp.go from module/ that the build was picking up, leading to invalid bootstrap timing measurements. 2015-10-23 Andy Wingo Use a bootstrapped -O0 compiler to compile the -O2 Guile This reduces total build time to around 30 minutes or so. * Makefile.am (SUBDIRS): Visit bootstrap/ before module/. * bootstrap/Makefile.am: New file. * configure.ac: Generate bootstrap/Makefile. * meta/uninstalled-env.in (top_builddir): Add bootstrap/ to the GUILE_LOAD_COMPILED_PATH. * module/Makefile.am: Simplify to just sort files in alphabetical order; since bootstrap/ was already compiled, we don't need to try to optimize compilation order. Although the compiler will get faster as more of the compiler itself is optimized, this isn't a significant enough effect to worry about. 2015-10-22 Andy Wingo Wire up `guild compile -O0 foo.scm' * module/scripts/compile.scm (%options): Resurrect -O option and make it follow GCC, more or less. The default is equivalent to -O2. * module/language/cps/compile-bytecode.scm (lower-cps): * module/language/cps/optimize.scm (optimize-higher-order-cps): Move split-rec to run unconditionally for now, as closure conversion fails without it. (define-optimizer): Only verify the result if we are debugging, to save time. (cps-default-optimization-options): New exported procedure. * module/language/tree-il/optimize.scm (tree-il-default-optimization-options): New exported procedure. 2015-10-22 Andy Wingo Update Gnulib to v0.1-603-g1d16a7b Minor NEWS update. Small subr-call refactor * libguile/gsubr.c (scm_apply_subr): New internal helper. * libguile/vm-engine.c (subr-call): Call out to scm_apply_subr. * doc/ref/vm.texi (subr-call): Don't specify how the foreign pointer is obtained. subr-call implementation simplification * libguile/vm-engine.c (subr-call): Reference args from SP, not FP. Update VM documentation for new stack layout * doc/ref/vm.texi: Update for new stack layout. * module/system/vm/disassembler.scm (code-annotation): Print the frame sizes after alloc-frame, reset-frame, etc to make reading the disassembly easier. 2015-10-21 Andy Wingo Add stack size computation to disassembler * module/system/vm/disassembler.scm (define-stack-effect-parser) (stack-effect-parsers, instruction-stack-size-after): New stack size facility. (define-clobber-parser, clobber-parsers, instruction-slot-clobbers): Take incoming and outgoing stack sizes as arguments to interpret SP-relative clobbers. * module/system/vm/frame.scm (compute-frame-sizes): New helper that computes frame sizes for each position in a function. (compute-killv): Adapt to compute the clobbered set given the computed frame sizes. 2015-10-21 Andy Wingo Minor assembler cleanups * module/system/vm/assembler.scm (shuffling-assembler): Minor renames. 2015-10-21 Andy Wingo SP-relative local addressing * libguile/vm-engine.c: S24/S12/S8 operands addressed relative to the SP, not the FP. Cache the SP instead of a FP-relative locals pointer. Further cleanups to follow. * libguile/vm.c (vm_builtin_call_with_values_code): Adapt to mov operand addresing change. * module/language/cps/compile-bytecode.scm (compile-function): Reify SP-relative local indexes where appropriate. * module/system/vm/assembler.scm (emit-fmov*): New helper, exported as emit-fmov. (shuffling-assembler, define-shuffling-assembler): Rewrite to shuffle via push/pop/drop. (standard-prelude, opt-prelude, kw-prelude): No need to provide for shuffling args. * test-suite/tests/rtl.test: Update. * module/language/cps/slot-allocation.scm: Don't reserve slots 253-255. 2015-10-21 Andy Wingo Fix boot closure wrong-num-args error * libguile/eval.c (prepare_boot_closure_env_for_eval): Fix issue if fixed closure is called with wrong number of arguments during bootstrap. 2015-10-21 Andy Wingo Prepare for SP-addressed locals * libguile/vm-engine.c: Renumber opcodes, and take the opportunity to fold recent additions into more logical places. Be more precise when describing the encoding of operands, to shuffle local references only and not constants, immediates, or other such values. (SP_REF, SP_SET): New helpers. (BR_BINARY, BR_ARITHMETIC): Take full 24-bit operands. Our shuffle strategy is to emit push when needed to bring far locals near, then pop afterwards, shuffling away far destination values as needed; but that doesn't work for conditionals, unless we introduce a trampoline. Let's just do the simple thing for now. Native compilation will use condition codes. (push, pop, drop): Back from the dead! We'll only use these for temporary shuffling though, when an opcode can't address the full 24-bit range. (long-fmov): New instruction, like long-mov but relative to the frame pointer. (load-typed-array, make-array): Don't use a compressed encoding so that we can avoid the shuffling case. It would be a pain, given that they have so many operands already. * module/language/bytecode.scm (compute-instruction-arity): Update for new instrution word encodings. * module/system/vm/assembler.scm: Update to expose some opcodes directly, without the need for shuffling wrappers. Adapt to instruction word encodings change. * module/system/vm/disassembler.scm (disassembler): Adapt to instruction coding change. 2015-10-21 Andy Wingo Replace dynamic link on stack with previous frame size * libguile/frames.h (SCM_FRAME_DYNAMIC_LINK) (SCM_FRAME_SET_DYNAMIC_LINK): Instead of storing the absolute value of the previous FP, store its offset from the current FP. This allows us to avoid relinking when composing continuations or when relocating the stack. * libguile/frames.c (scm_frame_dynamic_link, scm_c_frame_previous): No need to relocate the dynamic link. * libguile/vm.c (vm_return_to_continuation_inner): (vm_reinstate_partial_continuation_inner, vm_expand_stack_inner): Don't relocate the frame pointer chain. (scm_i_vm_mark_stack): Terminate when FP is above stack_top, not when 0. (make_vm): Init FP to stack_top. 2015-10-21 Andy Wingo Rename union scm_vm_stack_element members * libguile/frames.h (union scm_vm_stack_element): Rename members from scm, ip, etc to as_scm, as_ip, etc. Adapt users. 2015-10-21 Andy Wingo Remove sp from scm_vm_cont * libguile/vm.h (struct scm_vm_cont): Remove "sp" member; it's always the same as stack_bottom. * libguile/vm.c (scm_i_vm_cont_to_frame, scm_i_vm_capture_stack): (vm_return_to_continuation_inner): * libguile/stacks.c (scm_make_stack): * libguile/continuations.c (scm_i_continuation_to_frame): Adapt. 2015-10-21 Andy Wingo VM caches address of local 0 instead of FP * libguile/vm-engine.c (vm_engine): Cache the address of local 0 instead of the FP. This makes locals access a bit cheaper, but we still have to negate the index. The right fix is to index relative to the SP instead. That's a more involved change, so we punt until later. 2015-10-21 Andy Wingo VM stack grows downward Adapt VM stack to grow downward. This will make native compilation look more like the VM code, as we will be able to use native CALL instructions, taking proper advantage of the return address buffer. * libguile/continuations.c (scm_i_continuation_to_frame): Record offsets from stack top. * libguile/control.c (scm_i_prompt_pop_abort_args_x): Adapt for reversed order of arguments, and instead of relying on the abort to push on the number of arguments, make the caller save the stack depth, which allows us to compute the number of arguments ourselves. (reify_partial_continuation, scm_c_abort): Adapt to reversed stack order. * libguile/dynstack.c (scm_dynstack_wind_prompt): Since we wind the stack in a downward direction, subtract the reloc instead of adding it. * libguile/dynstack.h (SCM_F_DYNSTACK_PROMPT_ESCAPE_ONLY): Remove flag; instead rely on prompt-establishing code to save the stack depth. * libguile/eval.c (eval): Remove extraneous "volatile" declarations for variables that are not re-set between the setjmp and any longjmp. Adapt to save stack depth before instating the prompt. * libguile/foreign.c (scm_i_foreign_call): Adapt to receive arguments in reverse order. * libguile/frames.c (frame_stack_top, scm_i_frame_stack_top): Adapt to compute stack top instead of stack bottom. (scm_c_frame_closure): Adapt to stack growth change. (scm_frame_num_locals, scm_frame_local_ref, scm_frame_set_x): Use union data type to access stack. (RELOC): Reformat. (scm_c_frame_previous): Adapt to stack growth change. * libguile/frames.h: Adapt stack diagram to indicate that the stack grows up. (union scm_vm_stack_element): New data type used to access items on the stack. (SCM_FRAME_PREVIOUS_SP) (SCM_FRAME_RETURN_ADDRESS, SCM_FRAME_SET_RETURN_ADDRESS) (SCM_FRAME_DYNAMIC_LINK, SCM_FRAME_SET_DYNAMIC_LINK) (SCM_FRAME_LOCAL, SCM_FRAME_NUM_LOCALS): Adapt to stack representation change. (SCM_FRAME_SLOT): New helper. (SCM_VM_FRAME_FP, SCM_VM_FRAME_SP): Adapt to stack growth change. * libguile/stacks.c (scm_make_stack): Record offsets from top of stack. * libguile/throw.c (catch): Adapt to scm_i_prompt_pop_abort_args_x change. * libguile/vm-engine.c (ALLOC_FRAME, RESET_FRAME): (FRAME_LOCALS_COUNT_FROM): Adapt to stack growth change. (LOCAL_ADDRESS): Use SCM_FRAME_SLOT to get the address as the proper data type. (RETURN_ONE_VALUE, RETURN_VALUE_LIST): Adapt to stack growth change. (apply): Shuffling up the SMOB apply args can cause the stack to expand, so use ALLOC_FRAME instead of RESET_FRAME. (vm_engine): Adapt for stack growth change. * libguile/vm.c (vm_increase_sp, vm_push_sp, vm_restore_sp): Adapt to stack representation change. (scm_i_vm_cont_to_frame): Adapt to take offsets from the top. (scm_i_vm_capture_stack): Adapt to capture from the top. (vm_return_to_continuation_inner): Adapt for data type changes. (vm_return_to_continuation): Likewise, and instead of looping, just splat the saved arguments on with memcpy. (vm_dispatch_hook): Adapt to receive arguments in the reverse order. Adapt callers. (vm_abort): There is never a tail argument. Adapt to stack representation change. (vm_reinstate_partial_continuation) (vm_reinstate_partial_continuation_inner): Adapt to stack growth change. (allocate_stack, free_stack): Adapt to data type change. (expand_stack): Don't try to mremap(), as you can't grow a mapping from the bottom. Without knowing that there's a free mapping space right below the old stack, which there usually isn't on Linux, we have to copy. We can't use MAP_GROWSDOWN because Linux is buggy. (make_vm): Adapt to stack representation changes. (return_unused_stack_to_os): Round down instead of up, as the stack grows down. (scm_i_vm_mark_stack): Adapt to walk up the stack. (scm_i_vm_free_stack): Adapt to scm_vm changes. (vm_expand_stack_inner, reset_stack_limit, vm_expand_stack): Adapt to the stack growing down. (scm_call_n): Adapt to the stack growing down. Don't allow argv to point into the stack. * libguile/vm.h (struct scm_vm, struct scm_vm_cont): Adapt to hold the stack top and bottom. 2015-10-21 Andy Wingo Fix prompt miscompilation * module/language/cps/compile-bytecode.scm (compile-function): Fix miscompilation when the handler body is forwarded. Minor VM documentation updates * doc/ref/vm.texi (Why a VM?, Variables and the VM): Minor updates. 2015-10-06 Mark H Weaver Fix typo in CPS conversion. Fixes . Reported by tantalum . * module/language/tree-il/compile-cps.scm (convert): Add missing 'cps' argument to the continuation passed to 'convert-arg'. 2015-09-18 Andy Wingo Minor CPS documentation cleanups * doc/ref/compiler.texi (Continuation-Passing Style): Minor cleanups. 2015-09-17 Andy Wingo Update CPS language documentation * doc/ref/compiler.texi (Continuation-Passing Style): Update to latest CPS language. Remove unused (language tree-il inline) module. * module/language/tree-il/inline.scm: Remove. * module/Makefile.am (TREE_IL_LANG_SOURCES): Remove inline.scm. 2015-08-13 Mark H Weaver Allow decoding of UTF-8 containing U+FFFD, the replacement character. * libguile/strings.c (scm_from_utf8_stringn): Use 'u8_mbtoucr' and check for a decoding error by its 'nbytes' return value. Previously we used 'u8_mbtouc' and improperly assumed that a U+FFFD character indicated a decoding error. * libguile/symbols.c (utf8_string_equals_wide_string): Likewise. * test-suite/tests/bytevectors.test (exception:decoding-error): New variable. ("2.9 Operations on Strings"): Add tests. 2015-07-27 Andy Wingo Add closure effects * module/language/cps/effects-analysis.scm: Add closure effects, to enable hoisting/CSE of free-ref/free-set!. Better codegen for $values terms that don't shuffle * module/language/cps/compile-bytecode.scm (compute-forwarding-labels): Analyze forwarding labels before emitting code. This lets us elide conts that cause no shuffles, allowing more fallthrough. 2015-07-27 Andy Wingo Loop peeling * module/language/cps/peel-loops.scm: New pass. Only enabled if the loop has one successor. * module/language/cps/optimize.scm: Peel instead of doing LICM on higher-order CPS, then LICM on first-order CPS. * module/Makefile.am: Wire up new pass. 2015-07-27 Andy Wingo solve-flow-equations tweak * module/language/cps/utils.scm (solve-flow-equations): Revert to take separate in and out maps. Take an optional initial worklist. * module/language/cps/slot-allocation.scm: Adapt to solve-flow-equations change. 2015-07-27 Andy Wingo Simplify rotate-loops.scm * module/language/cps/rotate-loops.scm: Clean up unused code. 2015-07-25 Andy Wingo Loop inversion with multiple exits * module/language/cps/rotate-loops.scm (rotate-loop): Instead of restricting rotation to loops with just one exit node, restrict to loops with just one exit successor. 2015-07-24 Andy Wingo Rotate comparisons down to loop back-edges * module/language/cps/rotate-loops.scm: New pass. * module/Makefile.am: * module/language/cps/optimize.scm: Wire up the new pass. Eliminate trampoline gotos when possible in compile-bytecode * module/language/cps/compile-bytecode.scm (compile-function): Eliminate trampoline jumps for conditional branches that don't shuffle. Small expression-effects tweak * module/language/cps/effects-analysis.scm (expression-effects): Closures with zero free vars don't allocate. Loop-invariant code motion * module/language/cps/licm.scm: New pass. * module/language/cps/optimize.scm: Wire up new pass. * module/Makefile.am: Add new file. 2015-07-24 Andy Wingo Move solve-flow-equations to utils * module/language/cps/slot-allocation.scm (compute-lazy-vars): (compute-live-variables): Adapt to solve-flow-equations interface change. * module/language/cps/utils.scm (solve-flow-equations): Move here. Use an init value instead of an init map. 2015-07-24 Andy Wingo Factor out compute-effects/elide-type-checks from dce.scm * module/language/cps/type-checks.scm: New module. * module/language/cps/dce.scm: Use new module. * module/Makefile.am: Add new module. 2015-07-22 Andy Wingo Add missing files Last commit meant to rename files, not delete them. Whoops! Rename CPS2 to CPS Remove CPS1 language * module/language/cps.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/dfg.scm: * module/language/cps/renumber.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/spec.scm: * module/language/cps/verify.scm: * module/language/cps2/compile-cps.scm: Delete. * module/Makefile.am: Remove deleted files. Compile CPS2 directly to bytecode * module/language/cps2/spec.scm (cps2): Compile directly to bytecode. Slot allocation and bytecode compilation from CPS2. * module/language/cps2/compile-bytecode.scm: New file. * module/language/cps2/slot-allocation.scm: New file. * module/Makefile.am: Add new files. Fix CPS2 compute-successors * module/language/cps2/utils.scm (compute-successors): Propagate $kfun to $ktail so that we don't leave off the tail if the body iloops. intset-intersect bugfix * module/language/cps/intset.scm (intset-intersect): Remove new-leaf procedure, inlining to single call site. An empty intersection properly produces #f so that the set can be pruned. 2015-07-21 Andy Wingo Fix bad return shuffles for multiply-used $kreceive conts * module/language/cps2/reify-primitives.scm (uniquify-receive): (reify-primitives): Ensure that $kreceive conts can have only one predecessor. Otherwise return shuffles are incorrectly allocated. 2015-07-20 Andy Wingo Fix error printing some wrong-num-args backtraces * module/system/repl/debug.scm (print-frame): Pass #:top-frame? #t for the top frame. * module/system/vm/frame.scm (available-bindings): Be permissive and allow #:top-frame? #f even when the IP is at the start of the function. 2015-07-20 Andy Wingo More slot-allocation simplification * module/language/cps/slot-allocation.scm (allocate-slots): Remove unreachable clause. 2015-07-19 Andy Wingo CPS1 slot-allocation simplification * module/language/cps/slot-allocation.scm (allocate-slots): Don't pass around nargs, as it's not used. 2015-07-19 Andy Wingo Utils refactors * module/language/cps2/utils.scm (compute-successors): kfun is optional. (compute-sorted-strongly-connected-components): New function, moved from split-rec.scm. Doesn't assume that 0 is a free node identifier. * module/language/cps2/split-rec.scm (compute-sorted-strongly-connected-components): Remove, use utils.scm version instead. * module/language/cps2/closure-conversion.scm (intset-select): Remove unused function. 2015-07-19 Andy Wingo Add intset-prev and intset-fold-right * module/language/cps/intset.scm (intset-prev): New function. (make-intset-folder): Add forward? argument like make-intmap-folder. (intset-fold-right): New function. 2015-07-16 Andy Wingo Reify primitives in CPS2 * module/language/cps/reify-primitives.scm: Remove. * module/language/cps2/reify-primitives.scm: New file. * module/Makefile.am: Adapt build. * module/language/cps/compile-bytecode.scm: * module/language/cps2/compile-cps.scm: Reify primitives in CPS2 instead of CPS. 2015-07-16 Andy Wingo Fix type/range inference for mul * module/language/cps2/types.scm (mul): Fix nan testing. 2015-07-16 Andy Wingo Remove CPS optimization passes and closure conversion * module/language/cps/closure-conversion.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-bailouts.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/specialize-primcalls.scm: * module/language/cps/type-fold.scm: * module/language/cps/types.scm: Remove these files, obsoleted by CPS2. * module/Makefile.am: Update. 2015-07-16 Andy Wingo Optimize first-order CPS * module/language/cps2/optimize.scm: Move comments here from cps/compile-bytecode.scm. * module/language/cps/compile-bytecode.scm: Remove optimization and closure conversion calls, since CPS2 does this for us. * module/language/cps2/compile-cps.scm (compile-cps): Use set! to save memory at bootstrap-time. Optimize first-order CPS, to get rid of strangeness introduced in closure conversion. 2015-07-16 Andy Wingo Beta reduction over first-order CPS * module/language/cps2/simplify.scm (beta-reduce): Handle $closure. 2015-07-16 Andy Wingo DCE works on first-order CPS * module/language/cps2/dce.scm (compute-live-code): Use the live-labels set to indicate function liveness. $closure and $callk mark their associated functions as live. (process-eliminations): Handle $closure. * module/language/cps2/effects-analysis.scm (expression-effects): Handle $closure. 2015-07-16 Andy Wingo compute-reachable-functions refactor * module/language/cps2/utils.scm (compute-reachable-functions): New function. * module/language/cps2/verify.scm (check-label-partition) (compute-reachable-labels): Use the new function. * module/language/cps2/simplify.scm (compute-singly-referenced-vars): Allow $closure. (compute-eta-reductions, compute-beta-reductions): Use compute-reachable-functions, which besides being a simplification also allows simplification to work on first-order CPS. 2015-07-15 Andy Wingo Prepare DCE pass for first-order CPS2 * module/language/cps2/dce.scm (compute-live-code): Prepare for handling first-order CPS by tracking functions in the live label set. Enable CPS2 closure conversion * module/language/cps2/closure-conversion.scm: Remove debug printfs. * module/language/cps2/compile-cps.scm (compile-cps): * module/language/cps/compile-bytecode.scm (compile-bytecode): Use CPS2 closure conversion by default. CPS2 closure conversion bugfixes * module/language/cps2/closure-conversion.scm (rewrite-shared-closure-calls): Fix to make shared closures call the right label. (closure-label): New helper. (prune-free-vars): If a shared closure is not well-known, don't use the alias optimization. (convert-one): Fix for shared closures with one not-well-known closure. closure-conversion docstring tweak * module/language/cps2/closure-conversion.scm (prune-free-vars): Fix docstring. 2015-07-15 Andy Wingo Wire up new closure conversion pass * module/language/cps/compile-bytecode.scm (compile-bytecode): Only convert closures if the #:cps2-convert? option is not passed. * module/language/cps2/compile-cps.scm (conts->fun*, compile-cps): Add support for CPS2 closure conversion, disabled by default. 2015-07-14 Andy Wingo Add CPS2 closure conversion module * module/language/cps2/closure-conversion.scm: New module. * module/Makefile.am: Add new file. Verify pass works on first-order CPS * module/language/cps2/verify.scm: Work with first-order CPS. 2015-07-14 Andy Wingo Beginnings of first-order CPS optimization * module/language/cps2/optimize.scm (optimize-higher-order-cps): Renamed from "optimize". (optimize-first-order-cps): New function. * module/language/cps2/compile-cps.scm: Adapt. 2015-07-14 Andy Wingo Tweak intset printing * module/language/cps/intset.scm: Print members of set as absolute values, not diffs from set minumum. CPS2 renumber works with first-order CPS * module/language/cps2/renumber.scm (compute-renaming): Add support for $closure and $callk. 2015-07-13 Andy Wingo Fix intset-subtract to reliably produce empty-intset * module/language/cps/intset.scm (intset-subtract): Reliably produce empty-intset if the result is empty. intset-union fast paths * module/language/cps/intset.scm (intset-union): Add fast paths for union with empty intset. Reorganizing of intset/intmap helper functions * module/language/cps2/split-rec.scm (intmap-keys): Move to utils. * module/language/cps2/utils.scm (trivial-intset): New function. (intmap-keys, invert-bijection, invert-partition): New functions. 2015-06-07 Andy Wingo Add split-rec pass * module/language/cps2/split-rec.scm: New pass. * module/language/cps2/optimize.scm: Run new pass. * module/Makefile.am: Add new pass to build. 2015-06-05 Andy Wingo Renumber before contifying to eliminate stale conts * module/language/cps2/contification.scm (contify): Renumber before contifying. Disable CPS optimization passes * module/language/cps/compile-bytecode.scm (compile-bytecode): Don't bother running the CPS optimization passes, as they are redundant with CPS2. Enable all CPS2 optimization passes * module/language/cps2/optimize.scm (optimize): Enable all CPS2 passes. Wheee! Tweaks to bootstrap build order * module/Makefile.am (SOURCES): Since intmaps and intsets are used so much in CPS2, bump them up. Demote (language cps types). Add CPS2 verification pass * module/language/cps2/verify.scm: New diagnostic pass. * module/Makefile.am: Add verify.scm. * module/language/cps2/optimize.scm: Wire up verification pass. Always run the pass at the end, and if a variable is set run it between passes too. Refactor renumber.scm * module/language/cps2/renumber.scm (sort-labels-locally): Rewrite to be functional. Yay :) Port self-references pass to CPS2 * module/language/cps2/self-references.scm: New pass, ported from CPS. * module/language/cps2/optimize.scm: Wire up the self references pass. * module/Makefile.am: Add new file. Fix eta reduction on CPS2 * module/language/cps2/simplify.scm (compute-singly-referenced-vars): New helper. (compute-eta-reductions): Turns out, eta conversion on a graph doesn't work the same way that it works on nested terms -- since uses and defs are computed using the flow graph and not nested terms, we need to check additionally that the vars are singly-used. Fix intmap-ref bug * module/language/cps/intmap.scm (intmap-ref): Fix a case in which the not-found procedure could be called with an incorrect value. Fix slot allocation hinting for intervening terms that define dead values * module/language/cps/slot-allocation.scm (allocate-slots): Even if an expression does not define a live value, it might need a place to put its value. In that case we should stop scanning for hints, otherwise e.g. an (current-module) primcall whose value isn't used could clobber a hinted variable. Fix write beyond stack boundary in vm-engine.c * libguile/vm-engine.c (RETURN_ONE_VALUE, RETURN_VALUE_LIST): These helpers, used in subr-call and the like, might not actually have enough space to push the return values. Use ALLOC_FRAME instead of RESET_FRAME, for that reason. 2015-06-03 Andy Wingo Port type-fold to CPS2 * module/language/cps2/type-fold.scm: New file, ported from CPS. * module/language/cps2/optimize.scm: Wire up type-fold. * module/Makefile.am (CPS2_LANG_SOURCES): Add language/cps2/type-fold.cps. Add setk clause to with-cps * module/language/cps2/with-cps.scm: Add a setk clause kind. 2015-06-03 Andy Wingo Port CSE to CPS2 * module/language/cps2/cse.scm: New file, ported from CPS. * module/language/cps2/optimize.scm: Wire up CSE. * module/Makefile.am: Add language/cps2/cse.scm. * module/language/cps/compile-bytecode.scm (optimize): Disable prune-top-level-scopes on old CPS. It seems to not work if CSE has run beforehand. 2015-06-03 Andy Wingo Fix some cps2 utils bugs * module/language/cps2/utils.scm (compute-function-body): $callk does not add to a local function graph. (compute-successors): Fix extraction of "handler" continuation for $prompt. 2015-06-03 Andy Wingo Move some graph utilities from contification.scm to utils.scm * module/language/cps2/utils.scm (compute-successors): New helper. (compute-reverse-post-order): Move here from contification.scm and rename from "sort-nodes". (invert-graph): New helper. (compute-strongly-connected-components): Move here from contification.scm and rename from "compute-sccs". * module/language/cps2/contification.scm (sort-nodes, compute-sccs): Remove. 2015-06-02 Andy Wingo Port prune-bailouts pass to CPS2 * module/language/cps2/prune-bailouts.scm: New file. * module/language/cps2/optimize.scm: Wire up prune-bailouts pass. * module/Makefile.am (CPS2_LANG_SOURCES): Add language/cps2/prune-bailouts.scm. 2015-06-02 Andy Wingo Port elide-values pass to CPS2 * module/language/cps2/elide-values.scm: New file. * module/language/cps2/optimize.scm (optimize): Wire up elide-values. * module/Makefile.am: Add new file. prune-top-level-scopes elides with $values * module/language/cps2/prune-top-level-scopes.scm (prune-top-level-scopes): Given that cache-current-module! is an instruction, it will always continue to a nullary $kargs, so $values is actually the correct replacement and not a values primcall. Port specialize-primcalls pass to CPS2 * module/language/cps2/specialize-primcalls.scm: New file. * module/language/cps2/optimize.scm: Wire up specialize-primcalls. * module/Makefile.am: Add new file. Port inline-constructors pass to CPS2 * module/language/cps2/constructors.scm: New file. * module/language/cps2/optimize.scm: Enable inline-constructors pass. * module/Makefile.am: Add new file to build. 2015-06-02 Andy Wingo Factor with-cps out to separate module * module/language/cps2/with-cps.scm: New file. * module/language/tree-il/compile-cps2.scm: Use (language cps2 with-cps). * module/Makefile.am: Add language/cps2/with-cps.scm. * .dir-locals.el: Add indentation rules for with-cps. 2015-06-02 Andy Wingo Port contification pass to CPS2. * module/language/cps2/contification.scm: New pass, ported from CPS. Faster! * module/language/cps2/optimize.scm: Wire up contification pass. * module/Makefile.am: Add language/cps2/contification.scm. Add "intset" syntax to construct intsets. * module/language/cps/intset.scm (intset): New syntax. Add intmap-fold-right * module/language/cps/intmap.scm (make-intmap-folder): Add forward? argument. (intmap-fold): Adapt. (intmap-fold-right): New function. 2015-06-02 Andy Wingo Port prune-top-level-scopes pass to CPS2 * module/language/cps2/prune-top-level-scopes.scm: Port to CPS2. * module/language/cps2/optimize.scm: Enable prune-top-level-scopes pass. * module/Makefile.am (CPS2_LANG_SOURCES): Add prune-top-level-scopes.scm. 2015-06-02 Andy Wingo Fix compute-defining-expressions (and thereby compute-constant-values) * module/language/cps2/utils.scm (compute-defining-expressions): Fix not one but two bugs in this pattern. Grrr. 2015-06-02 Andy Wingo Add intmap-replace!. * module/language/cps/intmap.scm (intmap-replace!): New interface. * module/language/cps2/dce.scm (elide-type-checks): * module/language/cps2/simplify.scm (transform-conts): * module/language/cps2/utils.scm (intmap-map): * module/language/tree-il/compile-cps2.scm (cps-convert/thunk): Use intmap-replace!. 2015-06-02 Andy Wingo DCE uses type analysis to find dead code * module/language/cps2/dce.scm (compute-effects/elide-type-checks): New helper. (elide-type-checks): Implement. (fold-nested-functions): Remove. (compute-live-code): Call compute-effects/elide-type-checks. Port type inference module to CPS2 * module/Makefile.am: * module/language/cps2/types.scm: Port to CPS2. Relative to the CPS1 module, this one uses worklists, which should result in fewer visits, though it does use a different strategy for deciding when to saturate. We'll see! intset-next starting point is optional * module/language/cps/intset.scm (intset-remove): Remove incorrect comment. (intset-next): "i" is optional. Add intmap-replace. * module/language/cps/intmap.scm (intmap-replace): New interface. Fix type-fold on multiplying exact numbers * module/language/cps/types.scm (mul): Fix bug inferring results of exact multiplications. Fix regression in compute-idoms * module/language/cps2/utils.scm (compute-idoms): Adapt to previous change that makes intmap-ref throw when the key is not present. 2015-05-20 Andy Wingo Port dead code elimination (DCE) pass to CPS2 * module/language/cps2/dce.scm: New file. * module/language/cps2/optimize.scm: Enable CPS2 DCE pass. * module/Makefile.am: Add language/cps2/dce.scm. Port effects analysis to CPS2 * module/Makefile.am (CPS2_LANG_SOURCES): Add effects-analysis.scm. * module/language/cps2/effects-analysis.scm: New file, based on cps/effects-analysis.scm. * module/language/cps2/utils.scm (intmap-map): (compute-defining-expressions, compute-constant-values): New helpers. Fix bug in CPS2 simplify's "transform-conts" * module/language/cps2/simplify.scm (transform-conts): Return a persistent intmap. intmaps and intsets print with abbreviated key ranges * module/language/cps/intset.scm (intset-key-ranges, range-string): (print-helper, print-intset, print-transient-intset): New helpers. Install as intset printers. * module/language/cps/intmap.scm (intmap-key-ranges, range-string): (print-helper): New helpers. (print-intmap, print-transient-intmap): Call the new helpers. 2015-05-20 Andy Wingo Add arity to worklist-fold * module/language/cps2/utils.scm (worklist-fold): Add two-seeded arity. (worklist-fold2): Remove. * module/language/cps2/renumber.scm (compute-tail-path-lengths): Adapt. 2015-05-20 Andy Wingo Variadic intset-fold, intmap-fold * module/language/cps/intmap.scm (intmap-fold): Add two-seeded arity. * module/language/cps/intset.scm (intset-fold): Merge intset-fold2 into this function, as a two-seeded arity. * module/language/cps2/simplify.scm (compute-eta-reductions): (compute-singly-referenced-labels, compute-beta-reductions): Adapt intset-fold2 callers. 2015-05-20 Andy Wingo Intmaps do not treat #f specially as a value * module/language/cps/intmap.scm: Intmaps can now contain any value; #f does not indicate the absence of a value. Instead we use a unique private sentinel to mark absent values or branches. (*absent*, absent?, present?): New helpers. (new-branch): Initialize empty elements to *absent*. (clone-branch-with-edit): New helper. (clone-branch-and-set): Use clone-branch-with-edit. (writable-branch): Use clone-branch-with-edit (empty-intmap): Initialize value to *absent*. (add-level): clone-branch-and-set doesn't take #f as a branch any more; use new-branch. (branch-empty?, make-intmap/prune, intmap-add!): (intmap-add, intmap-remove, intmap-next, intmap-prev): (intmap-fold, intmap-union, intmap-intersect): Use absent? to detect absent branches / values. (intmap-ref): Likewise. Instead of returning #f if the value is not found, call the optional not-found procedure. By default this will signal an error. * module/language/cps/types.scm: * module/language/cps2/renumber.scm: * module/language/cps2/simplify.scm: Adapt to intmap-ref signalling an error by default if the value is not found. * module/language/tree-il/compile-cps2.scm: Adapt to intmap-add signalling an error if #f was in the intmap as a value. 2015-05-20 Andy Wingo Add two-argument fixpoint arity * module/language/cps2/utils.scm (fixpoint): Add two-argument arity. Fix bug compiling fixpoint combinator * module/language/tree-il/peval.scm (): Rename "alias-value" field to "alias", which is now an operand and not an expression. This allows the operand to capture its environment; before, the alias was being visited in its use environment instead of its definition environment. (peval): Adapt to operand change. Fix construction of rest bindings as well. * test-suite/tests/peval.test ("partial evaluation"): New test. Fix fixpoint * module/language/cps2/utils.scm (fixpoint): Fix embarrassing bug where it wouldn't actually fixpoint! Didn't show up in practice because CPS2 hasn't run after contification yet. Fix sub/- primcall bug * module/language/tree-il/compile-cps2.scm (convert): Fix bug in (apply - ...), because the instruction for "-" is "sub", and "sub" lookup was failing. Caught by numbers.test. Really I would like to get rid of $prim, somehow. 2015-05-12 Andy Wingo Add optimization pass over CPS2 * module/language/cps2/optimize.scm: New file. * module/language/cps2/simplify.scm: New file, factored out of simplify2.scm. * module/language/cps/simplify2.scm: Remove, as it's obsolete. * module/language/cps2/compile-cps.scm: Optimize the CPS. * module/Makefile.am: Adapt for added and deleted files. 2015-05-11 Andy Wingo Consolidate CPS2 above CPS in the compiler This is an intermediate step. We'll replace CPS bit by bit. If it turns out to be a terrible idea we can just revert. * module/Makefile.am (TREE_IL_LANG_SOURCES): Remove compile-cps.scm. (CPS_LANG_SOURCES): Remove arities.scm. * module/language/cps/arities.scm: Remove. * module/language/tree-il/compile-cps.scm: Remove. * module/language/tree-il/spec.scm: Remove use of compile-cps.scm. * module/language/cps/compile-bytecode.scm: Remove use of arities.scm. Instead, incoming terms are expected to call their continuations with the correct number of arguments. 2015-05-11 Andy Wingo Adapt return arities in Tree-IL -> CPS2 conversion * module/language/tree-il/compile-cps2.scm (adapt-arity): New procedure. This is equivalent to (language cps arities), but as it is a necessary pass and not an optimization it's more proper to put it in the converter itself. Unlike with the nested CPS representation, it's possible to look up continuations without making a DFG. (convert): Adapt arities as necessary. Build CPS2 with transient intmaps * module/language/tree-il/compile-cps2.scm (with-cps) (cps-convert/thunk): Use transient intmaps. 2015-05-09 Andy Wingo Tree-IL -> CPS2 -> CPS * module/language/tree-il/spec.scm (tree-il): Compile to CPS2 instead of CPS. compute-dom-edges returns a persistent intmap * module/language/cps/utils.scm (compute-dom-edges): Return a persistent intmap. Fixes strange bootstrapping failures that I don't understand :/. Fix another intset transient bug * module/language/cps/intset.scm (intset-add!): If the root is a branch but isn't editable, be sure to actually update the transient intset's root to store the writable root. Fix intset-add! transient bug * module/language/cps/intset.scm (intset-add!): Fix as in 0f082bd3f7ad4854333728c6d0f71ef7df1fbec3. 2015-05-08 Andy Wingo Fix convert-cps2 for "not" primcalls * module/language/tree-il/compile-cps2.scm (convert): Fix typo in "not" compilation. Fix intmap-add! transient bug * module/language/cps/intmap.scm (intmap-add!): Fix a bug creating a transient branch out of a persistent branch. Register up cps2 compiler with language tower * module/language/tree-il/compile-cps2.scm (compile-cps2): Rename from compile-cps. * module/language/cps2/spec.scm: New file. * module/Makefile.am (CPS2_LANG_SOURCES): Add spec.scm. * module/language/tree-il/spec.scm (tree-il): Declare compiler to cps2. cps2: Fix parse-cps for `prompt' * module/language/cps2.scm (parse-cps): Fix for `prompt'. Add compiler from tree-il to cps2 * module/language/tree-il/compile-cps2.scm: New file. * module/Makefile.am: Add the file to the build. 2015-05-08 Andy Wingo Beginnings of CPS2 language. The tentative plan is to replace CPS with CPS2, and to rename CPS2 to CPS. We will add a pass to compile tree-il to CPS2, then work from the top down to replace the CPS compiler passes. * module/language/cps2.scm: * module/language/cps2/compile-cps.scm: * module/language/cps2/renumber.scm: * module/language/cps2/utils.scm: New files. * module/Makefile.am: Add new files to build. 2015-05-08 Andy Wingo Add printers for and * module/language/cps/intmap.scm (intmap->alist, print-intmap) (print-transient-intmap): New functions. Install the new functions as printers for and . 2015-04-08 Andy Wingo Add "cps2" experiment * module/Makefile.am: Add new file to makefile. * module/language/cps/simplify2.scm: New file. Transient intsets * module/language/cps/intset.scm (make-atomic-reference) (get-atomic-reference, set-atomic-reference!): New functions. (*branch-size-with-edit*, *edit-index*): New constants. (): New data type. (new-branch, clone-branch-and-set): Adapt to set edit field. (transient-intset, persistent-intset): New exports. (intset-add!): New interface, supporting "transient" intsets. (intset-ref, intset-next, intset-prev, intset-fold, intset-fold2): Work with transients. Add "transient" intmap interface * module/language/cps/intmap.scm (make-atomic-reference): (get-atomic-reference, set-atomic-reference!): New helpers. (*branch-size-with-edit*, *edit-index*): Branches now have a trailing field, an atomic reference to their owner. (): New record type. A mutable intmap. (new-branch): Set the "edit" field on the branch. (clone-branch-and-set): No editor for this field. (assert-readable!, writable-branch): New helpers. (transient-intmap, persistent-intmap): New exported functions. (intmap-add!): New function. (intmap-next, intmap-prev, intmap-ref): Work on transient intmaps. (intmap-fold): Persist the intmap before folding over it. 2015-04-01 Andy Wingo 32-way branching in intmap.scm, not 16-way * module/language/cps/intmap.scm (*branch-bits*): Switch to 32-way branching. Marginally faster on lookup, and creation costs can be amortized via using the transient interface. Marginal speedup for assembler.scm compilation. Intset-next micro-optimizations * module/language/cps/intset.scm (intset-next): Micro-optimizations. Add intset-fold, intset-fold2 * module/language/cps/intset.scm (intset-fold, intset-fold2): New functions. Add intmap-fold. * module/language/cps/intmap.scm (intmap-fold): New function. Add intmap-prev * module/language/cps/intmap.scm (intmap-next): Starting index is optional. (intmap-prev): New function. Default "meet" operator is meet-error for intmap * module/language/cps/intmap.scm (meet-error): New helper. (intmap-add, intmap-union, intmap-intersect): The "meet" argument is optional and defaults to meet-error. Remove "free" field of $fun * module/language/cps.scm ($fun): Remove unused "free" field. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-bailouts.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/renumber.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/specialize-primcalls.scm: * module/language/cps/type-fold.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt all callers. 2015-04-01 Andy Wingo Replace $letrec with $rec * module/language/cps.scm ($rec): Replace $letrec with $rec, which is an expression, not a term. This means that the names bound by the letrec appear twice: once in the $rec term, and once in the continuation. This is not very elegant, but the situation is better than it was before. Adapt all callers. * doc/ref/compiler.texi (CPS in Guile): Incomplete documentation updates. I'll update these later when the IL settles down. 2015-04-01 Andy Wingo Precise range inference on <, <=, >=, > branches * module/language/cps/types.scm (restricted-comparison-ranges): New helper. (define-comparison-inferrer): New helper. (<, <=, >=, >): Infer ranges precisely. Fix intmap bug for maps with only one element * module/language/cps/intmap.scm (intmap-ref): Fix bug referencing values when there is only one value in the map. 2015-03-30 Ludovic Courtès elf: Add missing argument in 'elf-segment'. * module/system/vm/elf.scm (elf-segment): Add missing argument N. 2015-03-12 Andy Wingo Only lazily compile where profitable * module/ice-9/eval.scm (primitive-eval): Only lazily compile box-ref on toplevel variables; otherwise compile eagerly to avoid the indirection. Optimize branches in the evaluator * module/ice-9/eval.scm (primitive-eval): Factor out primitive=? helper. Simplify compile-top-call. Add compile-top-branch for primcall branches, so the compiler can see the specialized branch operator. Primcall inlining in eval.scm, lazy function body compilation * module/ice-9/eval.scm (primitive-eval): Lazily compile lambda bodies. Special-case calls to top-level or module variables, and recognize some of those calls as primcalls. In that case, emit closures with the primcalls. Remove unused "nargs" field of memoized call expressions * libguile/eval.c (eval): * libguile/memoize.c (MAKMEMO_CALL, memoize, unmemoize): * module/ice-9/eval.scm (primitive-eval): Remove "nargs" field from memoized call expressions, and adapt callers. Marginal bootstrap memory improvements * module/language/cps/compile-bytecode.scm (optimize, compile-bytecode): Marginally improve bootstrap memory usage by not retaining stale copies of already-rewritten terms. 2015-03-11 Andy Wingo Remove $void CPS expression type * module/language/cps.scm: Remove the $void expression type, replaced by $const of the unspecified value. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/renumber.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/specialize-primcalls.scm: * module/language/cps/types.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Update callers. 2015-03-09 Andy Wingo Adapt GDB integration to newest patches * libguile/libguile-2.2-gdb.scm (vm-frame-function-name): Don't default to the address, as we will have better identifying info via the file name. (vm-frame-source): New helper. (compile-time-cond): For some reason "else" matching wasn't working; punt and use expressions. (snarfy-frame-decorator): Rename from decorator, and adapt to new version of Guile frame filter patch. (vm-frame-filter): Adapt to frame filter changes, and fill in source info. Re-implement (ice-9 streams) in terms of (srfi srfi-41) * module/ice-9/streams.scm: Re-implement in terms of SRFI-41. Passes tests. 2015-03-07 Mark H Weaver build: Use pipe symbol instead of comma for substitutions. * meta/Makefile.am (substitute): Use pipe symbol instead of comma for substitutions. 2015-02-18 Daniel Llorens Non-vector 1D arrays print as #1() * libguile/arrays.c (scm_i_print_array): Print the dimension whenever the array is a true scm_tc7_array. * test-suite/tests/arrays.test: Check that non-vector 1D arrays print as expected. 2015-02-17 Andy Wingo Struct and array GDB pretty printers hint as arrays * libguile/libguile-2.2-gdb.scm (make-scm-pretty-printer-worker): (%scm-pretty-printer): Refactor to avoid printing all struct / array fields by hinting these as arrays. The resulting print is not as faithful to the original data, but that's probably OK. 2015-02-17 Andy Wingo GDB support: add frame annotators and filters These features depend on a patch to GDB that has not been merged yet. If GDB doesn't support the annotator/filter interface, the code have no effect. * libguile/libguile-2.2-gdb.scm (compile-time-cond): New helper. (snarfy-frame-annotator): Simple annotator that gives subr names for snarfed gsubrs. (vm-frame-filter): New filter that interleaves Scheme frames with C frames on the stack when the user asks for a backtrace. 2015-02-17 Andy Wingo De-bitrot libguile-2.2-gdb.scm * libguile/libguile-2.2-gdb.scm: Update to work with Guile 2.2 stacks. Represent the VM stack as a SRFI-41 stream, which will work better with the frame filter interface. Add support for getting the vm frame's function name, if possible. 2015-02-17 Andy Wingo (system base types) knows about variables * module/system/base/types.scm (%tc7-variable): New tc7. (cell->object): Handle tc7-variable. * test-suite/tests/types.test ("opaque objects"): Add a test. 2015-02-13 Andy Wingo Fix infinite loop in expander * module/ice-9/psyntax.scm (resolve-identifier): There is a case where a syntax object can resolve to itself. Prevent an infinite loop in that case by continuing to resolve by name. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syncase.test ("infinite loop bug"): Add a test. 2015-02-10 Andy Wingo Add `scm_smob_type_class()'. * libguile/smob.h: * libguile/smob.c (scm_smob_type_class): New function, to access the GOOPS class for a SMOB type. 2015-02-09 Andy Wingo NEWS and doc updates * doc/ref/vm.texi: Update for new instructions. * doc/ref/web.texi: Update for URI-reference support. * NEWS: Update. 2015-02-08 Andy Wingo Document support for URI references. * doc/ref/web.texi (URIs): Update for URI reference changes. 2015-02-06 Andy Wingo Reify bytevector? in the correct module * module/language/cps/reify-primitives.scm (primitive-module): Reify bytevector? in the correct module. Thanks to Nala Ginrut for the report. 2015-02-06 Andy Wingo Add #:static-slot-allocation? * libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_STATIC): Reserve the fourth GOOPS flag to indicate that a class has static slot allocation. * libguile/goops.c (scm_init_goops_builtins): Define vtable-flag-goops-static for goops.scm. * module/oop/goops.scm (class-has-statically-allocated-slots?): New helper. (build-slots-list): Instead of the ad-hoc checks for or , use the new helper. (initialize): Accept #:static-slot-allocation? keyword. * module/system/foreign-object.scm (make-foreign-object-type): Declare foreign object classes as having static slot allocation. * test-suite/tests/goops.test ("static slot allocation"): Add tests. 2015-02-06 Andy Wingo Fix foreign objects for getter method change * module/system/foreign-object.scm: Fix getters after change to make instances only apply to their precise specializer types. 2015-01-26 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/goops.c libguile/vm-engine.h module/oop/goops.scm module/oop/goops/compile.scm module/oop/goops/dispatch.scm test-suite/tests/goops.test 2015-01-26 Andy Wingo Accessor methods only apply to subclasses with their slot * libguile/goops.c (is_accessor_method, scm_compute_applicable_methods): Fix regression from 51f66c912078a25ab0380c8fc070abb73d178d98 (2009). Accessor methods are added on each subclass on which the slot is present; therefore if a subclass doesn't have a method, then the methods doesn't apply. Truly fixes #17355, unlike 583a23bf104c84d9617222856e188f3f3af4934d. * module/oop/goops.scm (compute-cmethod, compute-getter-method) (compute-setter-method): Revert earlier changes. * test-suite/tests/goops.test ("accessor slots"): Update for new expectations, in agreement with Guile 1.8. 2015-01-25 Andy Wingo Fix verify-cps * module/language/cps/verify.scm (verify-cps): Fix. Thanks to Steven H. Margolis for the note. Fixes bug #19389. 2015-01-24 Andy Wingo Fix accessor struct field inlining * module/oop/goops/compile.scm: Inline into goops.scm, leaving a compatible interface stub behind. * module/oop/goops/dispatch.scm: Don't import (oop goops compile), to break circularities. * module/oop/goops.scm: Move (oop goops util) include up to the top, and import (ice-9 match). (compute-cmethod): Move here from compile.scm. Add a special case for accessor methods, so as to fix bug #17355. (compute-getter-method, compute-setter-method): #:procedure slot is now generic. * test-suite/tests/goops.test ("accessor slots"): New test. 2015-01-24 Andy Wingo Fix accessor struct inlining in GOOPS Fixes bug #17355. * module/oop/goops.scm (memoize-effective-method!): Adapt to compute-effective-method change. (compute-effective-method, %compute-effective-method): Renamed from compute-cmethod; now a generic protocol. (compute-specialized-effective-method) (%compute-specialized-effective-method): New sub-protocol. (memoize-generic-function-application!): Adapt to call the hard-wired compute-applicable-methods based on the concrete arguments types -- the semantics is that %compute-applicable-methods is the implementation for functions. Perhaps we should do the same for sort-applicable-methods and method-more-specific?. (compute-getter-method, compute-setter-method): The standard #:procedure is now a generic slot-ref. It wasn't valid to inline field access here, because subtypes could have different field layouts. (compute-applicable-methods): Refactor generic definition to use lexical scoping. (compute-specialized-effective-method): New method for , which does field access inlining based on the concrete types being applied. * test-suite/tests/goops.test ("accessor slots"): New test. 2015-01-23 Andy Wingo Simplify and optimize slot access * module/oop/goops.scm (fold-slot-slots): Add `slot-ref/raw' slot, which is what the slot-ref slot was. Now the slot-ref slot checks that the slot is bound, if needed. (slot-definition-slot-ref/raw): Define. (make-slot): Adapt. Also, effective slot definition slots have no initargs. (define-standard-accessor-method, bound-check-get, standard-get) (standard-set): Move definitions up. (allocate-slots): Adapt. If the slot has an init thunk, we don't need to check that it's bound. (slot-ref, slot-set!, slot-bound?): Simplify. (class-slot-ref): Use the raw getter so that we can call `slot-unbound' with just the class. (compute-getter-method, compute-setter-method): Simplify to just use the slot-ref / slot-set! functions from the slot. (%initialize-object): Simplify. Export from GOOPS * module/oop/goops.scm (): Export. This is the way to tell if you have new GOOPS or not: whether is defined. Simplify GOOPS effective method cache format * module/oop/goops.scm (single-arity-cache-dispatch) (compute-generic-function-dispatch-procedure) (memoize-effective-method!): Simplify format of effective method cache. 2015-01-23 Andy Wingo Fast generic function dispatch without calling `compile' at runtime * module/oop/goops.scm: Rewrite generic function dispatch to use chained closures instead of compiling specific dispatch procedures. The big speed win before was not allocating rest arguments, which we gain by simply pre-generating dispatchers for arities of up to 20 arguments. Also now a tail call without reshuffling arguments -- which is what dispatch now is -- is just a (mov 0 new-procedure) and (tail-call), which is pretty cheap. (%invalidate-method-cache!): Use the new recompute-generic-function-dispatch-procedure!. (arity-case, multiple-arity-dispatcher, single-arity-dispatcher) (single-arity-cache-dispatch) (compute-generic-function-dispatch-procedure) (recompute-generic-function-dispatch-procedure!): New internal interfaces. (memoize-effective-method!): Update for new interfaces. (memoize-generic-function-application!): Rename from `memoize-method!'. 2015-01-23 Andy Wingo GOOPS cosmetics * module/oop/goops.scm: More commenting. Move around in the export section. Update (oop goops save) for objects * module/oop/goops/describe.scm (describe): Remove commented code. * module/oop/goops/save.scm (get-set-for-each, access-for-each): Update these hoary routines for the new universe. Fix foreign objects for removal of getters-n-setters * module/system/foreign-object.scm (getter-method): Fix for removal of getters-n-setters property. Minor GOOPS cleanups * module/oop/goops.scm: Minor commenting fixes. Optimize %initialize-object * module/oop/goops.scm (%initialize-object): Optimize by inlining the slot initialization, and by avoiding multiple checks for initargs validity. Inline internal slot accessors * module/oop/goops.scm (define-slot-accessor): Also define internal accessors without the type check for when we know that the object is a slot. Adapt struct-ref users to use these variants. Inline helpers into slot-ref, slot-set!, etc * module/oop/goops.scm (%class-slot-definition): New helper. (class-slot-definition): Use the new helper. (get-slot-value-using-name, set-slot-value-using-name!) (test-slot-existence): Remove helpers. (slot-ref, slot-set!, slot-bound?, slot-exists?): Inline helpers for speed. 2015-01-23 Andy Wingo Use a vtable bit to mark instances * libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_SLOT): Allocate another vtable flag to indicate that instances of this vtable are slots. * libguile/goops.c (scm_init_goops_builtins): Export vtable-flag-goops-slot to Scheme. * module/oop/goops.scm (, slot?, make-standard-class, initialize): Arrange for classes to have the vtable-flag-goops.slot. (build-slots-list): Ensure that slots are statically laid out. 2015-01-23 Andy Wingo Introduce objects in GOOPS * module/oop/goops.scm (fold-class-slots): Change format to use proper slot specifications. (fold-slot-slots): Flesh out with all needed slots. (): Update cons-layout to deal with new fold-class-slots form. Don't create slots; we do that later. (is-a?, get-keyword, *unbound, unbound?, %allocate-instance): Move definitions up. (, slot?): New definitions. (slot-definition-name, slot-definition-allocation) (slot-definition-init-keyword, slot-definition-init-form) (slot-definition-init-value, slot-definition-init-thunk) (slot-definition-options, slot-definition-getter) (slot-definition-setter, slot-definition-accessor) (slot-definition-slot-ref, slot-definition-slot-set!) (slot-definition-index, slot-definition-size): New definitions as accessors on objects. (class-slot-definition): Adapt to class-slots change. (direct-slot-definition-class, make-slot): New definitions. (make): Define a boot version that can allocate instances. (compute-direct-slot-definition) (compute-direct-slot-definition-initargs) (effective-slot-definition-class, compute-effective-slot-definition): New definitions. (build-slots-list): Adapt to slots being objects. (compute-get-n-set): New boot definition. (allocate-slots): New definition. Replaces compute-getters-n-setters. (%compute-layout, %prep-layout): Adapt to changes. (make-standard-class): Make objects for direct-slots, and handle the allocate-slots protocol. (): Inherit from . (get-slot-value-using-name, set-slot-value-using-name!) (test-slot-existence): Adapt to using slot definition objects. (make-class): Allow slot specs or objects as the `slots' argument. (write): New method on . (class-slot-ref, class-slot-set!): Reimplement. (compute-slot-accessors, compute-getter-method) (compute-setter-method): Adapt to changes. (compute-getters-n-setters): Remove. Yay! (compute-get-n-set): Adapt to use effective slot definitions instead of the getters-n-setters for #:class / #:each-subclass allocation. (%initialize-object): Adapt. (initialize): New method for . Adapt method for . * module/oop/goops/active-slot.scm (compute-get-n-set): * module/oop/goops/composite-slot.scm (compute-propagated-get-n-set): Use slot-definition-options to access options of slot. * test-suite/tests/goops.test ("bad init-thunk"): Fix to be a "pass-if" instead of an "expect-fail". 2015-01-23 Andy Wingo Beginnings of slot definition class * module/oop/goops.scm (define-macro-folder): Factor out this helper. (fold-class-slots): Implement using define-macro-folder. (fold-slot-slots): New definition, for slots of . (define-slot-indexer): New helper. Use to define indexes for slots of and of . 2015-01-23 Andy Wingo The GOOPS "unbound" value is a unique pair * libguile/goops.c (SCM_GOOPS_UNBOUND, SCM_GOOPS_UNBOUNDP): Remove internal macros. (scm_make_unbound, scm_unbound_p): Remove internal functions. (scm_sys_clear_fields_x): Add "unbound" parameter, for the init value. * module/oop/goops.scm (*unbound*): Define in Scheme as a simple heap-allocated value. (unbound?): New definition. (%allocate-instance): Pass *unbound* to %clear-fields!. (make-class, slot-definition-init-value) (slot-definition-init-form, make-closure-variable): Use *unbound* instead of (make-unbound), which is now gone. * module/oop/goops/active-slot.scm (compute-get-n-set): Use *unbound* instead of make-unbound. This module uses the GOOPS internals module; perhaps we should export make-unbound or something... * module/oop/goops/save.scm (make-unbound): Export our own make-unbound definition, for use by residualized save code. * module/language/ecmascript/base.scm (, *undefined*): Use a unique object kind and instance for the undefined value. * libguile/vm.c (scm_i_vm_mark_stack): Fill the stack with SCM_UNSPECIFIED instead of SCM_UNBOUND. 2015-01-23 Andy Wingo GOOPS: Deprecate "using-class" procs like slot-ref-using-class * libguile/deprecated.h: * libguile/goops.c: * libguile/goops.h: * libguile/deprecated.c (scm_slot_ref_using_class): (scm_slot_set_using_class_x): (scm_slot_bound_using_class_p): (scm_slot_exists_using_class_p): Deprecate. * module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!) (slot-bound-using-class?, slot-exists-using-class?): Deprecate. Change to check that `class' is indeed the class of `obj', as required, and then dispatch to slot-ref et al. 2015-01-23 Andy Wingo change-object-class refactor * module/oop/goops.scm (change-object-class): Refactor to use slot-ref, slot-bound?, and slot-set! instead of the using-class? variants. slot-ref, slot-set! et al bypass "using-class" variants * module/oop/goops.scm (slot-ref, slot-set!, slot-bound?, slot-exists?): Bypass slot-ref-using-class, slot-set-using-class!, and so on. Those interfaces are public and have to check that the class is indeed a class, they should check that the object is an instance of the class, and so on, whereas if we get the class via class-of we know that the invariant holds. 2015-01-23 Andy Wingo Manipulate GOOPS vtable flags from Scheme, for speed * libguile/goops.h: Remove unimplemented declarations of scm_make_next_method, scm_sys_invalidate_method_cache_x, and stklos_version. (scm_sys_invalidate_class_x): Remove helper definition. This was exported in the past but shouldn't have been. * libguile/goops.c (scm_sys_make_vtable_vtable): Rename from scm_sys_make_root_class, and don't do anything about flags. (scm_sys_bless_applicable_struct_vtables_x, scm_class_p) (scm_sys_invalidate_class_x): Remove; we do these in Scheme now. (scm_init_goops_builtins): Define Scheme values for vtable flags. * module/oop/goops.scm (vtable-flag-goops-metaclass) (class-add-flags!, class-clear-flags!, class-has-flags?) (class?, instance?): New definitions. (): Add GOOPS metaclass flags from Scheme. (, ): Add flags from Scheme. (make, initialize): Add class flags as appropriate. (class-redefinition): Clear the "valid" flag on the old class. (check-slot-args): Use instance? instead of a CPL check. 2015-01-23 Andy Wingo GOOPS class slot indices defined as inline values * module/oop/goops.scm (define-class-index): Define as inline values. `match' refactor in goops.scm * module/oop/goops.scm (compute-dispatch-procedure): Use `match'. Convert emit-linear-dispatch to use match * module/oop/goops.scm (emit-linear-dispatch): Convert to use `match'. More GOOPS cleanups * module/oop/goops.scm (build-slots-list): Use `match'. (make-standard-class): Formatting fixes. when and unless for one-armed ifs in goops.scm * module/oop/goops.scm: Consistently use when or unless for one-armed ifs. More GOOPS comments * module/oop/goops.scm: More expository comments. Commenting in goops.scm * module/oop/goops.scm: More narrative cleanup. Narrative reordering in goops.scm * module/oop/goops.scm: Reorder for narrative. scm_make cleanup * libguile/goops.c (scm_make): Remove SCM_DEFINE around scm_make; the real definition is in Scheme. 2015-01-23 Andy Wingo Add compute-cpl tests * test-suite/tests/goops.test: Add tests for compute-cpl based on comments from goops.scm. * module/oop/goops.scm (compute-std-cpl): Remove comment, and add docstring. (compute-cpl): Improve comment. 2015-01-23 Andy Wingo Fold (oop goops util) into (oop goops) * module/oop/goops/util.scm: Removed. Instead we fold these definitions into goops.scm. * module/oop/goops/save.scm: Remove useless import of util.scm. * module/oop/goops.scm: Fold in util.scm. Since we always use add-interesting-primitive!, import (language tree-il primitives) in the header. Clean up some early comments, and use of eval-when. * module/Makefile.am: Adapt. 2015-01-23 Andy Wingo GOOPS utils module cleanups * module/oop/goops.scm (make-class): Inline find-duplicate to its use site. * module/oop/goops/util.scm (improper->proper): Remove unused function. (any, every): Don't re-export these from SRFI-1; users can get them from SRFI-1 directly. 2015-01-23 Andy Wingo append-map rather than mapappend * module/oop/goops/util.scm: Remove mapappend alias; SRFI-1 append-map should be used instead. GOOPS cleanup to use SRFI-1 better * module/oop/goops.scm (class-subclasses, class-methods): Reimplement using stock SRFI-1 procedures. Cosmetic goops refactors. * module/oop/goops.scm: Update comments. * libguile/goops.c: Cosmetic reorderings, re-commentings, and de-commentings. 2015-01-23 Andy Wingo Incorporate %inherit-magic! into %init-layout! * libguile/goops.c (scm_make_standard_class, scm_sys_init_layout_x): Move definitions up. Incorporate scm_sys_inherit_magic_x into scm_sys_init_layout_x. * libguile/goops.h: Remove scm_sys_init_layout_x declaration. 2015-01-23 Andy Wingo goops.c no longer knows about slot allocation * libguile/goops.c (scm_class_of): Access "redefined" slot by name in the case where we need to change the class of an instance. (scm_sys_goops_early_init): Move up capture of class-precedence-list so SCM_SUBCLASSP can use it. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_redefined) (scm_si_direct_supers, scm_si_direct_slots, scm_si_direct_subclasses) (scm_si_direct_methods, scm_si_cpl scm_si_slots) (scm_si_getters_n_setters, SCM_N_CLASS_SLOTS, SCM_OBJ_CLASS_REDEF): Remove. Now C code has no special knowledge about the layout of GOOPS classes. (SCM_SUBCLASSP): Use scm_class_precedence_list to get CPL. (SCM_INST, SCM_ACCESSORS_OF): Remove unused macros that were undocumented and nonsensical. 2015-01-23 Andy Wingo Reimplement inherit-applicable! in Scheme * libguile/goops.c: Move captured keywords and symbols up to the top. (scm_i_inherit_applicable): Dispatch to Scheme. (scm_sys_goops_early_init): Capture inherit-applicable!. * module/oop/goops.scm (inherit-applicable!): Scheme implementation. 2015-01-23 Andy Wingo Reimplement %allocate-instance in Scheme * libguile/goops.c (scm_sys_clear_fields_x): New function. (scm_sys_allocate_instance): Remove. It was available to C but not to Scheme and it's really internal. * libguile/goops.h: Remove scm_sys_allocate_instance. * module/oop/goops.scm (%allocate-instance): Implement in Scheme, using allocate-struct and %clear-fields!. (make, shallow-clone, deep-clone, allocate-instance): Adapt to %allocate-instance not taking an initargs argument. 2015-01-23 Andy Wingo Re-use the vtable "size" field for GOOPS nfields * module/oop/goops.scm (fold--slots): The first "reserved" slot is actually for instance sizes, used by the "simple struct" mechanism. Reuse this field for GOOPS's "nfields". (make-standard-class, , initialize): Adapt order of field initializations. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, SCM_N_CLASS_SLOTS) * libguile/goops.c (scm_sys_allocate_instance): Adapt. 2015-01-23 Andy Wingo Move initialization to Scheme * libguile/goops.c (scm_sys_make_root_class): Just make the vtable-vtable, and leave initialization to Scheme. * libguile/struct.c (scm_i_make_vtable_vtable): Change to take a full list of fields, not just the extra fields. (scm_init_struct): Adapt to scm_i_make_vtable_vtable change. * module/oop/goops.scm (): Compute layout for , and initialize from here. 2015-01-23 Andy Wingo Deprecate scm_get_keyword * libguile/deprecated.c (scm_get_keyword): Deprecate. * libguile/deprecated.h: * libguile/goops.c: * libguile/goops.h: 2015-01-23 Andy Wingo Rewrite %initialize-object in Scheme * libguile/goops.h: * libguile/goops.c (scm_sys_initialize_object): Remove C interface. This function was only really useful as part of a GOOPS initialize method but was not exported from the goops module. * module/oop/goops.scm (get-keyword, %initialize-object): Implement in Scheme. 2015-01-23 Andy Wingo Minor goops.c tidying * libguile/goops.c: Reorder static variables. Remove unused sym_procedure. 2015-01-23 Andy Wingo Remove scm_c_extend_primitive_generic * libguile/goops.h (scm_c_extend_primitive_generic): Remove public interface. This was introduced in 2003 with the "extended" generics but never documented, unused as far as I can tell, and is better accessed from Scheme. * libguile/goops.c: Remove support for scm_c_extend_primitive_generic. Simplify capture of change-class. 2015-01-23 Andy Wingo No more concept of "pure generics" * libguile/goops.h (SCM_PUREGENERICP, SCM_VALIDATE_PUREGENERIC) (SCM_VTABLE_FLAG_GOOPS_PURE_GENERIC, SCM_CLASSF_PURE_GENERIC): Remove. * libguile/goops.c (scm_set_primitive_generic_x): Use SCM_GENERICP, not SCM_PUREGENERICP. (scm_sys_bless_pure_generic_vtable_x): Remove; this flag isn't checked. * module/oop/goops.scm: Don't call %bless-pure-generic-vtable!; there's no need. 2015-01-23 Andy Wingo Remove TEST_CHANGE_CLASS * libguile/goops.c (TEST_CHANGE_CLASS): Remove unused macro and comment. Remove pure-generic? * libguile/goops.h: * libguile/goops.c (scm_pure_generic_p): Remove function only compiled in debug mode. Goops slot-unbound / slot-missing cleanups * libguile/goops.c: Remove useless slot-unbound / slot-missing captures. Move slot-ref et al to Scheme * libguile/goops.c: * module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!): (slot-bound-using-class?, slot-exists-using-class?, slot-set!): (slot-bound?, slot-exists?): Move implementation to Scheme. Port method and generic accessors to Scheme * libguile/goops.c: * module/oop/goops.scm (generic-function-methods) (method-generic-function, method-specializers, method-procedure): Port to Scheme. 2015-01-23 Andy Wingo accessors implemented in Scheme * libguile/goops.c (scm_class_p): New internal helper, exported to goops.scm. (scm_class_name, scm_class_direct_supers, scm_class_direct_slots): (scm_class_direct_subclasses, scm_class_direct_methods): (scm_class_precedence_list, scm_class_slots): Dispatch to Scheme. (scm_sys_goops_early_init): Capture accessors. * module/oop/goops.scm (define-class-accessor): New helper. (class-name, class-direct-supers, class-direct-slots): (class-direct-subclasses, class-direct-methods) (class-precedence-list, class-slots): Define in Scheme. (compute-std-cpl, compute-cpl): Move lower. 2015-01-23 Andy Wingo goops: use computed class slot offsets; untabify and fix whitepace * module/oop/goops.scm: Untabify and remove trailing whitespace. Change slot-ref on classes to struct-ref of fixed offsets. Statically compute offsets for slots of in Scheme * module/oop/goops.scm (macro-fold-left): New helper. (define-class-index): Define class-index-FOO for each slot FOO. (fold--slots): Make the slots list have the marks of the "visit" macro. Refactor to slot computation * module/oop/goops.scm (macro-fold-right, fold--slots, ): Use a macro folder to define (and redefine) class slots. We'll use this to compute static indices as well. Remove GOOPS random state * libguile/goops.c: Remove GOOPS random state, now that there are no more hashsets. More goops.c cleanups, and fix a security issue * libguile/goops.c: Remove unused #includes. (make_class_name): New helper, replaces unsafe use of sprintf. (scm_make_extended_class): Rewrite to call scm_make_standard_class directly. (scm_make_port_classes): Rewrite to use scm_make_standard_class, and no need to patch the CPL any more. Remove unused union scm_t_debug_info * libguile/debug.h (union scm_t_debug_info): Remove unused type declaration. More unused code removal in GOOPS * libguile/goops.c: Remove unused sym_memoize_method_x. Remove private var_no_applicable_method capture * libguile/goops.c (var_no_applicable_method): Remove unused capture. (sym_no_applicable_method): Remove unused symbol. Remove scm_assert_bound * libguile/goops.c (scm_assert_bound): Remove unexported unused helper. * module/oop/goops.scm (make-generic-bound-check-getter): Change assert-bound use to use `unbound?'. Remove scm_at_assert_bound_ref * libguile/goops.c (scm_at_assert_bound_ref): Remove unused, unexported function. Remove hashset slots from GOOPS classes * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, SCM_INSTANCE_HASH) (SCM_SET_HASHSET): * libguile/goops.c (prep_hashsets, scm_sys_make_root_class, scm_sys_init_layout_x): * module/oop/goops.scm (build--slots): Remove hashsets from classes. We haven't implemented hashed dispatch since Guile 1.8, and it's not clear that the particular formulation of dispatch is a good idea. 2015-01-23 Andy Wingo Deprecate C exports of GOOPS classes. * libguile/deprecated.h: (scm_class_boolean, scm_class_char, scm_class_pair) (scm_class_procedure, scm_class_string, scm_class_symbol) (scm_class_primitive_generic, scm_class_vector, scm_class_null) (scm_class_real, scm_class_complex, scm_class_integer) (scm_class_fraction, scm_class_unknown, scm_class_top) (scm_class_object, scm_class_class, scm_class_applicable) (scm_class_applicable_struct, scm_class_applicable_struct_with_setter) (scm_class_generic, scm_class_generic_with_setter, scm_class_accessor) (scm_class_extended_generic, scm_class_extended_generic_with_setter) (scm_class_extended_accessor, scm_class_method) (scm_class_accessor_method, scm_class_procedure_class) (scm_class_applicable_struct_class, scm_class_number, scm_class_list) (scm_class_keyword, scm_class_port, scm_class_input_output_port) (scm_class_input_port, scm_class_output_port, scm_class_foreign_slot) (scm_class_self, scm_class_protected, scm_class_hidden) (scm_class_opaque, scm_class_read_only, scm_class_protected_hidden) (scm_class_protected_opaque, scm_class_protected_read_only) (scm_class_scm, scm_class_int, scm_class_float) (scm_class_double, scm_port_class, scm_smob_class): Deprecate. * libguile/deprecated.c: * libguile/goops.c: * libguile/goops.h: Adapt to deprecation. * libguile/goops.h * libguile/goops.c (scm_is_generic, scm_is_method): New interfaces. (SCM_GENERICP, SCM_METHODP): Change to use new interfaces. * libguile/ports.c (scm_make_port_type): * libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): Use internal names for the port and smob class arrays. 2015-01-23 Andy Wingo Generics with setters have layout * libguile/goops.c (scm_sys_set_object_setter_x): Remove. Instead, we use slot-set! of 'setter. (scm_i_define_class_for_vtable): Move lower in the file, and fold in scm_make_extended_class_from_symbol and make_class_from_symbol. Properly handle applicable structs with setters. (scm_class_applicable_struct_with_setter_class): New private capture. (scm_sys_bless_applicable_struct_vtables_x): Rename to take two arguments, and bless the second argument as an applicable struct with setter vtable. (scm_sys_goops_early_init): Capture setter classes. * libguile/deprecated.c (SPEC_OF, CPL_OF): Access slots by name, not by index. (applicablep, more_specificp): Adapt to use CPL_OF. (scm_find_method): Access "methods" slot by name. * libguile/procs.c (scm_setter): Remove special case for generics; if it's a setter, it will be a normal applicable struct. * module/oop/goops.scm () (): New classes. (): Now an instance of the setter metaclass and a child of the setter class, so that the "setter" slot ends up in the right place. (, , ): Be instances of the setter metaclass. (, ): Move definitions farther down. (make): Use slot-set! when initializing setters here. (initialize): Likewise for . Remove specialization for . 2015-01-23 Andy Wingo Remove unused CPP defines naming slots * libguile/goops.h (scm_si_generic_function, scm_si_specializers) (scm_si_procedure, scm_si_formals, scm_si_body) (scm_si_make_procedure): Remove unused CPP defines. Remove unused `default-slot-definition-class' slot * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_slotdef_class) * module/oop/goops.scm (build--slots): Remove unused `default-slot-definition-class' slot. Remove useless scm_s_slot_set_x export * libguile/goops.c: * libguile/goops.h (scm_s_slot_set_x): Remove unused and useless export. Remove unreachable code in scm_setter * libguile/procs.c (scm_setter): Remove unreachable code. Deprecate scm_no_applicable_method C export * libguile/deprecated.c (scm_init_deprecated_goops) (scm_no_applicable_method): * libguile/goops.h: * libguile/goops.c (scm_no_applicable_method) (scm_sys_goops_early_init): Deprecate scm_no_applicable_method C export. Remove unused scm_t_method and SCM_METHOD * libguile/goops.h (scm_t_method, SCM_METHOD): Remove unused struct type, typedef, and macro. 2015-01-23 Andy Wingo Fold GOOPS compile and dispatch modules into main GOOPS module * libguile/goops.c (scm_sys_invalidate_method_cache_x): Remove C interface to this internal method. Instead, internal callers are all from Scheme, so we move the implementation to Scheme. (scm_make): Dispatch to `make' in Scheme. This is an incompatible but great change, as it fulfills the common user perception that scm_make is the same as GOOPS's `make'. (scm_sys_goops_early_init): Capture `make'. (scm_no_applicable_method): Define in Scheme and capture in C. * module/Makefile.am: Remove oop/goops/compile.scm and oop/goops/dispatch.scm. * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: Fold into goops.scm. * module/oop/goops.scm: Fold in the generic compile and dispatch modules. This eliminates a circularity that caused some eval-when shenanigans, so remove the eval-whens as well. Reimplement the boot version of `make' in Scheme, and make the `initialize' method handle invalidation instead of the generic %allocate-instance. (no-applicable-method): Define here. Import the utils module in the normal define-module block. 2015-01-23 Andy Wingo Remove unused *goops-module* definition. * module/oop/goops.scm (*goops-module*): Remove. define-generic, define-extended-generic are hygienic syntax * module/oop/goops.scm (define-generic, define-extended-generic): (define-extended-generics): Reimplement using syntax-case. `class' is a hygienic macro * module/oop/goops.scm (class): Rewrite as a hygienic macro. 2015-01-23 Andy Wingo Deprecate scm_basic_make_class * libguile/deprecated.h: * libguile/deprecated.c (scm_basic_make_class): Deprecate. * libguile/goops.c: * libguile/goops.h (scm_make_standard_class): New internal helper. It's a better spelling, as it matches make-standard-class, and is internal so as not to cause confusion between boot GOOPS helpers and "real" GOOPS interfaces. 2015-01-23 Andy Wingo Move GOOPS boot to Scheme * module/oop/goops.scm (build--slots): New helper, replacing build_class_class_slots. (build-slots-list, %compute-getters-n-setters, %compute-layout): New private helpers, moved here from C. (%prep-layout!): Reimplement in Scheme. (make-standard-class): New private helper, replacing scm_basic_make_class. (, , ): Define in Scheme. (, , , , , , , , , , , , , , , , , , , , , , , , ): Define in Scheme. (, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ): Define in Scheme. (compute-slots): Use build-slots-list helper. * libguile/goops.h: * libguile/goops.c (scm_basic_basic_make_class, scm_sys_compute_slots) (scm_sys_prep_layout_x): Remove. These were available to C, but were undocumented internals that were dangerous, confusing, and unnecessary. * libguile/goops.c: Add note about variable versus value references. Remove internal C routines that were just used during boot, as they have been moved to Scheme. (scm_basic_make_class): Change to call out to make-standard-class in Scheme. (scm_sys_make_root_class, scm_sys_bless_applicable_struct_vtable_x) (scm_sys_bless_pure_generic_vtable_x, scm_sys_init_layout_x): New private helpers. (scm_sys_goops_early_init): Change to capture values defined in Scheme. 2015-01-23 Andy Wingo Remove declarations without definitions * libguile/goops.h: Remove declarations for scm_oldfmt, scm_c_oldfmt0, and scm_c_oldfmt. These symbols were not defined. 2015-01-23 Andy Wingo Remove unused %fast-slot-ref / %fast-slot-set! from GOOPS * libguile/goops.h: * libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x): Remove these unused, unsafe functions. They were publically available only to C. * module/oop/goops/active-slot.scm (compute-get-n-set): Update to use struct-ref / struct-set! instead of %fast-slot-ref / %fast-slot-set! from (oop goops internal). 2015-01-23 Andy Wingo Preparation for more GOOPS refactorings * libguile/goops.c (scm_sys_goops_early_init) (scm_init_goops_builtins): Factor out some initialization to a separate helper. This will be the base for moving more things from C to Scheme in the future. * module/oop/goops.scm: Call %goops-early-init. 2015-01-23 Andy Wingo %init-goops-builtins is an extension, not a global * libguile/goops.h: * libguile/goops.c (scm_init_goops, scm_init_goops_builtins): Move %init-goops-builtins to be an extension instead of a globally accessible function. * module/oop/goops.scm: Adapt. 2015-01-23 Andy Wingo compute-cpl implementation only in Scheme * libguile/goops.c (build_class_class_slots, create_basic_classes): Instead of creating with uninitialized `direct-slots', `slots', and `getters-n-setters' fields and initializing them later, create with a "boot" version of unspecialized slots and later replace the fields with specialized slot classes. This allows slot-ref to work during early boot, which is necessary to move compute-cpl to Scheme. (create_standard_classes): Finish initializing here. (map, filter_cpl, compute_cpl): Remove the boot-time compute-cpl in C and its helpers. (scm_basic_basic_make_class): Call compute-cpl in Scheme. (fix_cpl): Remove; since we use the correct compute-cpl from the beginning, there's no need to correct for the deficiencies of the C implementation any more. (build_slots_list): Adapt to build_class_class_slots change. * module/oop/goops.scm (compute-std-cpl, compute-cpl): Move these up to the top, so they can be called by the boot process. (compute-clos-cpl, top-sort, std-tie-breaker, build-transitive-closure) (build-constraints): Remove unused private code. 2015-01-23 Andy Wingo More useless goops.c code removal * libguile/goops.c: Remove needless scm_sym_define_public definition. Remove unused macros in goops.c * libguile/goops.c (NXT_MTHD_METHODS, NXT_MTHD_ARGS): Remove unused macros. Rewrite %method-more-specific? to be in Scheme * libguile/goops.h: * libguile/goops.c (more_specificp, scm_sys_method_more_specific_p): * module/oop/goops.scm (%method-more-specific?): Rewrite in Scheme. We remove the scm_sys_method_more_specific_p interface as it is a private interface and it's not extensible. 2015-01-23 Andy Wingo Deprecate C interfaces scm_compute_applicable_methods, scm_find_method * libguile/deprecated.h: * libguile/deprecated.c (scm_compute_applicable_methods): Deprecate. This was the boot version of compute-applicable-methods, not the full version; the right thing to do is to call scheme. (scm_find_method): Deprecate. Again, the right thing is to do this on the Scheme level. * libguile/goops.c: * libguile/goops.h: Deprecated code moved to deprecated.[ch]. 2015-01-23 Andy Wingo %compute-applicable-methods in Scheme * libguile/goops.c: Move %compute-applicable-methods to Scheme. (scm_sys_goops_loaded): No need to initialize var_compute_applicable_methods. * libguile/goops.h (scm_sys_compute_applicable_methods): Remove. This was internal so it shouldn't cause a problem. * module/oop/goops.scm (%sort-applicable-methods): (%compute-applicable-methods): New definitions. 2015-01-23 Andy Wingo Mark two coverage tests as XFAIL * test-suite/tests/coverage.test ("several times", "one proc hit, one proc unused"): Mark as XFAIL until we can fix either the expander or the compiler to have proper source info. Fix the assembler for unexpected source properties * module/system/vm/assembler.scm (link-debug): Fix for source properties that don't have line and column, as are currently being produced by the new lalr. 2015-01-22 Andy Wingo Merge commit '5b7632331e7551ac202bbaba37c572b96a791c6e' Conflicts: module/oop/goops.scm Merge commit 'ed72201a795ac1c8d6c0288b6bb710f2bd0ebd9c' Conflicts: test-suite/tests/r6rs-ports.test Merge commit '01a301d1b606b84d986b735049e7155d2f4cd6aa' Conflicts: libguile/hash.c Merge commit '894d0b894daae001495c748b3352cd79918d3789' Conflicts: libguile/hash.c Merge commit '5943a62042432b86d757200ef595d7aebb5c9bac' Merge commit '37b1453032488de582175270d1b3a1653ea81457' Merge commit 'cdcba5b2f6270de808e51b3b933374170611b91d' Conflicts: module/statprof.scm 2015-01-22 Ludovic Courtès Really disable stack underflow checks when VM_CHECK_UNDERFLOW == 0. * libguile/vm-engine.h: Use '#if VM_CHECK_UNDERFLOW' instead of '#ifdef'. 2015-01-22 Andy Wingo Merge commit '5d971db802eaa8038db17e1aa5b4c69452739744' Conflicts: libguile/ports.c Merge commit '47ca15c7dffd14a82e75c1a0aeeaf2e77f3fa5b4' Merge commit '7c433cbbce83bc9f2f9967afba00bbb68e312657' Conflicts: meta/Makefile.am Merge commit '5fac1a7ada362d78f13143acbc0ceca7f2f101de' Conflicts: configure.ac doc/ref/libguile-parallel.texi Merge commit '8cf2a7ba7432d68b9a055d29f18117be70375af9' Merge commit '81d2c84674f03f9028f26474ab19d3d3f353881a' Some fixups in bytevectors.c. Merge commit 'fdd319e9bd4121d844662d3d8ccc69b462b60840' Merge commit 'a7bbba05838cabe2294f498e7008e1c51db6d664' 2015-01-22 Andy Wingo Keywords have a tc7 * libguile/tags.h (scm_tc7_keyword): Allocate a tc7, so that the VM can have cheap keyword? tests. * libguile/keywords.c: * libguile/keywords.h: Adapt. * libguile/goops.c (scm_class_of, scm_sys_goops_early_init): Capture . * libguile/print.c (iprin1): Inline keyword printer. * libguile/evalext.c (scm_self_evaluating_p): Add keywords here. * libguile/deprecated.h: * libguile/deprecated.c (scm_tc16_keyword): Deprecate. * module/language/cps/compile-bytecode.scm (compile-fun): Add keyword? case, and bitvector? case while we're at it. * module/language/cps/effects-analysis.scm (define-primitive-effects): Add bytevector?, keyword?, and bitvector? cases. * module/language/cps/primitives.scm (*branching-primcall-arities*): Add keyword?. * module/language/cps/types.scm (bitvector?, keyword?, bytevector?): Add branch inferrers. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): (*effect+exception-free-primitives*): Add bytevector?, keyword?, and bitvector?. * module/oop/goops.scm (): New class. * module/system/base/types.scm (%tc7-keyword, cell->object): Add cases. * module/system/vm/assembler.scm (br-if-keyword): New definition. * module/system/vm/disassembler.scm (code-annotation): Add br-if-tc7 case for keywords. * test-suite/tests/types.test ("clonable objects"): Update now that keywords are cloneable. 2015-01-22 Andy Wingo Add allocate-struct, struct-ref, struct-set! instructions * libguile/vm-engine.c (allocate-struct, struct-ref, struct-set!): New instructions, to complement their "immediate" variants. * module/language/cps/compile-bytecode.scm (compile-fun): * module/system/vm/assembler.scm (system): Wire up the new instructions. 2015-01-22 Andy Wingo Merge commit '5af307de43e4b65eec7f235b48a8908f2a00f134' Conflicts: test-suite/tests/reader.test Merge commit 'b1451ad859183ae48c624d19ec144306bd2d3e3a' 2015-01-22 Andy Wingo Fix #:init-value on class-allocated slots Allocating an instance of a class with a #:class or #:each-subclass slot allocation should not re-initialize the class-allocated slot. In Guile 1.8, this worked by effectively doing a slot-bound? within %initialize-object. In Guile 2.0 we instead initialize the slot when it is allocated -- in compute-get-n-set. * module/oop/goops.scm (compute-getters-n-setters): Don't set an init-thunk for class-allocated slots. (compute-get-n-set): Initialize class-allocated slots here, if an init-thunk or init-value are present. * test-suite/tests/goops.test ("#:each-subclass"): Add test. 2015-01-18 Ludovic Courtès Fix buffer overrun with unbuffered custom binary input ports. Fixes . Before that, in 'cbip_fill_input', BUFFERED would be set to 0 when reading from 'scm_getc' et al, because 'shortbuf' was being used. Thus, we could eventually execute this line: /* Copy the data back to the internal buffer. */ memcpy ((char *) c_port->read_pos, SCM_BYTEVECTOR_CONTENTS (bv), c_octets); But 'read_pos' would quickly point to the fields beyond 'shortbuf', thereby leading to a corruption of the 'scm_t_port' itself. * libguile/r6rs-ports.c (cbip_setvbuf): When READ_SIZE is 0, keep using BV as the 'read_buf'. (cbip_fill_input): Adjust assertion to accept 'read_buf_size = 1'. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port unbuffered & 'get-string-all'", "custom binary input port unbuffered UTF-8 & 'get-string-all'"]: New tests. 2015-01-13 Ludovic Courtès Improve output of command-line errors. * module/ice-9/command-line.scm (shell-usage): Add 'newline' call when FMT is true. (compile-shell-switches)[error]: Prepend "error: " and append "~%" to FMT. Use a lower-case message. 2015-01-11 Ludovic Courtès Optimize 'string-hash'. This yields a 50% improvement on the "narrow string" benchmark of 'hash.bm', 41% on "wide string", and 76% on "long string". * libguile/hash.c (scm_i_string_hash): Rewrite to avoid 'scm_i_string_ref' calls. 2015-01-11 Ludovic Courtès Add 'string-hash' benchmarks. * benchmark-suite/benchmarks/hash.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add it. 2015-01-11 Ludovic Courtès Deprecate 'scm_string_hash'. This function has been unused internally for some time and is undocumented. * libguile/hash.c (scm_string_hash): Wrap if #if SCM_ENABLE_DEPRECATED == 1. * libguile/hash.h (scm_string_hash): Likewise, and replace SCM_API with SCM_DEPRECATED. 2015-01-11 Ludovic Courtès Optimize 'write' for strings. This shows a 19% improvement on the "string without escapes" micro-benchmark of 'write.bm', and 12% on "string with escapes". * libguile/print.c (iprin1) : Replace 'scm_i_string_ref' loop with a call to 'write_string'. (display_character): Adjust description of return value in comment. (write_string): New function. 2015-01-11 Ludovic Courtès Avoid converting the 'mode' argument of 'open-file'. * libguile/fports.c (scm_open_file_with_encoding): const-qualify 'md' and 'ptr'. Add call to 'scm_i_try_narrow_string'. Use 'scm_i_string_chars' instead of 'scm_to_locale_string' plus ' scm_dynwind_free'. * test-suite/tests/ports.test ("invalid wide mode string", "valid wide mode string"): New tests. statprof: 'statprof' and 'with-statprof' return the code's return values. * module/statprof.scm (statprof): Return the return values of THUNK. (with-statprof): Adjust docstring accordingly. * test-suite/tests/statprof.test ("return values"): New test. * doc/ref/statprof.texi (Statprof): Adjust accordingly. 2015-01-09 Ludovic Courtès Improve deprecation message of 'scm_add_to_port_table'. Reported by Thien-Thi Nguyen . * libguile/ports.c (scm_add_to_port_table): Mention 'scm_new_port_table_entry'. 2014-12-14 Mark H Weaver Assembler: Cope with non-string port filenames. Fixes . Reported by Linas Vepstas . * module/system/vm/assembler.scm (write-sources): Intern the filename only if it's a string. (For sockets, the filename is a symbol). 2014-12-10 Andy Wingo Convert primitive-eval to "compile" its expressions to linked closures * libguile/memoize.c (memoize): Fix meta on subsequent case-lambda clauses. * module/ice-9/eval.scm (primitive-eval): Rewrite to compile expressions to thunks, to avoid runtime dispatch cost. 2014-12-10 Andy Wingo Fix syntax.test * test-suite/tests/syntax.test (exception:variable-ref): Change expected error. 2014-12-07 Andy Wingo Minor evaluator tweaks * libguile/eval.c (eval): Remove unused variable. * libguile/memoize.c (unmemoize): Fix unmemoization. * module/ice-9/eval.scm: Attempt to speed up common box-ref cases. 2014-12-07 Andy Wingo Simplify variable resolution in the evaluator * libguile/expand.c (convert_assignment): Handle creation of the default lambda-case body here. * libguile/eval.c (eval): * module/ice-9/eval.scm (primitive-eval): * libguile/memoize.h: * libguile/memoize.c (MAKMEMO_BOX_REF, MAKMEMO_BOX_SET): (MAKMEMO_TOP_BOX, MAKMEMO_MOD_BOX): Refactor all global var resolution to go through "resolve". Add "box-ref" and "box-set!". Rename memoize-variable-access! to %resolve-variable, and don't be destructive. 2014-12-07 Andy Wingo Closure conversion in evaluator * libguile/memoize.c (MAKMEMO_CAPTURE_ENV, push_nested_link) (push_flat_link, env_link_is_flat, env_link_vars) (env_link_add_flat_var, lookup, capture_flat_env, memoize): Capture flat environments around closures. 2014-12-06 Andy Wingo Add capture-env to evaluator * libguile/eval.c (eval): * libguile/memoize.c (memoized_tags, unmemoize): * libguile/memoize.h (SCM_M_CAPTURE_ENV): * module/ice-9/eval.scm (primitive-eval): Add capture-env memoized expression type. 2014-12-06 Ludovic Courtès build: Better handle substitutions in 'guile-2.0.pc' & co. * meta/Makefile.am (dependency_substitutions): Use '|' as the separate instead of ','. See . 2014-12-05 Andy Wingo Simplify the interpreter for trivial inits and no letrec * libguile/memoize.c (FULL_ARITY): Serialize "ninits" and the unbound value instead of the init list. (memoize): Adapt to FULL_ARITY changes. Remove LETREC case. (unmemoize): Adapt to memoized code change. * libguile/eval.c (BOOT_CLOSURE_PARSE_FULL): Adapt to parse ninits and unbound instead of inits. (eval): Lexical-ref can no longer raise an error. (prepare_boot_closure_env_for_apply): Adapt to inits change. * module/ice-9/eval.scm (primitive-eval): Adapt to ninits/unbound change. * libguile/expand.c (expand_named_let): Fix lambda-case creation to make lists for opt and inits. 2014-12-05 Andy Wingo Assignment conversion in the interpreter * libguile/expand.c (compute_assigned, convert_assignment) (scm_convert_assignment): New functions. * libguile/expand.h: Declare scm_convert_assignment. * libguile/memoize.c (scm_memoize_expression): Do assignment conversion before memoization. * test-suite/tests/syntax.test ("letrec"): Detection of unbound letrec variables now works. 2014-12-03 Ludovic Courtès build: Add missing substitutions for 'guile-2.0.pc'. This is a followup to 5fac1a7. * meta/Makefile.am (substitute): Add GUILE_* and LIBGUILE_* substitutions, and $(dependency_substitutions). (dependency_substitutions): New variable. 2014-12-03 Ludovic Courtès doc: Clarify the unit of the 'offset' argument of 'seek'. Reported in by David Kastrup . * doc/ref/api-io.texi (Random Access): Clarify the unit of the 'offset' argument to 'seek'. 2014-12-03 Ludovic Courtès Add the 'guild' and 'guile' variables to 'guile-2.0.pc'. * configure.ac: Remove meta/guile-2.0.pc and meta/guile-2.0-uninstalled.pc from 'AC_CONFIG_FILES'. * meta/Makefile.am (substitute): New variable. (guile-2.0.pc, guile-2.0-uninstalled.pc): New targets. (guile-config, guild): Use $(substitute) instead of duplicated sed script. (CLEANFILES): Add the .pc files. * meta/guile-2.0.pc.in (bindir, guild, guile): New variables. * doc/ref/libguile-parallel.texi (Parallel Installations): Document the 'guild' and 'guile' pkg-config variables. 2014-12-02 Ludovic Courtès Update (system base lalr) from upstream. Suggested by Jan Nieuwenhuizen . * module/system/base/lalr.upstream.scm: Update from , commit 4c4f149. 2014-12-02 Ludovic Courtès doc: Tell when 'GUILE_INSTALL_LOCALE' first appeared. * doc/ref/guile-invoke.texi (Environment Variables): Add footnote about the Guile version where 'GUILE_INSTALL_LOCALE' appeared. 2014-12-02 Chris Jester-Young Implement SRFI 28: Basic Format Strings. * module/srfi/srfi-28.scm: New module. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-28.scm. * doc/ref/srfi-modules.texi (SRFI-28): New node. 2014-11-20 Ludovic Courtès doc: Clarify behavior of 'select' in the presence of signal interruptions. Fixes . Reported by Chris Vine . * libguile/filesys.c (scm_select): Clarify handling of signal interruptions. * doc/ref/posix.texi (Ports and File Descriptors): Adjust accordingly. 2014-11-19 Rob Browning Recognize m68k, s390x, and sh4 as compilation targets * module/system/base/target.scm (cpu-endianness, triplet-pointer-size): Add cases for "m68k", "sh4", and "s390x". 2014-11-12 Mark H Weaver Fix bytevector-fill! to accept fill arguments greater than 127. Fixes . * libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments between -128 and 255. * test-suite/tests/bytevectors.test ("2.2 General Operations"): Add tests. 2014-11-12 Mark H Weaver Avoid signed overflow and use size_t in bytevectors.c. * libguile/bytevectors.c (ULONG_MAX): Remove (unportable) fallback definition. It is no longer used. (scm_make_bytevector): Use 'size_t' instead of 'unsigned' for indices. Use 'scm_t_uint8' instead of 'signed char' for elements and c_fill. Previously relied on GNU-C-specific behavior when casting integers in the range 128-255 to signed char. (GENERIC_INTEGER_ACCESSOR_PROLOGUE, INTEGER_LIST_TO_BYTEVECTOR) (scm_bytevector_eq_p, scm_bytevector_copy_x, scm_bytevector_copy) (scm_bytevector_to_u8_list, scm_u8_list_to_bytevector) (scm_bytevector_fill_x): Use 'size_t' instead of 'unsigned' for indices. Use 'scm_t_uint8' for elements. Add SCM_VALIDATE_SIZE_COPY and SCM_NUM2SIZE. * libguile/validate.h (SCM_VALIDATE_SIZE_COPY, SCM_NUM2SIZE): New macros. 2014-11-12 Mark H Weaver Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors. Fixes . Reported by tantalum . * libguile/bytevectors.c (scm_bytevector_copy): Always create a VU8 bytevector. * test-suite/tests/bytevectors.test: Add test. 2014-11-12 Thomas Klausner Avoid bash-specific '==' comparison operator in guile.m4. Fixes . * meta/guile.m4 (GUILE_PROGS): Use '=' instead of the bash-specific '==' comparison operator in 'test' call. 2014-11-12 Mark H Weaver Fix strerror error handling when given a non-integer argument. Fixes . Reported and fixed by Glenn Michaels . * libguile/error.c (scm_strerror): Convert the argument to a C integer outside of the critical section, to avoid deadlock on error. * THANKS: Add Glenn Michaels to the fixes section. 2014-11-09 Andy Wingo texinfo: fix @url{@@} parsing * module/texinfo.scm (texi-command-specs): The body of @url{} can have texinfo commands. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add tests. 2014-11-01 Andy Wingo web: Location header is URI-reference; better URI-reference support * module/web/uri.scm (validate-uri): Add reference? keyword argument, for validating references. (build-uri): Clarify comments to indicate that the result is an absolute URI. (build-uri-reference): New interface, to build URI-references. (string->uri-reference): Rename from string->uri*. Fix fragment parsing to not include the #. (string->uri): Adapt to string->uri-reference name change. * module/web/request.scm (request-absolute-uri): Add default-scheme optional argument. Use it if the request-uri has no scheme, or error. * module/web/http.scm (write-uri): Reflow to use "when". Fix writing of URI-reference instances. (declare-uri-reference-header!): Rename from declare-relative-uri-header!. Use string->uri-reference. ("Location"): Declare as a URI-reference header, as per RFC 7231. * module/web/client.scm (open-socket-for-uri): Handle the case in which there is no URI scheme. * test-suite/tests/web-http.test: * test-suite/tests/web-uri.test: Add tests. 2014-11-01 Ludovic Courtès Use on-stack or GC-managed memory in 'search-path'. * libguile/load.c (stringbuf_free): Remove. (stringbuf_grow): Use 'scm_gc_malloc_pointerless' instead of 'scm_realloc'. (search_path): Use stack-allocated INITIAL_BUFFER instead of 'scm_malloc'. Remove use of 'stringbuf_free'. Reduce C heap allocations in 'search-path'. * libguile/load.c (scm_c_string_has_an_ext): Rename to... (string_has_an_ext): ... this. Add docstring. Change 'str' to be an SCM, and remove 'len' parameter. Change loop body to use 'scm_string_suffix_p'. (search_path): Update accordingly. 2014-10-30 Daniel Llorens Merge branch 'lloda-array-support' 2014-10-15 Mark H Weaver i18n: Add HAVE_USELOCALE as a requirement for USE_GNU_LOCALE_API. * configure.ac: Check for uselocale. * libguile/i18n.c: Add HAVE_USELOCALE to the list of requirements before defining USE_GNU_LOCALE_API. 2014-10-11 Mark H Weaver scm_boot_guile: Gracefully handle the case where argc == 0. Fixes . Reported by Nala Ginrut . * libguile/init.c (scm_boot_guile): Do not canonicalize argv[0] unless argc > 0. * THANKS: Add Nala Ginrut to the fixes section. 2014-10-07 Mark H Weaver Thank Per Bothner. * THANKS: Add Per Bothner to the "libraries" section (for SRFI-64). 2014-10-06 Ludovic Courtès build: Adjust autogen.sh to 'libtoolize' name on Darwin. Reported by Daniel Llorens. * autogen.sh: Use 'glibtoolize' on Darwin. 2014-10-02 Mark H Weaver read: Accept "\(" in string literals. Suggested by David Kastrup in . * libguile/read.c (scm_read_string_like_syntax): Accept "\(" as equivalent to "(". * doc/ref/api-data.texi (String Syntax): Document it. * test-suite/tests/reader.test ("reading"): Add test. 2014-10-02 Mark H Weaver docs: Fix documented return type of 'scm_c_export'. Fixes . Reported and fixed by Alexei Matveev . * doc/ref/api-modules.texi (Accessing Modules from C): Change documented return type of 'scm_c_export' to 'void' to reflect reality. * THANKS: Add Alexei Matveev to the fixes section. 2014-09-30 Daniel Llorens Intern general arrays * module/system/vm/assembler.scm (intern-constant, link-data): handle the array case. 2014-09-30 Daniel Llorens Pack array dimensions in array object * libguile/arrays.c (scm_i_make_array): redo object layout. * libguile/arrays.h (SCM_I_ARRAY_V, SCM_ARRAY_BASE, SCM_I_ARRAY_DIMS): to match new layout. (SCM_I_ARRAY_SET_V, SCM_ARRAY_SET_BASE): new setters. (SCM_I_ARRAY_MEM, scm_i_t_array): unused, remove. (scm_i_shap2ra, scm_make_typed_array, scm_from_contiguous_typed_array, scm_from_contiguous_array, scm_make_shared_array, scm_transpose_array, scm_array_contents): fix uses of SCM_I_ARRAY_V, SCM_ARRAY_BASE as lvalues. * libguile/array-map.c (make1array, scm_ramapc): fix uses of SCM_I_ARRAY_V, SCM_ARRAY_BASE as lvalues. 2014-09-30 Daniel Llorens Run some of arrays.test under both compiler & interpreter * test-suite/test-suite/lib.scm (c&e): accept (pass-if exp) clause. * test-suite/tests/arrays.test: use with-prefix/c&e instead of with-prefix where possible. 2014-09-30 Mark H Weaver Merge branch 'stable-2.0' Conflicts: benchmark-suite/benchmarks/ports.bm libguile/async.h libguile/bytevectors.c libguile/foreign.c libguile/gsubr.c libguile/srfi-1.c libguile/vm-engine.h libguile/vm-i-scheme.c module/Makefile.am module/language/tree-il/analyze.scm module/language/tree-il/peval.scm module/scripts/compile.scm module/scripts/disassemble.scm test-suite/tests/asm-to-bytecode.test test-suite/tests/peval.test test-suite/tests/rdelim.test 2014-09-30 Andy Wingo Add (ice-9 unicode) module * libguile/unicode.c: * libguile/unicode.h: * test-suite/tests/unicode.test: * module/ice-9/unicode.scm: New files. * module/Makefile.am: * libguile/Makefile.am: * test-suite/Makefile.am: * libguile/init.c: Wire new files into the build. * doc/ref/api-data.texi: Add docs. 2014-09-29 Mark H Weaver peval: Handle optional argument inits that refer to previous arguments. Fixes . Reported by Josep Portella Florit . * module/language/tree-il/peval.scm (inlined-application): When inlining an application whose operator is a lambda expression with optional arguments that rely on default initializers, expand into a series of nested let expressions, to ensure that previous arguments are in scope when the default initializers are evaluated. * test-suite/tests/peval.test ("partial evaluation"): Add tests. 2014-09-25 Mark H Weaver doc: Improve description of vector-unfold and vector-unfold-right. * doc/ref/srfi-modules.texi (SRFI-43 Constructors)[vector-unfold]: Improve description. * module/srfi/srfi-43.scm (vector-unfold, vector-unfold-right): Improve docstrings. 2014-09-24 David Kastrup Fix ungetc for characters 0x80 <= c < 0xf0 in UTF-8. Fixes . * libguile/ports.c (scm_ungetc_unlocked): Fix bad UTF-8 reencoding, introduced in commit be7ecef05c1eea66f30360f658c610710c5cb22e. 2014-09-22 Ludovic Courtès Add 'EXIT_SUCCESS' and 'EXIT_FAILURE'. Suggested by Frank Terbeck . * libguile/posix.c (scm_init_posix): Define 'EXIT_SUCCESS' and 'EXIT_FAILURE'. * doc/ref/posix.texi (Processes): Document them. 2014-09-22 David Michael guile-readline: Use the current directory if HOME is unset. * guile-readline/ice-9/readline.scm (history-file): When the HOME environment variable is unset, use the current directory instead. 2014-09-20 Ludovic Courtès build: Use 'libtoolize' in autogen.sh. Fixes . Reported by Rob Browning . * autogen.sh: Invoke 'libtoolize' instead of 'libtool'. 2014-09-20 David Kastrup Fix SCM_SMOB_OBJECT{_,_0_,_1_,_2_,_3_}LOC. Fixes . * libguile/smob.h (SCM_SMOB_OBJECT_LOC, SCM_SMOB_OBJECT_0_LOC) (SCM_SMOB_OBJECT_1_LOC, SCM_SMOB_OBJECT_2_LOC) (SCM_SMOB_OBJECT_3_LOC): These elementary API macros have been broken by commit 56164dc47f6616b359f0ad23be208f01a77b55fa in 2009. 2014-09-20 Mark H Weaver guild disassemble: Use #:prefix instead of #:renamer. * module/scripts/disassemble.scm: Use #:prefix instead of #:renamer in #:use-module clause. Document #:prefix option in use-module clauses. * doc/ref/api-modules.texi (Using Guile Modules): Document #:prefix option. SRFI-43: vector-concatenate: Fix error message. * module/srfi/srfi-43.scm (vector-concatenate): Fix the 'who' of an error message. 2014-09-20 Mark H Weaver VM: Use register "a3" for IP_REG on m68k. Subset of a patch by Andreas Schwab . Reported by Rob Browning . * libguile/vm-engine.h (IP_REG)[__mc68000__]: Use register "a3". 2014-09-20 Mark H Weaver VM: Allow the C compiler to choose FP_REG on ARM. Reported by Rob Browning . * libguile/vm-engine.h (IP_REG)[__arm__]: Remove explicit register choice ("r7") for FP_REG, which was reported to cause compilation failures on ARM. 2014-09-20 Mark H Weaver Do not assume that 64-bit integers will be 64-bit aligned. * libguile/foreign.c (raw_bytecode, objcode_cells): * libguile/gsubr.c (raw_bytecode, objcode_cells): Use SCM_ALIGNED to ensure 64-bit alignment. 2014-09-20 Mark H Weaver VM: ASM_MUL for ARM: Add earlyclobber constraint to the SMULL outputs. Reported by Rob Browning . * libguile/vm-i-scheme.c (ASM_MUL)[ARM]: Add earlyclobber (&) constraint to the SMULL output registers. 2014-09-17 Ludovic Courtès tests: Link test against Gnulib. Reported by Eli Zaretskii . * test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_LDADD): Add libgnu.la, for the 'strdup' replacement. 2014-09-12 Andy Wingo Add (ice-9 unicode) module * libguile/unicode.c: * libguile/unicode.h: * test-suite/tests/unicode.test: * module/ice-9/unicode.scm: New files. * module/Makefile.am: * libguile/Makefile.am: * test-suite/Makefile.am: * libguile/init.c: Wire new files into the build. * doc/ref/api-data.texi: Add docs. 2014-08-26 Ludovic Courtès Thank Franck. 2014-08-26 Ludovic Courtès Handle ~p in 'format' warnings. Fixes . Reported by Frank Terbeck . * module/language/tree-il/analyze.scm (format-string-argument-count): Add case for ~p. * test-suite/tests/tree-il.test ("warnings")["format"]("~p", "~p, too few arguments", "~:p", "~:@p, too many arguments", "~:@p, too few arguments"): New tests. 2014-08-24 Andy Wingo Separate &boolean type into &true and &false * module/language/cps/types.scm (&all-types): Represent true and false as separate bits, so that #f can be removed from types on true branches. Adapt all users. * module/language/cps/type-fold.scm (&scalar-types): (fold-and-reduce): Adapt to boolean type representation change. 2014-08-15 Eli Zaretskii On MS-Windows, don't return file names with backslashes from search-path. * libguile/load.c (search_path): On MS-Windows, convert all backslashes to forward slashes if the file was found on PATH. 2014-08-14 Mark H Weaver Copy the result from 'nl_langinfo' before it can be overwritten. Based on a patch by Eli Zaretskii . * libguile/i18n.c (copy_string_or_null): New static function. (scm_nl_langinfo): Use 'copy_string_or_null' to copy the result from 'nl_langinfo' and 'nl_langinfo_l' before the next call and before releasing the locale mutex. 2014-08-13 Eli Zaretskii Make temporary file in coding.test work on MS-Windows. * test-suite/tests/coding.test (with-temp-file): Instead of hard-coding "/tmp" as the temporary directory, use $TMPDIR or $TEMP from the environment, and fall back on "/tmp" if none of those 2 is defined. 2014-08-12 Ludovic Courtès doc: "!#" does not need to appear on a line of its own. * doc/ref/api-evaluation.texi (Block Comments): Remove "which must appear on a line of their own". Reported by David Michael . 2014-08-11 David Kastrup Clarify that object-properties cannot be reliably applied to numbers. * doc/ref/api-utility.texi (Object Properties)[make-object-property]: Clarify that object-properties cannot be reliably applied to numbers. 2014-07-31 Ian Price Provide curried version of define*-public. * module/ice-9/curried-definitions.scm (define*-public): New macro. 2014-07-30 Ian Price Prevent add-to-load-path from adding duplicate entries * module/ice-9/boot-9.scm (add-to-load-path): Remove argument from %load-path (if it exists) before pushing. This also means that the `elt' will always be at the front of %load-path. 2014-07-22 Andy Wingo Better simplification of literal constants that continue to branches * module/language/cps/simplify.scm (eta-reduce): Constants that continue to branches eta-reduce to the true or false branch. 2014-07-22 Andy Wingo CPS will not see "not" primcalls * module/language/tree-il/compile-cps.scm (convert): Remove "not" primcalls. * module/language/cps/effects-analysis.scm (values): * module/language/cps/types.scm: Remove special cases for the "not" primcall. 2014-07-22 Andy Wingo Simplify pass rewrite scope tree to reflect dominator tree * module/language/cps/simplify.scm (redominate): Add micropass to rewrite the scope tree to reflect the dominator tree. Will enable better eta reduction. Remove dead case in CSE * module/language/cps/cse.scm (apply-cse): Remove a case that couldn't occur. 2014-07-21 Andy Wingo CSE allocate-struct fix * module/language/cps/cse.scm (compute-equivalent-subexpressions): Fix handling of allocate-struct in tail position. Fix typo in arities.scm * module/language/cps/arities.scm (fix-arities*): Fix typo. Stabilize renumber.scm:sort-conts. * module/language/cps/renumber.scm (sort-conts): Prevent spurious continuation reordering. maybe_annotate_source does not annotate negative positions * libguile/read.c (maybe_annotate_source): Don't annotate with negative lines or columns. Soft port fill-input doesn't alter line or column * libguile/vports.c (sf_fill_input): Save and restore the line/column info around the ungetc. scm_ungetc_unlocked should not result in negative columns * libguile/ports.c (scm_ungetc_unlocked): Use DECCOL in all cases, to avoid negative columns. Fix allocate-slots for $kreceive with multiple predecessors * module/language/cps/slot-allocation.scm (allocate-slots): For continuations of $call, $callk, and $values with multiple predecessors, recalculate the set of live slots. Fixes miscompilation of ice-9/futures.scm:process-future!, broken since the previous patch, now that $kreceive continuations can have multiple predecessors. 2014-07-05 Andy Wingo Block sorting to keep loop bodies together * module/language/cps/renumber.scm (compute-new-labels-and-vars): (compute-tail-path-lengths, sort-conts): Arrange to visit successors in such a way that if branches are unsorted, the longest path length will appear first. This keeps loop bodies together. 2014-07-04 Ludovic Courtès Recognize more ARM targets. Suggested by Dale P. Smith. * module/system/base/target.scm (cpu-endianness): Add cases for "arm.*eb", "^aarch64.*be", and "aarch64". Change "arm" case to "arm.*". (triplet-pointer-size): Allow underscore as in 'aarch64_be'. * test-suite/tests/asm-to-bytecode.test ("cross-compilation")["armeb-unknown-linux-gnu", "aarch64-linux-gnu", "aarch64_be-linux-gnu"]: New tests. 2014-07-04 Andy Wingo Fix bit-count* bug * libguile/bitvectors.c (scm_bit_count_star): Fix typo introduced in 2005 refactor (!) in which the second arg was erroneously taken from the first arg. * test-suite/tests/bitvectors.test: Add test. * doc/ref/api-compound.texi: Fix doc example for u32vector selector. 2014-07-04 Ludovic Courtès build: Support pthread builds without 'pthread_cancel' support (Android). Reported by Sylvain Beucler . * configure.ac: Check for 'pthread_cancel'. * libguile/threads.c (scm_cancel_thread): Conditionalize on !SCM_USE_PTHREAD_THREADS || defined HAVE_PTHREAD_CANCEL. * test-suite/tests/threads.test (require-cancel-thread): New procedure. ("timed joining fails if timeout exceeded", "join-thread returns timeoutval on timeout", "cancel succeeds", "handler result passed to join", "can cancel self"): Use it. 2014-07-04 Ludovic Courtès build: Use 'LT_LIB_M' to determine whether -lm is needed. * configure.ac: Use 'LT_LIB_M' instead of 'AC_CHECK_LIB(m, cos)'. Suggested by Sylvain Beucler . 2014-07-04 Ludovic Courtès Recognize arm-* target triplets. Reported by Sylvain Beucler . * module/system/base/target.scm (cpu-endianness): Add case where CPU is "arm". * test-suite/tests/asm-to-bytecode.test ("cross-compilation")["arm-unknown-linux-androideabi"]: New test. 2014-07-04 Andy Wingo logbit? strength reduction * module/language/cps/type-fold.scm (fold-and-reduce): Don't require types to check out; it could be that the reduced expression can exhibit the same type-check effects. Reduce for all continuations, even $kreceive. Pass dfg to reducer. (mul): Check types. (logbit?): New reducer. Fix logand range analysis. * module/language/cps/types.scm (logand): Fix range analysis. Fix range analysis for mul and div * module/language/cps/types.scm (mul): Avoid producing nans in the resulting range. (div): Fix range analysis. Type-driven strength reduction * module/language/cps/type-fold.scm (*primcall-reducers*): (define-primcall-reducer, define-unary-primcall-reducer): (define-binary-primcall-reducer, mul): Beginnings of strength reduction. (fold-and-reduce): Rename from compute-folded. (fold-constants*): Adapt. Small type-fold cleanup * module/language/cps/type-fold.scm (fold-constants*): Remove stale branches that were there when we only type folded on limited-size branches. 2014-07-03 Eli Zaretskii Remove trailing whitespace from ports.test. Untabify some test files. * test-suite/tests/ports.test: Untabify. * test-suite/tests/posix.test: Untabify. * test-suite/tests/r6rs-files.test: Untabify. 2014-07-03 Eli Zaretskii Fix problems with Windows file names that use backslashes. * libguile/load.c (scm_i_mirror_backslashes): New function. (scm_init_load_path): Call it to produce MS-Windows file names with forward slashes. (FILE_NAME_SEPARATOR_STRING): Define as "/" on all platforms. * libguile/load.h (scm_i_mirror_backslashes): Add prototype. * libguile/init.c (scm_boot_guile): Call scm_i_mirror_backslashes on argv[0]. * libguile/filesys.c (scm_getcwd): Call scm_i_mirror_backslashes on the directory name returned by getcwd. * test-suite/tests/ports.test ("file name separators"): New test. 2014-07-03 Eli Zaretskii Fix calculation of CPU set size for getaffinity. * libguile/posix.c (cpu_set_to_bitvector): Use CPU_SETSIZE, not sizeof, to compute the size of the CPU set. Provide a more reasonable default value for stack limit on MS-Windows. * libguile/debug.c (init_stack_limit) [__MINGW32__]: Use VirtualQuery to compute the stack limit on MS-Windows. 2014-07-03 Eli Zaretskii Unconditionally build and test the ice-9/popen module. * module/Makefile.am (ICE_9_SOURCES): Add ice-9/popen.scm. (ICE_9_SOURCES) [BUILD_ICE_9_POPEN]: Remove conditional addition of ice-9/popen.scm. (SCRIPTS_SOURCES): Add scripts/autofrisk.scm and scripts/scan-api.scm unconditionally. (SCRIPTS_SOURCES) [BUILD_ICE_9_POPEN]: Remove conditional addition of scripts/autofrisk.scm and scripts/scan-api.scm. * configure.ac: Remove the BUILD_ICE_9_POPEN condition. * test-suite/tests/popen.test (if-supported): Don't test for 'fork feature being supported. 2014-07-03 Andy Wingo Compiler emits br-if-logtest * module/language/cps/compile-bytecode.scm (compile-fun): * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/language/cps/type-fold.scm (logtest): * module/language/cps/types.scm (logtest): * module/system/vm/assembler.scm (system): * module/system/vm/disassembler.scm (compute-labels): Add backend support for the logtest instruction. Add br-if-logtest opcode * libguile/vm-engine.c (br-if-logtest): New opcode. * module/system/vm/disassembler.scm (code-annotation): Add branch annotation support. Optimizer support for logtest and logbit? * module/language/cps/effects-analysis.scm: Add entries for logtest and logbit?. * module/language/cps/types.scm (logtest, logbit?): New checkers and inferrers. * module/language/tree-il/peval.scm (peval): Convert (zero? (logand a b)) to (logtest a b), in anticipation of opcode support for logtest. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add logtest and logbit?. 2014-07-03 Andy Wingo Convert slot allocation to use intsets * module/language/cps/dfg.scm (compute-live-variables): Convert to use intsets, and fold in compute-maximum-fixed-point. (print-dfa): Update. * module/language/cps/slot-allocation.scm (dead-after-def?) (dead-after-use?, allocate-slots): Convert to use intsets. 2014-07-03 Andy Wingo Add bitvector->intset. * module/language/cps/intset.scm (bitvector->intset): New interface. Restrict intsets and maps to non-negative integers * module/language/cps/intmap.scm (intmap-add): * module/language/cps/intset.scm (intset-add): Restrict to only hold non-negative integers. Adapt visit-prompt-control-flow to use intsets. * module/language/cps/dfg.scm (compute-reachable): Use intsets. (compute-interval): Adapt. (visit-prompt-control-flow): Adapt. CSE comments * module/language/cps/cse.scm (compute-available-expressions): Add clarifying comment. Add intset-subtract. * module/language/cps/intset.scm (intset-subtract): New interface. 2014-07-02 Eli Zaretskii More fixes for deleting files whose ports are not closed. * test-suite/tests/r6rs-files.test: Close the port after using it. * test-suite/tests/posix.test ("mkstemp!"): Close the port after using it. 2014-07-02 Eli Zaretskii Make 'system*' available on MS-Windows. * libguile/simpos.c (scm_system_star) [!HAVE_FORK]: An implementation of 'system*' for MS-Windows, which doesn't have 'fork', but can use 'spawnvp' in this case. Fix deletion of ports.test test file on MS-Windows. * test-suite/tests/ports.test ("fdes->port", "seek") ("truncate-file"): Close every file and port we open, to avoid failure to delete the test file on MS-Windows when the test is completed. 2014-07-01 Andy Wingo Fix intset on 32-bit machines * module/language/cps/intset.scm (*leaf-bits*): Define to 4 on 32-bit machines, to stay in fixnum range. 2014-06-30 Andy Wingo Remove size limit in elide-type-checks * module/language/cps/dce.scm (elide-type-checks!): Remove limit on label-count, now that complexity is under control. 2014-06-29 Andy Wingo Fix intmap-intersect corner case * module/language/cps/intmap.scm (intmap-intersect): Fix a corner case, as was recently fixed for intsets. CSE truth inference pass uses intsets * module/language/cps/cse.scm (compute-truthy-expressions): Rewrite to use intsets instead of bitvectors. (apply-cse): Adapt. Result of intsect-intersect will share structure with A if it can * module/language/cps/intset.scm (intset-intersect): Ensure that the result shares structure with A if possible, as intmaps do. Fix an intset-intersect corner case * module/language/cps/intset.scm (intset-intersect): Avoid creating invalid intsets when lowering an intset with a higher shift. Fix intset pruning for empty intsets * module/language/cps/intset.scm (make-intset/prune): Fix empty intset case. 2014-06-29 Andy Wingo Remove namesets. This was a failed experiment. It had good space complexity but terrible time complexity. * module/Makefile.am: Update. * module/language/cps/nameset.scm: Remove. 2014-06-29 Andy Wingo Rewrite type inference to use intmaps * module/language/cps/types.scm: Rewrite to use intmaps instead of namesets. New module (language cps intmap) * module/language/cps/intmap.scm: New file. * module/Makefile.am: Add to build. Rewrite CSE to use intsets. * module/language/cps/cse.scm: Rewrite using intsets. New module: (language cps intset) * module/Makefile.am: Add to build. * module/language/cps/intset.scm: New file. 2014-06-29 Andy Wingo Fix bit-count* bug * libguile/bitvectors.c (scm_bit_count_star): Fix typo introduced in 2005 refactor (!) in which the second arg was erroneously taken from the first arg. * test-suite/tests/bitvectors.test: Add test. * doc/ref/api-compound.texi: Fix doc example for u32vector selector. 2014-06-22 Eli Zaretskii Fix compilation of scm_nl_langinfo when some nl_langinfo items are missing. * i18n.c (scm_nl_langinfo): Don't assume that both INT_* and the corresponding non-INT_* items are always either all defined or all undefined. 2014-06-22 Andy Wingo Rewrite type inference pass to use namesets * module/Makefile.am: Build types.scm early, but don't block the rest of the build on it. * module/language/cps/types.scm: Rewrite to use namesets. * module/language/cps/dce.scm: * module/language/cps/type-fold.scm: Adapt to interface changes. 2014-06-22 Andy Wingo New module: (language cps nameset) * module/language/cps/nameset.scm: New file. * module/Makefile.am: Add new file. 2014-06-19 Andy Wingo Refactor dominator computation * module/language/cps/cse.scm: * module/language/cps/dfg.scm (compute-idoms, compute-dom-edges): Move these procedures from cse.scm to dfg.scm. Remove loop-detection code; that can come back later but it is bitrotten for now. Constant folding for (list) and (vector) in peval * module/language/tree-il/peval.scm (peval): Add cases for (list) -> '() and (vector) -> #(). 2014-06-12 Ludovic Courtès tests: Improve lack-of-/dev/null detection. Suggested by Eli Zaretskii . * test-suite/test-suite/lib.scm (%null-device): Test for Windows based by checking for a drive letter in the current directory name. 2014-06-11 Ludovic Courtès Eli Zaretskii i18n: Adjust tests for Windows. * test-suite/tests/i18n.test (mingw?): New variable. (%french-locale-name, %french-utf8-locale-name, %turkish-utf8-locale-name, %german-utf8-locale-name, %greek-utf8-locale-name): Add name of corresponding Windows codepage, when MINGW? is true. (under-turkish-utf8-locale-or-unresolved): Add exception for "mingw32". i18n: Ignore LC_MESSAGES on MinGW. * libguile/locale-categories.h (MESSAGES): Add condition on !(defined(LC_MAX) && LC_MESSAGES > LC_MAX). * test-suite/tests/i18n.test ("locale objects")["make-locale (2 args, list)", "make-locale (3 args)", "locale?"]: Use LC_NUMERIC or LC_TIME instead of LC_MESSAGES. 2014-06-11 Ludovic Courtès tests: Use NUL instead of /dev/null on MinGW. Reported by Eli Zaretskii . * test-suite/test-suite/lib.scm (%null-device): New variable. * test-suite/tests/c-api.test (egrep): Use %NULL-DEVICE instead of /dev/null. * test-suite/tests/popen.test ("open-input-pipe")["no duplicate"]: Likewise. 2014-06-09 Ludovic Courtès Use the right GC version macros. Reported by Doug Evans . * libguile/gc.c (scm_storage_prehistory): Use GC_VERSION_MICRO, not GC_ALPHA_VERSION. 2014-06-06 Taylan Ulrich B R6RS library documentation fix * doc/ref/api-modules.texi (R6RS Libraries): Move 'export' before 'import' in the example library form, as required by R6RS. 2014-06-05 Dmitry Bogatov Fix typo in `transform-string' doc. * doc/ref/texinfo.texi: Fix single typo. 2014-06-05 Mark H Weaver Optimize scm_ilength and 'length+'. * libguile/list.c (scm_ilength): Test for SCM_NULL_OR_NIL_P only after testing scm_is_pair. Conform to GNU coding standards. * libguile/srfi-1.c (scm_srfi1_length_plus): Ditto. 2014-06-05 Mark H Weaver test-guild-compile: Increase sleep time before sending SIGINT. * test-suite/standalone/test-guild-compile: Increase sleep time before sending SIGINT, for slow machines. 2014-06-05 Mark H Weaver Avoid quadratic expansion time in 'and' and 'or' macros. Fixes . Reported by David Kastrup . * module/ice-9/boot-9.scm (and, or): Use dotted tail instead of ellipsis in patterns. 2014-06-03 Ludovic Courtès 'guild compile' doesn't leave temporary files behind it. * module/scripts/compile.scm (compile): Add 'sigaction' call. * test-suite/standalone/test-guild-compile: New file. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it. 2014-06-02 Mark H Weaver SRFI-1 'length+' raises an error unless passed a proper or circular list. Fixes . * libguile/srfi-1.c (scm_srfi1_length_plus): Rewrite to raise an error unless passed a proper or circular list, based on code from 'scm_ilength'. * test-suite/tests/srfi-1.test (length+): Add tests. 2014-06-02 Mark H Weaver Mark system async functions as SCM_API. Fixes . Reported and fixed by Chris Vine . * libguile/async.h (scm_c_call_with_blocked_asyncs) (scm_c_call_with_unblocked_asyncs, scm_dynwind_block_asyncs) (scm_dynwind_unblock_asyncs): Mark as SCM_API. * THANKS: Add Chris Vine to fixes section. 2014-06-01 Andy Wingo Remove $kif * module/language/cps.scm: Remove $kif. * module/language/cps/compile-bytecode.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/renumber.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/type-fold.scm: * module/language/cps/types.scm: * module/language/cps/verify.scm: Adapt. 2014-06-01 Andy Wingo CPS conversion produces $branch nodes, not $kif * module/language/tree-il/compile-cps.scm (unbound?, convert): Create $branch nodes instead of $kif nodes. 2014-06-01 Andy Wingo Add $branch expression type * module/language/cps.scm ($branch): New expression type; will replace $kif. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/primitives.scm: * module/language/cps/renumber.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/type-fold.scm: * module/language/cps/types.scm: * module/language/cps/verify.scm: Adapt to $branch expression type. 2014-06-01 Andy Wingo Fix source-line-for-user for unknown line * module/system/vm/debug.scm (source-line-for-user): Fix to allow for unknown lines. Fix off-by-one in dump-dfg * module/language/cps/dfg.scm (dump-dfg): Fix bug where the last continuation wasn't printed. Fix compute-predecessors bug in frame.scm * module/system/vm/frame.scm (compute-predecessors): Fix bug in resolving targets of backwards branches. 2014-05-28 Ludovic Courtès Slightly simplify 'scm_open_process'. * libguile/posix.c (scm_open_process): Call 'scm_fdes_to_port' with the '0' flag, and remove 'scm_setvbuf' calls. 2014-05-28 Ludovic Courtès rdelim: Speed up 'read-string' (aka. 'get-string-all'.) This yields a 20% improvement on the "read-string" benchmark. * module/ice-9/rdelim.scm (read-string): Rewrite as a 'case-lambda', with a tight loop around 'read-char', and without using 'read-string!'. * test-suite/tests/rdelim.test ("read-string")["longer than 100 chars, with limit"]: New test. * benchmark-suite/benchmarks/ports.bm ("rdelim")["read-string"]: New benchmark. 2014-05-28 Ludovic Courtès tests: Add test for . * test-suite/tests/r6rs-ports.test ("7.2.8 Binary Input")("http://bugs.gnu.org/17466"): New test. 2014-05-28 Ludovic Courtès Fix shrinking of contiguous bytevectors, as from 'get-bytevector-n'. Fixes . Reported by J Kalbhenn . * libguile/bytevectors.c (scm_c_shrink_bytevector): When BV is contiguous, add use of 'SCM_BYTEVECTOR_SET_CONTENTS'. 2014-05-23 Ludovic Courtès web: Keep the default size for the client's in-kernel receive buffer. Fixes . * module/web/client.scm (open-socket-for-uri): Remove call to 'setsockopt'. Contrary to what the comment said, its effect was to shrink the receive buffer from 124 KiB (the default size, per /proc/sys/net/core/rmem_default on Linux-based systems) to 12 KiB. 2014-05-21 Ludovic Courtès tests: Add test for _IOLBF. * test-suite/tests/ports.test ("pipe, fdopen, and _IOLBF"): New test. 2014-05-16 Andy Wingo Update effects-analysis docstring. * module/language/cps/effects-analysis.scm: Update docs. 2014-05-16 Andy Wingo Redefine memory kind part of effects to be enumeration, not flags * module/language/cps/effects-analysis.scm (define-enumeration): New helper. (&memory-kind-mask): Define as an enumeration, not a bitfield. Add &unknown-memory-kinds. (&all-effects, effect-clobbers?, make-prompt-tag, expression-effects): Adapt. Note that this change requires dce.go and cse.go to be recompiled. 2014-05-16 Ludovic Courtès Silence GCC warning. * libguile/fports.c (scm_setvbuf): Initialize 'drained'. GCC 4.9 raises a "may be used uninitialized warning" for 'drained', because it can't tell that 'drained' is initialized anytime NDRAINED > 0. 2014-05-15 Andy Wingo DCE uses type analysis to elide type checks * module/language/cps/dce.scm (elide-type-checks!, compute-live-code): Replace old ad-hoc type check elision with one driven from type analysis. Type check elision only operates on smallish functions, to avoid n**2 explosion in type inference. 2014-05-15 Andy Wingo Limit impact of O(n^2) type analysis by imposing limit * module/language/cps/types.scm (infer-types): Add #:max-label-count argument. * module/language/cps/type-fold.scm (compute-folded, fold-constants*): Disable for big functions. Perhaps we can relax this if we find an O(n log n) way to represent types. 2014-05-15 Andy Wingo Compile language/cps/types.scm early * module/Makefile.am (BOOT_SOURCES, BOOT_GOBJECTS): New variables. (CLEANFILES, nobase_mod_DATA, nobase_ccache_DATA, EXTRA_DIST) (ETAGS_ARGS): Use the new variables. (CPS_LANG_SOURCES): Remove language/cps/types.scm, as it is a boot file. 2014-05-15 Andy Wingo Enable type folding * module/language/cps/compile-bytecode.scm (optimize): Enable type folding. 2014-05-15 Andy Wingo Type and range inference for CPS * module/language/cps/types.scm: New file, implementing type and range inference over CPS. * module/language/cps/type-fold.scm: New file, implementing abstract constant folding for CPS. * module/Makefile.am: Add the new files. * module/language/cps/compile-bytecode.scm: Wire up type-fold, but currently disabled. 2014-05-12 Andy Wingo Add syntax-parameterize indentation to .dir-locals.el. * .dir-locals.el: Add syntax-parameterize indentation. 2014-05-08 Andy Wingo Rewrite effects analysis to be precise for fields. * module/language/cps/effects-analysis.scm: Rewrite so that instead of the depends/causes effects, there is just &type-check, &allocation, &read, and &write. The object kind is a separate part of the bitfield, and the field in the object (if appropriate) is another field. Effects are still a fixnum. This enables precise effects for vectors and structs on all architectures. This kind of effects analysis was not possible in Tree-IL because Tree-IL relied on logior-ing effects of subexpressions, whereas with CPS we have no sub-expressions and we do flow analysis instead. (effect-clobbers?): Replace effects-commute? with this inherently directional and precise predicate. * module/language/cps/cse.scm (compute-always-available-expressions): (compute-equivalent-subexpressions): Adapt to effects analysis change. * module/language/cps/dce.scm (compute-live-code): Likewise. 2014-05-07 Andy Wingo CSE effects analysis cleanup * module/language/cps/cse.scm (compute-always-available-expressions): Use constant? instead of zero?, to avoid punching through the effects abstraction. Add dump-dfg pretty-printer * module/language/cps/dfg.scm (dump-dfg): New pretty-printer. Under construction. Synthetic definitions take advantage of CSE'd vars * module/language/cps/cse.scm (compute-available-expressions): Simplify initialization. (compute-equivalent-subexpressions): When synthesizing definitions, use substed vars. Add synthetic definitions after processing an expression, to take advantage of the substed vars. Fix thinko in synthesize-definition-effects! * module/language/cps/effects-analysis.scm (synthesize-definition-effects!): Fix a boneheaded thinko that caused all primcalls to be marked as causing car, cdr, vector, struct, and box effects. 2014-05-04 Andy Wingo Fix frame-call-representation for frames from apply-hook * module/system/vm/frame.scm (frame-call-representation): Fix when called on frames that are created from the apply hook. 2014-05-04 Andy Wingo Program printing tweaks * module/system/vm/program.scm (print-program): New public interface -- the guts of write-program, but refactored to be able to work when only given an addr. (write-program): Use print-program. * module/system/vm/frame.scm (frame-call-representation): Remove attempt to abbreviate procedure representations; was confusing because the result would write as a string, quotes and all. 2014-05-04 Andy Wingo Refactorings to apply-hook and push-continuation-hook * libguile/vm-engine.c (vm_engine): Always invoke the apply hook after the ip has been reset. Avoids problems in frame-bindings, which builds its bindings map based on the IP. Invoke push-continuation before linking the new frame, so that more locals are available to the frame inspector. * module/system/vm/traps.scm (trap-in-procedure): No need for a push-cont handler, as the apply handler will exit the frame. 2014-05-04 Andy Wingo frame-address, frame-stack-pointer return offsets * libguile/frames.c (scm_frame_address, scm_frame_stack_pointer): Return offsets instead of absolute pointers. This is robust in the presence of stack relocation. * module/system/repl/debug.scm (print-registers): Adapt to print sp and fp as integers. 2014-05-04 Andy Wingo frame-call-representation has #:top-frame? as keyword argument * module/system/vm/frame.scm (frame-call-representation): Change top-frame? argument to be a keyword instead of an optional argument. * module/system/vm/trace.scm (print-application): Adapt caller. 2014-05-03 Andy Wingo Set-car! on a dead pair does not force the pair to be live * module/language/cps/dce.scm (constant-type, lookup-type) (default-type-checker, *primcall-type-checkers*) (define-primcall-type-checker, define-simple-primcall-types) (check-primcall-arg-types): Define a really lame type analysis that can elide some expressions causing &type-check. (compute-live-code): Wire up the type checker. Add auxiliary definitions for boxes * module/language/cps/cse.scm (compute-equivalent-subexpressions): Add auxiliary definitions for boxes. 2014-05-02 Andy Wingo CSE does scalar replacement of aggregates * module/language/cps/effects-analysis.scm (effects-clobber): New helper. (length): Only depend on &cdr. (synthesize-definition-effects!): New interface. * module/language/cps/cse.scm (compute-available-expressions): Don't count out constructors here -- we'll do that below. (compute-defs): Add a comment. (compute-equivalent-subexpressions): Synthesize getter calls at constructor/setter sites, so that (set-car! x y) can cause a future (car x) to just reference y. The equiv-labels set now stores the defined vars, so there is no need for the defs vector. (cse, apply-cse): Adapt to compute-equivalent-subexpressions change. 2014-05-02 Andy Wingo More inlinable effects-analysis procedures * module/language/cps/effects-analysis.scm (exclude-effects) (effect-free?, constant?): Define to be inlinable. (allocate-struct/immediate): Add effects. Update NEWS * NEWS: Update. 2014-05-01 Andy Wingo Rewrite boot-9 map to be recursive and pure * module/ice-9/boot-9.scm (map): Rewrite to be recursive and pure instead of iterative and effectful. At best this is faster; at worst it is slower. In any case it resolves continuation-related issues. * module/srfi/srfi-1.scm (fold): Specialize the two-arg case. (map): Rewrite to be recursive. * test-suite/tests/r5rs_pitfall.test (8.3): Update for new expected map behavior. 2014-05-01 Andy Wingo Fix inner and outer stack cuts to match on procedure code * doc/ref/api-debug.texi (Stack Capture): Update make-stack docs. * libguile/programs.h: * libguile/programs.c (scm_program_address_range): New internal procedure. * libguile/stacks.c (narrow_stack): Interpret a pair of integers as an address range. If a cut is a procedure, attempt to resolve it to an address range. (scm_make_stack): Update docstring. * module/system/vm/program.scm (program-address-range): New exported procedure. * module/statprof.scm (statprof, gcprof): Use program-address-range to get the outer-cut, for efficiency. 2014-04-28 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: .gitignore doc/example-smob/Makefile doc/ref/api-smobs.texi doc/ref/libguile-concepts.texi doc/ref/libguile-smobs.texi libguile.h libguile/finalizers.c libguile/finalizers.h libguile/goops.c module/language/tree-il/compile-glil.scm module/oop/goops.scm 2014-04-28 Andy Wingo Prefer foreign objects over smobs in manual * doc/ref/api-memory.texi (Memory Blocks): Recommend against scm_gc_free. Refer to foreign objects instead of smobs. Remove discussion of scm_must_malloc et al. * doc/ref/guile.texi (API Reference): Rename SMOB menu item. * doc/ref/libguile-snarf.texi (Function Snarfing): Update example to not refer to smobs. * doc/ref/tools.texi (How guile-snarf works): Likewise. 2014-04-28 Andy Wingo Add new standalone tests to gitignore * .gitignore: Add entries. 2014-04-28 Andy Wingo Remove doc/example-smob/ * doc/example-smob/: Remove example. It's smaller than it used to be in Guile 1.8, and with foreign objects there's practically nothing interesting to test. * doc/oldfmt.c: Remove this hoary thing. * doc/README: * doc/Makefile.am: Update. 2014-04-28 Andy Wingo Remove SMOB tutorial; update manual. * doc/ref/libguile-smobs.texi: Remove; this tutorial is superseded by libguile-foreign-objects. * doc/ref/libguile-foreign-objects.texi: Proofreading. * doc/ref/libguile-program.texi: Update Dia examples to refer to foreign objects. * doc/ref/libguile-concepts.texi (Garbage Collection): Update to accurately describe the BDW-GC, and to avoid reference to mark functions. * doc/ref/guile.texi: Remove libguile-smobs, and reword API menu. * doc/ref/api-utility.texi (Equality): Mention GOOPS instead of SMOBs. * doc/ref/api-smobs.texi (Smobs): Describe as a legacy interface. Exhort readers against the writing of mark functions. * doc/ref/api-foreign-objects.texi (Foreign Objects): Proofreading. * doc/ref/api-control.texi (Catch): Fix ref to point to foreign objects. * doc/ref/Makefile.am: Remove libguile-smobs.texi. 2014-04-28 Andy Wingo Add foreign object documentation * doc/ref/api-foreign-objects.texi: * doc/ref/libguile-foreign-objects.texi: New files. * doc/ref/guile.texi: * doc/ref/Makefile.am: Link new files into docs. 2014-04-28 Andy Wingo Add more foreign object interfaces * libguile/foreign-object.c: * libguile/foreign-object.h (scm_make_foreign_object_1) (scm_make_foreign_object_2, scm_make_foreign_object_3) (scm_make_foreign_object_n): Change to take void * arguments, and to add a comment to the header indicating that these are convenience constructors. * libguile/foreign-object.c: * libguile/foreign-object.h (scm_foreign_object_unsigned_ref) (scm_foreign_object_unsigned_set_x): New functions, equivalent to the old scm_foreign_object_ref and scm_foreign_object_set_x. * libguile/foreign-object.c: * libguile/foreign-object.h (scm_foreign_object_signed_ref) (scm_foreign_object_signed_set_x): New functions taking scm_t_signed_bits. * libguile/foreign-object.c: * libguile/foreign-object.h (scm_foreign_object_ref) (scm_foreign_object_set_x): New functions that take void*. 2014-04-28 Andy Wingo Avoid non-constant struct initializers * libguile/foreign-object.c (scm_make_foreign_object_2): (scm_make_foreign_object_3): Avoid non-constant struct initializers. 2014-04-28 Andy Wingo Add scm_make_foreign_object_0; optimize scm_make_foreign_object_n. * libguile/foreign-object.c (scm_make_foreign_object_0): New function. (scm_make_foreign_object_n): Pre-fetch layout_chars. * libguile/foreign-object.h: Add scm_make_foreign_object_0. 2014-04-28 Andy Wingo New foreign object facility, to replace SMOBs * libguile/foreign-object.c: * libguile/foreign-object.h: * module/system/foreign-object.scm: * test-suite/standalone/test-foreign-object-c.c: * test-suite/standalone/test-foreign-object-scm: New files. * test-suite/standalone/Makefile.am: * module/Makefile.am: * libguile/Makefile.am: Add new files. * libguile.h: Add foreign-object.h. * libguile/init.c (scm_i_init_guile): Call scm_register_foreign_object. 2014-04-27 Andy Wingo Fix foreign slot initialization and access * libguile/goops.c (scm_sys_initialize_object): Refactor initialization so that we don't ref uninitialized slots before initializing them. This allows foreign slots, whose initial value is 0, to be initialized via #:init-form. * module/oop/goops.scm (@slot-ref, @slot-set!): Remove definitions. Change callers to use struct-ref and struct-set!. slot-ref and slot-set! were only marginally more efficient and were much more dangerous. This change allows the standard accessors to work on foreign slots; that was not the case before, as the 'u' fields of the struct were read as if they were 'p' slots. * module/language/tree-il/compile-glil.scm (lambda): Remove support for compiling @slot-ref/@slot-set!. These were private to GOOPS. * test-suite/tests/goops.test ("active-slot"): Update to not expect a ref before initialization. ("foreign slots"): Add tests. 2014-04-26 Andy Wingo Add interface to disable automatic finalization * libguile/finalizers.h: * libguile/finalizers.c (run_finalizers_async_thunk): Call the new scm_run_finalizers helper. (scm_set_automatic_finalization_enabled, scm_run_finalizers): New functions. (scm_init_finalizers): Only set a finalizer notifier if automatic finalization is enabled. * doc/ref/libguile-smobs.texi (Garbage Collecting Smobs): Add discussion of concurrency. * doc/ref/api-smobs.texi (Smobs): Document new functions. 2014-04-25 Mark H Weaver Merge branch 'stable-2.0' Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c print: Fix printing of weak vectors. * libguile/print.c (print_vector_or_weak_vector): New static function. (iprin1): Use 'print_vector_or_weak_vector' in the vector and weak vector cases. Support weak vectors, arrays, and bitvectors in (system base types). * module/system/base/types.scm (%tc7-wvect, %tc7-array, %tc7-bitvector): New variables. (cell->object): Add cases for weak vectors, arrays, and bitvectors. print: avoid triggering deprecation warnings when printing weak vectors. * libguile/print.c (iprin1): Use 'scm_c_weak_vector_ref' to access elements of weak vectors. 2014-04-24 Ludovic Courtès build: Clean up rules for meta/{guild,guile-config}. * meta/Makefile.am (guile-config, guild): Avoid useless 'cat' invocation'. Quote all occurrences of '@'. Suggested by Eric Blake . build: Clean up rules for meta/{guild,guile-config}. * meta/Makefile.am (guile-config, guild): Avoid useless 'cat' invocation'. Quote all occurrences of '@'. Suggested by Eric Blake . build: Honor program name transformation in 'guild'. * configure.ac: Remove erroneous 'guile_program_name' substitute; see for details. Remove 'meta/guild' config file. * meta/Makefile.am (guild): New target. (CLEANFILES): Add 'guild'. * meta/guild.in: Remove 'prefix' and 'exec_prefix' definitions; use @installed_guile@. build: Honor program name transformation in 'guild'. * configure.ac: Remove erroneous 'guile_program_name' substitute; see for details. Remove 'meta/guild' config file. * meta/Makefile.am (guild): New target. (CLEANFILES): Add 'guild'. * meta/guild.in: Remove 'prefix' and 'exec_prefix' definitions; use @installed_guile@. 2014-04-23 Ludovic Courtès Set $GC_MARKERS to 1 when libgc 7.4.0 is used. * libguile/gc.c (scm_storage_prehistory) [GC_VERSION == 7.4.0]: Add 'setenv' call. 2014-04-22 Dmitry Bogatov Fix memory leak on `realloc' failure * libguile/script.c (realloc0): New helper. (script_read_arg, scm_get_meta_args): Use realloc0, not realloc. 2014-04-21 Andy Wingo Add make-vector opcode * libguile/vm-engine.c (make-vector): New opcode. * module/language/cps/compile-bytecode.scm (compile-fun): * module/system/vm/assembler.scm (system): Support the new opcode. (*bytecode-minor-version*): Bump. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * test-suite/tests/compiler.test ("limits"): Add vector test. 2014-04-21 Andy Wingo Operations on 8-bit and 12-bit operands shuffle args into range * module/language/cps/slot-allocation.scm (allocate-slots): Avoid allocating locals in the range [253,255]. * module/system/vm/assembler.scm: List exports explicitly. For operations with limited-range operands, export wrapper assemblers that handle shuffling their operands into and out of their range. (define-assembler): Get rid of enclosing begin. (shuffling-assembler, define-shuffling-assembler): New helpers to define shuffling wrapper assemblers. (emit-mov*, emit-receive*): New functions. (shuffle-up-args): New helper. (standard-prelude, opt-prelude, kw-prelude): Call shuffle-up-args after finishing. * test-suite/tests/compiler.test ("limits"): Add test cases. 2014-04-21 Andy Wingo More expansion-time-only definitions in assembler.scm * module/system/vm/assembler.scm (define-inline): Change so that the defined macro is only defined at expansion-time. (u32-ref, u32-set!, s32-ref, s32-set!, pack-arity-flags): Use define-inline. (pack-flags, assert-match, *block-size*, id-append, assembler) (define-assembler, visit-opcodes, define-macro-assembler): Wrap in eval-when expand. define-inline in assembler.scm * module/system/vm/assembler.scm (define-inline): New local helper. Update local users of define-inlinable to use it. 2014-04-20 Andy Wingo VM opcodes only have <24-bit slot operands in the first word * libguile/vm-engine.c (make-array): Change to only have restricted-width operands in the first word. This instruction is currently unused, however. * module/system/vm/assembler.scm (assembler): * module/system/vm/disassembler.scm (disassembler): Disallow restricted-width operands in tail words. 2014-04-17 Andy Wingo Add interface to disable automatic finalization * libguile/finalizers.h: * libguile/finalizers.c (run_finalizers_async_thunk) (finalization_thread_proc): Call the new scm_run_finalizers helper. (scm_i_finalizer_pre_fork): Only spawn the thread if automatic finalization is enabled. (scm_set_automatic_finalization_enabled, scm_run_finalizers): New functions. (scm_init_finalizers, scm_init_finalizer_thread): Only set a finalizer notifier if automatic finalization is enabled. * doc/ref/libguile-smobs.texi (Garbage Collecting Smobs): Add discussion of concurrency. * doc/ref/api-smobs.texi (Smobs): Document new functions. 2014-04-16 Andy Wingo Slot allocation can re-use closure and argument slots * module/language/cps/slot-allocation.scm (allocate-slots): Allow slot allocation to re-use the closure and argument slots. Remove SCM_FRAME_PROGRAM * libguile/frames.h: Remove SCM_FRAME_PROGRAM, now unused. 2014-04-16 Andy Wingo VM robustness for optimized closures * libguile/vm.c (vm_error_unbound, vm_error_unbound_fluid): Remove proc argument. The value in slot 0 is not necessarily the procedure being applied, after the prelude is done. * libguile/vm-engine.c (vm_engine): Use LOCAL_REF (0) instead of SCM_FRAME_PROGRAM, and adapt to above changes. 2014-04-16 Andy Wingo Fix rewinding continuations when outermost frame has zero locals * libguile/vm.c (vm_reinstate_partial_continuation_inner): Fix boundary condition when the outermost frame has zero locals. frame-previous, frame-procedure robustness * libguile/frames.c (scm_c_frame_closure): Don't use SCM_FRAME_PROGRAM, as we don't know if the frame actually has any locals. (scm_c_frame_previous): More robustly detect end-of-stack. Allows scm_c_frame_previous to work on partial continuations. make-stack works on delimited continuations * libguile/stacks.c (scm_make_stack, scm_stack_id): * libguile/vm.c (scm_i_vm_cont_to_frame): Allow delimited continuations as the argument to make-stack. More robust coverage tests * test-suite/tests/coverage.test ("line-execution-counts"): Allow zero or one count on the loop head. Change some make-stack tests to use frame-call-representation * test-suite/tests/eval.test ("stacks"): Use frame-call-representation. Fix statprof for optimizations * module/statprof.scm (profile-signal-handler): Bind in a letrec. Otherwise the compiler may see the closure slot as dead, and the inner stack cut won't work. Fix a frame-call-representation bug * module/system/vm/frame.scm (frame-call-representation): Fix logic for displaying names of non-procedures and procedures out of arities. 2014-04-16 Andy Wingo Better backtraces from C, especially for optimized closures * libguile/frames.h: * libguile/frames.c (scm_frame_call_representation): New interface; dispatches to Scheme. * libguile/backtrace.c (display_application): Use scm_frame_call_representation. This should be monotonically better, given that scm_frame_arguments (which was previously called) also dispatched to Scheme and actually ended up calling frame-call-representation. 2014-04-16 Andy Wingo frame-call-representation checks available-bindings, as appropriate * module/system/vm/frame.scm (available-bindings): Map indexes in such a way that the first argument is index 1. (frame-call-representation): Update to search the bindings for live bindings. 2014-04-16 Andy Wingo Update frame-bindings interface * module/system/repl/debug.scm (print-locals): Update to work with new interface. (frame->module): Update. Still doesn't work due to lack of `program-module', though. * module/system/vm/program.scm (make-binding, binding:name) (binding:definition-offset, program-arity-bindings-for-ip): Remove these. * module/system/vm/frame.scm (): New type. (available-bindings): Return a list of instances. (frame-lookup-binding, frame-binding-set!, frame-binding-ref): (frame-environment, frame-object-name): Adapt. 2014-04-16 Andy Wingo Implement frame-bindings * module/system/vm/frame.scm (parse-code, compute-predecessors): (compute-genv, compute-defs-by-slot, compute-killv, available-bindings): (frame-bindings): Add a bunch of hairy code to compute the set of bindings that are live in a frame. Add arity-code * module/system/vm/debug.scm (arity-code): New interface. Add parsing interfaces to the disassembler * module/system/vm/disassembler.scm (instruction-length): (instruction-has-fallthrough?, instruction-relative-jump-targets): (instruction-slot-clobbers): New interfaces; to be used when determining the bindings available at a given point of a procedure. Fix up some opcode metadata * libguile/vm-engine.c (make-long-immediate, static-ref): Mark as "dst" instructions. 2014-04-16 Mark H Weaver Update libgc URL in README. * README: Update libgc URL. Suggested by Ian Grant . 2014-04-15 Andy Wingo Add ability to query local definitions for a procedure * module/system/vm/debug.scm (arity-definitions): New interface. * module/system/vm/program.scm (make-binding, binding:boxed?) (binding:index, binding:start, binding:end): Remove. (binding:definition-offset, binding:slot): Add. (program-arity-bindings-for-ip): Rename from program-bindings-for-ip, as it gives all definitions in an arity. The user will have to do data-flow analysis to recover the set of variables that are actually available at any given point. (arity->arguments-alist): Remove crufty code. 2014-04-15 Andy Wingo Fix rtl tests * module/system/vm/assembler.scm (write-arities): Add a diagnostic. * test-suite/tests/rtl.test: Fix tests to emit "definition" instructions. 2014-04-15 Andy Wingo Fix frame-call-representation for primitive applications * module/system/vm/frame.scm (frame-call-representation): Fix to work for primitives. * test-suite/tests/eval.test ("stacks"): Update expected result for substring. 2014-04-15 Andy Wingo Assembler residualizes local variable definition locations * module/system/vm/assembler.scm (write-arities): Serialize definition locations after names. (definition): Store definition as a byte offset. Bump minor objcode version for recent changes * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. 2014-04-15 Andy Wingo Write all local variable names into the arities section * module/system/vm/assembler.scm (put-uleb128, put-sleb128) (port-position): Lift out these helpers. (arity-header-len, write-arities, link-arities): Add "nlocals" to the arity headers. Write names of all locals into the arities section, not just the arguments. Write them as uleb128's instead of uint32's, to save space. * module/system/vm/debug.scm (arity-header-len, arity-nlocals*) (arity-nlocals, arity-locals, arity-arguments-alist): Adapt to new encoding for arities. 2014-04-15 Andy Wingo Tweak arities debugging representation * module/system/vm/assembler.scm (meta-arities-size, write-arity-links): * module/system/vm/debug.scm (arity-keyword-args) (arity-arguments-alist): Rewrite to put they keyword literals link first. Unfortunately requires a recompile :/ 2014-04-15 Andy Wingo Beginnings of local variable information * module/system/vm/assembler.scm (, begin-kw-arity, end-arity): (definition): Add definition macro-instruction. Arrange to record variable definitions. * module/language/cps/compile-bytecode.scm (compile-fun): Emit definition macro-instructions as appropriate. 2014-04-15 Andy Wingo Remove needless label remapping in slot-allocation * module/language/cps/slot-allocation.scm (dead-after-def?): (dead-after-use?, allocate-slots): Remove some needless remapping between label indexes in the CFA, the DFA, and their names. DFA datums don't rename their labels * module/language/cps/dfg.scm (analyze-reverse-control-flow): Don't compute and return an order vector; it's not needed. ($dfa): Remove label renaming. We can just rename labels before returning the DFA. (dfa-k-idx, dfa-k-sym, dfa-k-count): Adapt. (compute-live-variables): Adapt, and rename labels before returning. 2014-04-15 Andy Wingo Better backtraces for optimized closures * module/system/vm/debug.scm (arity-keyword-args, find-program-arity): New exports. * module/system/vm/frame.scm (frame-call-representation): Prefer to use the frame IP to get the procedure. 2014-04-14 Andy Wingo statprof avoids mucking with VM trace levels when not counting calls * module/statprof.scm (statprof-start, statprof-stop): Don't futz the vm trace level when we aren't counting calls. With this change, statprof now imposes no overhead on the measured program. Better state handling in statprof * module/statprof.scm (statprof-fold-call-data) (statprof-proc-call-data): Add optional state arg. (gcprof): Add optional port arg, and pass state arg explicitly. (statprof-display-anomalies, statprof-display) (statprof-call-data->stats): Pass state explicitly. 2014-04-14 Andy Wingo Optimize make-stack * libguile/continuations.h: * libguile/continuations.c (scm_i_continuation_to_frame): Operate on low-level C structures instead of heap objects. * libguile/frames.h: * libguile/frames.c (frame_offset, frame_stack_base): Const args. (scm_c_frame_closure): New helper. (scm_frame_procedure): Use the new helper. * libguile/stacks.c (stack_depth, narrow_stack, scm_make_stack): Rework to avoid allocating frames as we traverse the stack, and to avoid an n**2 case where there are outer cuts. 2014-04-14 Andy Wingo Readline history preserves newlines * guile-readline/ice-9/readline.scm (make-readline-port): Preserve newlines. This preserves the semantics of history entries that contain until-end-of-line comments using `;'. 2014-04-14 Andy Wingo scm_c_make_frame takes struct scm_frame as arg * libguile/frames.h: * libguile/frames.c (scm_c_make_frame): Adapt to take a const struct scm_frame as the argument. Adapt callers. * libguile/continuations.c: * libguile/stacks.c: Adapt callers. 2014-04-14 Andy Wingo Refactor to frames code * libguile/frames.h: * libguile/frames.c (scm_c_frame_previous): New internal helper. (scm_frame_previous): Use the helper. (RELOC): Take kind and low-level frame args separately. Adapt callers. (frame_stack_base, frame_offset): New helpers. (scm_i_frame_offset, scm_i_frame_stack_base): Use low-level helpers. Optimize make-global-cont-folder * module/language/cps.scm (make-global-cont-folder): Inline the fold-values, as peval doesn't do so. Allows closure conversion to avoid any closure creation. 2014-04-13 Andy Wingo Improve disassembly for optimized closures * module/system/vm/disassembler.scm (code-annotation): Add call-label and tail-call-label cases. (disassemble-addr): With call-label we can see sets of mutually recursive functions, so keep a global "visited?" set. Remove debugging code in closure-conversion * module/language/cps/closure-conversion.scm (prune-free-vars): Remove pk. Eval has no more free variables * module/ice-9/eval.scm (primitive-eval): Expand out the call to make-general-closure, so that make-general-closure becomes well-known. Now eval has no more free variables! Closure conversion eliminates self-references introduced by fixpoint * module/language/cps/closure-conversion.scm (analyze-closures): Build a bound-vars set as well, to resolve introduced self-references. (prune-free-vars, convert-one): Arrange to eliminate self-references. Refactor to closure-conversion * module/language/cps/closure-conversion.scm (convert-one): Refactor to pull in helpers locally, as they will need more state. Avoid consing an unbound-arg marker in the evaluator * module/ice-9/eval.scm (primitive-eval): Turns out we don't need to cons to make the unbound-arg marker. Optimize closures with one free variable * module/language/cps/closure-conversion.scm (convert-free-var) (allocate-closure, init-closure, prune-free-vars, convert-one) (convert-closures): Optimize closures with one free variable. 2014-04-12 Andy Wingo Well-known closures represented using pairs or vectors * module/language/cps/closure-conversion.scm (convert-free-var): (convert-free-vars): Take self-known? param, to do the right thing for well-known closures. (allocate-closure): New helper. Well-known closures are represented using pairs or vectors. (init-closure): Adapt tpo DTRT for well-known closures. (prune-free-vars): Move up. (convert-one): Adapt to new well-known closure representation. Update verify-cps * module/language/cps/verify.scm (verify-cps): Update for recent CPS changes. Avoid creating closures with no free variables * module/language/cps/closure-conversion.scm (init-closure): Return just one value. (analyze-closures): Rewrite the well-known set to key off the label instead of the closure identifiers before returning. (convert-one): Avoid creating closure objects at runtime or load-time when "instantiating" or calling well-known closures with no free variables. (prune-free-vars): New pass. (convert-closures): Adapt. Hard-wire calls to known procedures * module/language/cps/closure-conversion.scm (analyze-closures): (convert-one, convert-closures): Hard-wire calls to known procedures by transforming $call to $callk. closure conversion computes well-known functions * module/language/cps/closure-conversion.scm (analyze-closures) (convert-closures, convert-one): Adapt to compute well-known functions. We don't yet produce $callk though. 2014-04-12 Andy Wingo First-order CPS has $program and $closure forms * module/language/cps.scm ($closure, $program): New CPS types, part of low-level (first-order) CPS. (build-cps-exp, build-cps-term, parse-cps, unparse-cps) (compute-max-label-and-var): Update for new CPS types. * module/language/cps/closure-conversion.scm: Rewrite to produce a $program with $closures, and no $funs. * module/language/cps/reify-primitives.scm: * module/language/cps/compile-bytecode.scm (compile-fun): (compile-bytecode): Adapt to new first-order format. * module/language/cps/dfg.scm (compute-dfg): Add $closure case. * module/language/cps/renumber.scm (renumber): Allow this pass to work on either format. * module/language/cps/slot-allocation.scm (allocate-slots): Add $closure case. 2014-04-11 Andy Wingo Separate make-cont-folder into global and local variants * module/language/cps.scm (make-global-cont-folder) (make-local-cont-folder): Separate this macro in two. It's hot and the difference can be important for perf. * module/language/cps/dfg.scm (compute-label-and-var-ranges): * module/language/cps/cse.scm (compute-label-and-var-ranges): * module/language/cps/dce.scm (compute-live-code): Adapt. 2014-04-11 Andy Wingo Root higher-order CPS term is always $kfun $cont * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-bailouts.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/renumber.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/specialize-primcalls.scm: * module/language/tree-il/compile-cps.scm: Adapt to produce and consume raw $kfun $cont instances. * .dir-locals.el: Update $letrec indentation. 2014-04-11 Andy Wingo Closure conversion, reify-primitives use $kfun $cont * module/language/cps/closure-conversion.scm: Produce a $kfun $cont. * module/language/cps/reify-primitives.scm: Produce and consume $kfun $cont. * module/language/cps/compile-bytecode.scm: Adapt. 2014-04-11 Andy Wingo Preparation for compile-bytecode to work on $kfun $conts * module/language/cps/compile-bytecode.scm (compile-fun): Change to take a $kfun $cont instead of a $fun. (visit-funs): Change likewise, and call the proc on $kfun $cont's, not $fun's. (compile-bytecode): Adapt. * module/language/cps/dfg.scm (analyze-reverse-control-flow): Adapt to expect a $kfun $cont. 2014-04-11 Andy Wingo compute-dfg takes a $kfun $cont, not a $fun * module/language/cps/dfg.scm (compute-dfg): Take a $kfun $cont instead of a $fun. * module/language/cps/arities.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/contification.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/simplify.scm: * module/language/cps/specialize-primcalls.scm: Adapt callers. 2014-04-11 Andy Wingo with-fresh-name-state takes a cont, not a $fun * module/language/cps.scm (with-fresh-name-state): Take a cont instead of a fun. * module/language/cps/closure-conversion.scm: * module/language/cps/constructors.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-bailouts.scm: * module/language/cps/reify-primitives.scm: Adapt. 2014-04-11 Andy Wingo Function defined by make-cont-folder takes a cont, not a $fun * module/language/cps.scm (make-cont-folder): Take a cont instead of a $fun. (with-fresh-name-state): Adapt. * module/language/cps/cse.scm (compute-label-and-var-ranges): * module/language/cps/dce.scm (compute-live-code): * module/language/cps/dfg.scm (compute-dfg): * module/language/cps/elide-values.scm (elide-values): * module/language/cps/reify-primitives.scm (reify-primitives): * module/language/cps/renumber.scm (compute-new-labels-and-vars): (renumber): Adapt. 2014-04-10 Andy Wingo Rename $kentry to $kfun * module/language/cps.scm ($kfun): Rename from $kentry. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-bailouts.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/renumber.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/specialize-primcalls.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt users. 2014-04-10 Andy Wingo src and meta are fields of $kentry, not $fun * module/language/cps.scm ($kentry, $fun): Attach "src" and "meta" on the $kentry, not the $fun. This prepares us for $callk to $kentry continuations that have no corresponding $fun. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/cse.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-bailouts.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/renumber.scm: * module/language/cps/self-references.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/specialize-primcalls.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt. 2014-04-10 Andy Wingo Remove tests for old Tree-IL CSE module * test-suite/tests/cse.test: Remove. * test-suite/Makefile.am: 2014-04-09 Andy Wingo Remove obsolete comment in compile-bytecode.scm * module/language/cps/compile-bytecode.scm (optimize): Remove an obsolete comment. 2014-04-08 Andy Wingo New pass to avoid free variable creation for self-recursion * module/language/cps/self-references.scm: New pass, avoids the need for self-recursion to allocate free variables. * module/Makefile.am: * module/language/cps/compile-bytecode.scm: Wire up the new pass. 2014-04-08 Andy Wingo Compile some standalone tests to bytecode * test-suite/standalone/test-out-of-memory: * test-suite/standalone/test-stack-overflow: Compile these files before running them. That way, recursion can check the stack-overflow mechanism instead of the memory allocation mechanism. We compile beforehand as a prepass so as not to impose an rlimit on a Guile that previously ran auto-compilation. 2014-04-06 Andy Wingo Remove old Tree-IL CSE pass * module/language/tree-il/cse.scm: Delete. * module/language/tree-il/optimize.scm: Remove use of Tree-IL CSE. * module/Makefile.am: Remove language/tree-il/cse.scm. * module/language/cps/compile-bytecode.scm: Rename CSE keyword to #:cse?. 2014-04-06 Andy Wingo Flow-sensitive analysis of truth values * module/language/cps/cse.scm (compute-truthy-expressions): (compute-equivalent-subexpressions, apply-cse): Arrange to infer truthiness of expressions, and use that information to elide redundant tests. 2014-04-05 Andy Wingo Add effects for specialized primitives * module/language/cps/effects-analysis.scm (make-vector) (make-vector/immediate, vector-ref/immediate, vector-set!/immediate) (struct-ref/immediate, struct-set!/immediate): Add effects. Minor cleanup/optimization in CSE * module/language/cps/cse.scm (compute-available-expressions): Remove needless for-each definition. (compute-equivalent-subexpressions): Optimize for-each/2. Prune bailouts after contification * module/language/cps/compile-bytecode.scm (optimize): Prune bailouts after contifying, so that we return to the tail of the contified function. 2014-04-05 Andy Wingo Match and srfi-9 expose their bailouts to the CSE pass * module/ice-9/match.upstream.scm (match-next): Inline a call to "error", so the new CSE pass will see this case as a bailout. * module/srfi/srfi-9.scm (throw-bad-struct): Reimplement as a syntax rule, so that the CSE pass sees the "throw" call. 2014-04-05 Andy Wingo Remove &bailout; replace uses of &unknown-effects with &all-effects * module/language/cps/effects-analysis.scm (&bailout): Remove effect. (&unknown-effects): Remove. Replace uses with &all-effects. * module/language/cps/cse.scm: Remove parts of CSE that deal with bailout * module/language/cps/cse.scm (compute-available-expressions, cse): (compute-idoms, compute-equivalent-subexpressions, apply-cse): Remove attempts to deal with bailout, as the bailout pass handles that already. Add prune-bailouts pass * module/language/cps/prune-bailouts.scm: New pass. * module/language/cps/compile-bytecode.scm: Wire it up. * module/Makefile.am: Add new file. Disable Tree-IL CSE * module/language/tree-il/optimize.scm (optimize): Disable Tree-IL CSE by default. Fix effects analysis for cached-module-box * module/language/cps/effects-analysis.scm (cached-module-box): Fix expected arity. 2014-04-04 Andy Wingo Fix coverage expectations * test-suite/tests/coverage.test ("line-execution-counts"): Update expectations. Since there's nothing to do at the loop header and the renaming of X happens at the end of the loops, the compiled code only sees the loop header once. More bailout preparation work * module/language/cps/cse.scm (compute-available-expressions): Compute a bailout set -- or at least, set things up so that we can do so. (compute-idoms): Don't add predecessors that bail out. (apply-cse, cse, compute-equivalent-subexpressions): Thread the bailout set through the computations. 2014-04-04 Andy Wingo Prepare for CSE bailout propagation * module/language/cps/cse.scm (compute-available-expressions): Prepare for being able to prune joins from bailouts. Always loop after the first iteration. * module/language/cps/effects-analysis.scm: Remove &possible-bailout. Rename &definite-bailout to &bailout, and rename &all-effects-but-bailout to &unknown-effects. 2014-04-04 Andy Wingo Add common subexpression elimination pass on CPS * module/language/cps/cse.scm: New file. * module/language/cps/compile-bytecode.scm: Wire up CSE, on by default. Currently using the #:cps-cse? keyword. * module/Makefile.am: Add new file. 2014-04-04 Andy Wingo Effects analysis tweaks * module/language/cps/effects-analysis.scm: Add &fluid-environment effect, a dependency of fluid-ref and fluid-set!, and an effect of push-fluid/pop-fluid. (list): Depend on &cdr. (resolve, cached-toplevel-box, cached-module-box): Don't depend on &box. Fix verify-cps to work * module/language/cps/verify.scm (verify-cps): Relax requirements for variable names to be symbols. constant-needs-allocation? fix * module/language/cps/dfg.scm (constant-needs-allocation?): Constants need allocation when they are used as a slot-needing operand, not when they are not used as an immediate operand. Fixes the case where one var is used in both ways after CSE, in struct-set!/immediate. Remove variable-set! clause from compile-fun * module/language/cps/compile-bytecode.scm (compile-fun): Remove vestigial `variable-set!' clause. 2014-04-03 Andy Wingo Effects analysis: define causes-all-effects? * module/language/cps/effects-analysis.scm (causes-all-effects?): New export. build-cps niceties * module/language/cps.scm (build-cps-exp, build-cont-body): Respect unquote in list builders (kargs, call, callk, primcall, and values). Minor CSE optimization * module/language/tree-il/cse.scm (cse): Use hashq instead of modulo to convert a full-width hash value to a vector index. 2014-04-03 Andy Wingo Add with-fresh-name-state-from-dfg * module/language/cps/dfg.scm (with-fresh-name-state-from-dfg): New helper. ($dfg, compute-dfg): Store max-var and max-label in the dfg. * module/language/cps.scm (with-fresh-name-state): Don't raise an error on recursive invocation; that was mostly useful when finding a bug. * module/language/cps/arities.scm (fix-arities): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Use the new helper. * .dir-locals.el: Update. 2014-04-02 Andy Wingo (test-suite lib) uses plain old catch, not stack-catch * test-suite/test-suite/lib.scm (run-test-exception): Refactor to just use "catch" instead of stack-catch. Refactor toplevel scope name generation in compile-cps * module/language/tree-il/compile-cps.scm (scope-counter, fresh-scope-id): (toplevel-box, capture-toplevel-scope, convert, cps-convert/thunk): Refactor to avoid abusing the var counter to generate scope identifiers. compute-max-label-and-var takes letrec vars into account. * module/language/cps.scm (compute-max-label-and-var): Fix to take letrec vars into account. Fix DCE for refactor-introduced borkage * module/language/cps/dce.scm ($fun-data, compute-live-code) (process-eliminations): Fix clownshoes regarding fun-data field names and order. Fix prune-top-level-scopes to allow collisions between var, scope, cont names * module/language/cps/prune-top-level-scopes.scm (compute-referenced-scopes): Fix to not assume that scope names, continuation names, and var names are mutually unique. (prune-top-level-scopes): Better variable names. Update old-style REPL code for deprecation * module/ice-9/scm-style-repl.scm: * module/ice-9/save-stack.scm: As the deprecated bindings have been removed from the default environment, use #:export instead of #:replace. Remove CFA data type * module/language/cps/dfg.scm: Remove CFA data type. (analyze-reverse-control-flow): Take min-label and label-count as args, and return multiple values instead of returning a CFA object. (compute-live-variables): Rework to accept multiple values from analyze-reverse-control-flow. ($dfa): Update comments. $dfa includes CFA fields * module/language/cps/dfg.scm ($dfa): Include CFA min-label, k-map, and k-order inline. (dfa-k-idx, dfa-k-sym, dfa-k-count): Adapt. (compute-live-variables): Extract fields of CFA for make-dfa. (print-dfa): Adapt (and fix positional record matching). More CFA removals * module/language/cps/dfg.scm (compute-reachable): Reword docstring. (visit-prompt-control-flow): Likewise. ($dominator-analysis): Change to store min-label instead of CFA. (compute-idoms, compute-join-edges, mark-loop-body, identify-loops): Take min-label and label-count, and use the DFG's preds list instead of requiring a fresh renumbered one. (analyze-dominators): Adapt to use a DFG with a label range instead of a CFA. Simplify analyze-reverse-control-flow * module/language/cps/dfg.scm (analyze-reverse-control-flow): Use the DFG's label count and min label analysis instead of rolling our own. analyze-control-flow only used in reverse direction; make private * module/language/cps/dfg.scm ($cfa): Use a vector to map labels to indices. Don't export any CFA bindings. (cfa-k-idx): Adapt. (compute-reachable, find-prompts, compute-interval): (find-prompt-bodies, visit-prompt-control-flow): Take a DFG as an argument instead of a CFA. (analyze-reverse-control-flow): Refactor from analyze-control-flow, as it is only used in the reverse case. Simplify accordingly, inlining the RPO sort. (compute-live-variables): Adapt to call analyze-reverse-control-flow instead. 2014-04-01 Andy Wingo Fix DFG compute-reachable bug * module/language/cps/dfg.scm (compute-reachable): Fix embarassing bug where we wouldn't actually iterate to fixpoint. I haven't seen it yet, but that's just luck... Optimize two-list srfi-1 map * module/srfi/srfi-1.scm (map): Optimize the two-list variant. Speed up compute-label-and-var-ranges * module/language/cps/dfg.scm (compute-label-and-var-ranges): Duplicate the cont-folder cases in the global/not-global cases. Lets the optimizer DTRT. 2014-04-01 Andy Wingo Fix compute-label-and-var-ranges for global DFG computation * module/language/cps/dfg.scm (compute-label-and-var-ranges): Fix to work with global DFGs -- it wasn't taking $letrec into account for var ranges. * module/language/cps/dce.scm (compute-live-code): Use bitvectors to represent the live var set. 2014-04-01 Andy Wingo Renumber doesn't visit unreachable continuations * module/language/cps/renumber.scm (compute-new-labels-and-vars): Don't visit functions that are not reachable. (renumber): Reindent. 2014-04-01 David Kastrup Make reverse! forego the cost of SCM_VALIDATE_LIST * libguile/list.c (scm_reverse_x): Do not validate first argument to reverse! in advance. Instead undo reversal in error case. 2014-04-01 Andy Wingo Renumber returns label/var counters for use in let-fresh * module/language/cps/renumber.scm (renumber): Refactor to return the label and var counters as additional values. * module/language/cps/dce.scm (eliminate-dead-code): Use the renumber label/var counters to initialize the fresh name state. 2014-04-01 Andy Wingo Refactor DCE to not build a CFA * module/language/cps/effects-analysis.scm (compute-effects): Change to analyze the effects for a subrange of a DFG's continuations. * module/language/cps/dce.scm (compute-defs, $fun-data, compute-live-code): (process-eliminations, eliminate-dead-code): Renumber before eliminating dead code, to avoid computing a CFG and other data. 2014-04-01 Andy Wingo Simplification renumbers instead of local prune-continuation pass * module/language/cps/simplify.scm (simplify): Use renumbering instead of rolling our own prune-continuations pass. DFA uses DFG var numbering * module/language/cps/dfg.scm ($dfa): Instead of a var-map table an a syms vector, use the DFG's var numbering. (dfa-var-idx, dfa-var-sym, compute-live-variables): Adapt. Allocate-slots avoids building CFA * module/language/cps/slot-allocation.scm (allocate-slots): Rework to avoid computing a CFA, and just relying on the incoming term to have sorted labels. 2014-04-01 Andy Wingo Compile-fun takes advantage of sorted output of "renumber", avoids CFA * module/language/cps/dfg.scm ($dfg): Rename nvars and nlabels fields to var-count and label-count. Export dfg-min-var, dfg-min-label, dfg-label-count, dfg-var-count. * module/language/cps/compile-bytecode.scm (compile-fun): No need to build a CFA given the renumbering pass. Adapt to treat labels as ordered small integer in a contiguous vector. 2014-04-01 Andy Wingo CPS renumbering pass sorts conts in topological order * module/language/cps/renumber.scm (sort-conts) (compute-new-labels-and-vars): Rework to sort the labels in topological order, and to prune any unreachable labels. 2014-04-01 Andy Wingo Add visit-cont-successors helper * module/language/cps/dfg.scm (lookup-successors, control-point?): Use the new helper. * module/language/cps.scm (visit-cont-successors): New helper. 2014-03-31 Andy Wingo Fix analyze-control-flow to preserve order among unordered labels * module/language/cps/dfg.scm (analyze-control-flow): Sort blocks to preserve order among unordered successors. (lookup-successors): Choose a more natural order, now that it doesn't matter. 2014-03-31 Andy Wingo Use Tree-IL-like case-lambda clause chaining in CPS * module/language/cps.scm ($kclause, $kentry): Instead of having an entry continuation contain a list of clauses, have the clauses contain clauses (as in Tree-IL). In some ways it's not as convenient but it does reflect the continuation tree correctly. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/elide-values.scm: * module/language/cps/prune-top-level-scopes.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/renumber.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/specialize-primcalls.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt aaaaaaall users. 2014-03-31 Andy Wingo Rewrite control-point? to avoid consing * module/language/cps/dfg.scm (control-point?): Rewrite to avoid consing a successors list. Remove succs from DFG * module/language/cps/dfg.scm ($dfg): Remove "succs" from DFG. Instead we can compute the successors set on-demand. (lookup-successors): Adapt. Simplify boot-9 and srfi-1 map * module/ice-9/boot-9.scm (map): * module/srfi/srfi-1.scm (map): Simplify the implementations to check for list? beforehand. It's faster, and it will be needed if we decide to go recursive. Avoid consing in compute-label-and-var-ranges. * module/language/cps/dfg.scm (compute-label-and-var-ranges): Avoid consing. Scope and scope-level in DFG vector * module/language/cps/dfg.scm ($dfg): Hoist scopes and scope levels out of $block and into $dfg. Adapt all callers. Predecessors and successors in DFG vectors * module/language/cps/dfg.scm ($dfg, $block): Record predecessors and successors in vectors instead of in $block data structures. Adapt users. DFG refactor * module/language/cps/dfg.scm (lookup-cont, lookup-block): (lookup-def, constant-needs-allocation?): Rework these accessors to avoid completely destructuring the $dfg. Renumber functions before emitting code * module/language/cps/compile-bytecode.scm (compile-bytecode): Renumber a function before going to compile it, so that the vars and labels are contiguous within each function. 2014-03-31 Andy Wingo Add renumber module * module/language/cps/renumber.scm: New module. * module/Makefile.am: Add to build. fix renumber 2014-03-31 Andy Wingo Replace use-map in DFG with separate def / use vectors * module/language/cps/dfg.scm ($dfg, $use-map): Replace use-map vector with "defs" and "uses" vectors. Adapt callers. Remove "sym" from $use-map * module/language/cps/dfg.scm ($use-map): Remove "sym" from use-map; it's redundant. Adapt callers. $use-map no longer has name member * module/language/cps/dfg.scm ($use-map): Remove name member. Adapt users. $dfa no longer includes name vector (can get that from dfg) * module/language/cps/dfg.scm ($dfa, dfa-var-name): (compute-live-variables, print-dfa): Remove "names" from DFAs. 2014-03-31 Andy Wingo DFG stores conts, blocks, and use-maps in vectors * module/language/cps/dfg.scm ($dfg): Change to store conts, blocks, and use-maps as vectors. A DFG also records the minimum label, minimum variable, and the number of labels and variables. The first entry in one of these vectors corresponds to the minimum. This can be optimum in the local case if the conts and variables have been renamed appropriately. Adapt callers. (compute-live-variables): Adapt. This is currently suboptimal but it works, so it's a useful base for optimization. 2014-03-31 Andy Wingo lookup-cont takes a DFG as its argument * module/language/cps/dfg.scm (lookup-cont): Change to take a DFG instead of a cont table. (build-cont-table): Change to return a vector. * module/language/cps/arities.scm: * module/language/cps/contification.scm: * module/language/cps/dce.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/elide-values.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: Adapt to lookup-cont and build-cont-table changes. 2014-03-31 Andy Wingo Public make-cont-folder * module/language/cps.scm (make-cont-folder): Add global? parameter, and make public. (fold-conts): Adapt. (fold-local-conts): Use make-cont-folder, and take a function instead of a continuation. * module/language/cps/arities.scm (fix-clause-arities, fix-arities*): * module/language/cps/compile-bytecode.scm (collect-conts): * module/language/cps/elide-values.scm (elide-values*): Adapt to fold-local-conts change. 2014-03-31 Andy Wingo Vars and labels are separate namespaces * module/language/cps.scm (fresh-var, with-fresh-name-state): Vars have their own namespace. Prepare for decoupling of var/label name uniqueness * module/language/cps/simplify.scm (compute-beta-reductions): (beta-reduce): Separate state into two tables, so we can relax current guarantee that vars and labels are mutually unique. Update verify-cps * module/language/cps/verify.scm (verify-cps): Vars should only be exact integers now. CPS conversion renames incoming gensyms to small integers * module/language/tree-il/compile-cps.scm (fold-formals) (unbound?, init-default-value, convert): Arrange to rename incoming gensyms as small integers. (canonicalize): Convert vector and abort here too. Less copying in tree-il pre-order / post-order. * module/language/tree-il.scm (pre-post-order): If the pre handler doesn't modify the components of a tree-il expression, avoid copying a new one. Prompt-related refactor in compile-cps * module/language/tree-il/compile-cps.scm (fix-prompts): New procedure. Eta-expand prompts before compiling to ensure that they have inline handlers. DCE uses fresh-var instead of gensym * module/language/cps/dce.scm (eliminate-dead-code): Use fresh-var instead of gensym. Adapt verify-cps to CPS changes * module/language/cps/verify.scm (verify-cps): Update to expect integer labels, and to allow integer variables. 2014-03-31 Andy Wingo Replace all let-gensyms uses with let-fresh * .dir-locals.el: Add with-fresh-name-state. * module/language/cps.scm (fresh-label, fresh-var): Signal an error if the counters are not initialized. (with-fresh-name-state): New macro. (make-cont-folder): New macro, generates an n-ary folder. (compute-max-label-and-var): New function, uses make-cont-folder. (fold-conts): Use make-cont-folder. (let-gensyms): Remove. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/constructors.scm: * module/language/cps/dce.scm: * module/language/cps/elide-values.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/specialize-primcalls.scm: Use let-fresh instead of let-gensyms, and wrap in a with-fresh-name-state as needed. * module/language/tree-il/compile-cps.scm: Remove hack to avoid importing let-gensyms from (language tree-il). 2014-03-31 Andy Wingo Remove unneeded local exact-integer? definition * module/system/vm/assembler.scm (link-debug): Remove unneeded exact-integer? definition. 2014-03-31 Andy Wingo Continuation labels and variable identifiers may be integers * module/language/cps.scm (label-counter, var-counter): New parameters, for producing fresh label and var names. (fresh-label, fresh-var): New procedures. (let-fresh): New macro, will replace let-gensyms. (build-cps-term): Use let-fresh. * module/language/tree-il/compile-cps.scm: Use let-fresh to generate fresh names. * module/system/vm/assembler.scm (make-meta, begin-kw-arity): Allow exact integers as labels. (link-debug): Explicitly mark low-pc as being an "addr" value. 2014-03-26 Andy Wingo Sloppier matching in setitimer tests * test-suite/tests/signals.test: Update setitimer tests to sloppily match both times -- it seems that the interval can also be sloppy on some platforms, sadly. Adapt test-out-of-memory to work on 32-bit systems * test-suite/standalone/test-out-of-memory (*limit*): Reduce limit to 50 MB. Adapt vector test to avoid exceeding maximum vector size on 32-bit systems. 2014-03-23 Nathaniel Alderson Calculate usecs correctly in thread-sleep! * module/srfi/srfi-18.scm (thread-sleep!): Correctly compute microseconds. * test-suite/tests/srfi-18.test: Add test. 2014-03-22 Andy Wingo Fix compile warnings * libguile/throw.c (catch): Fix bad declarations. * libguile/stackchk.c (reset_scm_stack_checking_enabled_p): Remove unused static function. 2014-03-22 Andy Wingo Out-of-memory situations raise exceptions instead of aborting * libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory handler that raises an unwind-only out-of-memory exception. (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to print to the current warning port, if the current warning port is a file port. (scm_gc_after_nonlocal_exit): New interface. Should be called after a nonlocal return to potentially collect memory; otherwise allocations could try to expand again when they should collect. * libguile/continuations.c (scm_i_make_continuation): * libguile/eval.c (eval): * libguile/throw.c (catch): * libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after nonlocal returns. * libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework to avoid allocating memory. (scm_report_out_of_memory): New interface. (scm_init_throw): Pre-allocate the arguments for stack-overflow and out-of-memory errors. * module/ice-9/boot-9.scm: Add an out-of-memory exception printer. * module/system/repl/error-handling.scm (call-with-error-handling): Add out-of-memory to the report-keys set. * libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if realloc fails. * libguile/error.h: * libguile/error.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_memory_error): Deprecate. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-out-of-memory: New test case. 2014-03-22 Andy Wingo Define a C fluid for current-warning-port * libguile/ports.c (scm_current_input_port, scm_current_output_port) (scm_current_error_port): Fix declarations to C99. (scm_current_warning_port, scm_set_current_warning_port): Rework to use a C fluid, like scm_current_error_port. (scm_init_ports): Initialize and define the warning port fluid. * libguile/init.c (scm_init_standard_ports): Init the current warning port. * module/ice-9/boot-9.scm: Remove definitions for current-warning-port. Instead, steal it from the boot objtable with port-parameterize!. 2014-03-20 Ludovic Courtès Bump version number for 2.0.11. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_REVISION): Increment. Update NEWS. tests: Add #undef NDEBUG when using . * test-suite/standalone/test-loose-ends.c, test-suite/standalone/test-num2integral.c, test-suite/standalone/test-round.c, test-suite/standalone/test-scm-c-bind-keyword-arguments.c, test-suite/standalone/test-scm-c-read.c, test-suite/standalone/test-scm-values.c, test-suite/standalone/test-smob-mark.c, test-suite/standalone/test-srfi-4.c: Add #undef NDEBUG. 2014-03-20 Ludovic Courtès tests: Check 'simple-format' with closed current-output-port. This is a follow-up to e26ab06. * libguile/print.c (scm_simple_format): Pass 1 to SCM_VALIDATE_OPORT_VALUE, for 'destination'. * test-suite/tests/format.test ("simple-format"): Add test. 2014-03-20 Mark H Weaver Fix (rnrs io simple) to open file ports in textual mode. Fixes . Reported and diagnosed by Xin Wang . * module/rnrs/io/simple.scm (open-input-file, open-output-file): Pass missing buffer-mode argument to open-file-{input,output}-port. Previously, (native-transcoder) was incorrectly passed as the buffer-mode argument, so no transcoder was provided, thus creating a binary port. 2014-03-19 Mark H Weaver simple-format: Don't assume the current output port is valid. * libguile/print.c (scm_simple_format): Validate the current output port. 2014-03-19 Andy Wingo Fix breakage of SRFI-4 C accessors * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that width was a byte width. Thanks very much to Barry Fishman for the report, and to Daniel Llorens for tracking it down. * test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS): * test-suite/standalone/test-srfi-4.c: Add test. 2014-03-17 Ludovic Courtès Bump version number for 2.0.10. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_REVISION): Increment. Fix typo in NEWS. Update NEWS. * NEWS: Remove last 'XXX'. 2014-03-17 Andy Wingo Update NEWS * NEWS: Update. 2014-03-17 Ludovic Courtès Update NEWS. * NEWS: Move "New interfaces" higher. Complement. 2014-03-17 Andy Wingo Fix newline preservation in @example with lines beginning with @ * module/texinfo.scm (read-char-data): Preserve newlines in @example and similar environments in the case when the next line starts with an @. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test. 2014-03-17 Andy Wingo DFG inlines uses of for-each * module/language/cps/dfg.scm (for-each, for-each/2): Define inline versions of these. Adapt callers. 2014-03-17 Mark H Weaver Minor NEWS tweaks. * NEWS: Fix typo and improve wording in custom ellipsis entry. Add first draft of NEWS for 2.0.10. * NEWS: Add first draft of changes in 2.0.10. Documentation tweaks for the 'r7rs-symbols' read/print options. * doc/ref/api-data.texi (Symbol Read Syntax): Mention the 'r7rs-symbols' print option, and provide example code to enable both the read and print options. Add 'r7rs-symbols' to the concept index. 2014-03-16 Ludovic Courtès build: Link 'test-unwind.c' against libgnu.la. * test-suite/standalone/Makefile.am (test_unwind_LDADD): Add libgnu.la, which provides 'rpl_mkstemp' on systems missing 'mkstemp'. 2014-03-16 Andy Wingo Optimize srfi-1 for-each with two lists. * module/srfi/srfi-1.scm (for-each): Optimize for the two-list case. Simplify boot-9 for-each with two lists * module/ice-9/boot-9.scm (for-each): Simplify the two-argument case in the same way as the one-argument case. More for-each micro-optimizations * module/ice-9/boot-9.scm (for-each): * module/srfi/srfi-1.scm (for-each): Re-implement one-list case using an explicit check for list? instead of the tortoise-hare thing. Seems to be faster! Doc and NEWS updates * NEWS: Update section on dynamic stacks. Add link for intptr interfaces. * doc/ref/api-data.texi (Integers): Add intptr interfaces. Debug options doc fix. * doc/ref/api-debug.texi (Debug Options): Fix. Refine unwind-only exception message. * libguile/throw.c (throw_without_pre_unwind): Refine warning message. 2014-03-16 Andy Wingo Document stack-overflow handlers, limits, and unwind-only exceptions * module/system/repl/error-handling.scm (call-with-error-handling): Add #:report-keys kwarg, so that unwind-only exceptions (stack-overflow in particular) get reported. * doc/ref/api-debug.texi (Pre-Unwind Debugging): Add documentation for #:report-keys kwarg of call-with-error-handling. (Stack Overflow): New subsubsection. (Debug Options): Remove discussion of stack overflow. 2014-03-15 Andy Wingo Add call-with-stack-overflow-handler tests * test-suite/tests/eval.test ("stack overflow handlers"): Add call-with-stack-overflow-handler tests, replacing the old stack overflow test. 2014-03-15 Andy Wingo Add stack overflow test * libguile/throw.c (throw_without_pre_unwind): Newline after the unwind-only warning. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-stack-overflow: New test to handle mmap/malloc failure. 2014-03-15 Mark H Weaver Fix (system base types) on big-endian systems. * module/system/base/types.scm (cell->object): When reading stringbufs, use UTF-32BE on big-endian systems. 2014-03-14 Mark H Weaver SRFI-43 documentation tweaks * doc/ref/api-compound.texi (Vectors): Add cross-reference to SRFI-43. * doc/ref/srfi-modules.texi (SRFI-43 Selectors): Simplify description of 'vector-ref'. Check SCM_USE_PTHREAD_THREADS using #if not #ifdef. * libguile/bdw-gc.h: Check SCM_USE_PTHREAD_THREADS using #if not #ifdef. 2014-03-14 Mark H Weaver Include in gen-scmconfig even when cross-compiling. Partially reverts 8cb0d6d7fa9aaac316c29a64c541336b51b6f93d. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Remove -DCROSS_COMPILING=1 from cross-compiling case. * libguile/gen-scmconfig.c: Include regardless of whether CROSS_COMPILING is defined. 2014-03-12 Andy Wingo Remove default soft stack limit; add call-with-stack-overflow-handler * libguile/vm.h: * libguile/vm.c (default_max_stack_size, initialize_default_stack_size): Remove the default stack limit. In this way, programs run from the command line or outside of the REPL will have no soft stack limit. (make_vm): Change `max_stack_size' field to be a stack of limits and handlers. (current_overflow_size, should_handle_stack_overflow) (reset_stack_limit, wind_overflow_handler, unwind_overflow_handler) (vm_expand_stack): If the stack surpasses a user-set limit, call the user-specified handler within its outer stack limit. (call-with-stack-overflow-handler): New interface. * module/system/vm/vm.scm: Export call-with-stack-overflow-handler. 2014-03-12 Ludovic Courtès build: Remove libguile-2.0-gdb.scm and $infodir/dir upon uninstall. * libguile/Makefile.am (uninstall-data-hook): New target. build: Install libguile-2.0-gdb.scm after libguile-2.0.so. * libguile/Makefile.am (install-data-local): Rename to... (install-data-hook): ... this. This guarantees that the rule runs after libguile-2.0.so has been installed. build: Don't include in native programs when cross-compiling. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling, pass -DCROSS_COMPILING=1. (c-tokenize.$(OBJEXT)): Likewise. * libguile/c-tokenize.lex (%top): Include only when CROSS_COMPILING is undefined. * libguile/gen-scmconfig.c: Likewise. build: Fix Gnulib compilation when $builddir != $srcdir. * configure.ac: Add -I$top_srcdir_absolute to 'CPPFLAGS'. Fixes out-of-source-tree compilation of lib/regex.c. Reported at . 2014-03-12 David Thompson Test for deleted weak pairs in hash-for-each. * libguile/hashtab.c (scm_internal_hash_for_each_handle): Test for deleted weak pairs. * test-suite/tests/hash.test: Add test case. 2014-03-12 Mark H Weaver SCM_I_INUM: Rewrite to avoid unspecified behavior when not using GNU C. * libguile/numbers.h (SCM_I_INUM): Unless using GNU C, use a portable implementation that avoids unspecified behavior. SCM_SRS: Improve fallback implemention to avoid unspecified behavior. * libguile/numbers.h (SCM_SRS): Rewrite preprocessor test to avoid left-shifting negative integers, and to test more comprehensively for the behavior we need. Rewrite fallback implementation to avoid unspecified behavior. 2014-03-12 Mark H Weaver SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable. * libguile/srfi-60.c (scm_srfi60_rotate_bit_field): Avoid division by zero in the (start == end) case. Rewrite inum case to work with unsigned integers in two's complement format. * test-suite/tests/srfi-60.test ("rotate-bit-field"): Add more tests. 2014-03-12 Mark H Weaver Use 'offsetof' to avoid undefined behavior. * libguile/socket.c (SUN_LEN): Use 'offsetof'. 2014-03-12 Mark H Weaver Avoid undefined behavior regarding signed integers and left shifts. * libguile/numbers.c (scm_logbit_p): If the requested bit is the sign bit (or above), check the sign portably. Otherwise, ensure that we're testing the bit in a two's complement representation. (left_shift_exact_integer): Avoid left-shifting negative integers. * libguile/vm-i-scheme.c (ash): Avoid left-shifting negative integers. 2014-03-12 Mark H Weaver Avoid signed overflow in random.c. * libguile/random.c (scm_i_mask32): Avoid signed overflow from shifting an unsigned char (promoted to signed int) 24 bits to the left. Avoid side effects in argument to SCM_I_INUM. * libguile/vm-i-system.c (halt): Avoid side effects in argument to SCM_I_INUM. 2014-03-12 Ludovic Courtès Thank Paul. 2014-03-12 Ludovic Courtès Provide glthread/lock.h implementation in terms of Guile threads. Fixes . Thanks to Paul Eggert for the suggestion. * m4/gnulib-cache.m4: Avoid 'lock' module. * m4/lock.m4, m4/threadlib.m4, lib/glthread/threadlib.c, lib/glthread/lock.c: Remove. * lib/glthread/lock.h: Rewrite in terms of libguile/threads.h. * m4/gnulib-common.m4, m4/gnulib-comp.m4, lib/Makefile.am, lib/unistd.in.h, maint.mk : Update, from Gnulib v0.1-92-g546ff82. * configure.ac (GNULIB_LOCK): Define 'GNULIB_LOCK'. Define 'USE_POSIX_THREADS' when building with pthread support. * Makefile.am (noinst_HEADERS): New variable. (BUILT_SOURCES): Add libguile/scmconfig.h. (libguile/scmconfig.h): New target. 2014-03-07 Mark H Weaver Improve compliance with C standards regarding signed integer shifts. * configure.ac: Add -fwrapv when using GCC (or compatible), if supported. * libguile/numbers.h (SCM_I_MAKINUM): Cast to scm_t_bits (unsigned) before shifting, to avoid undefined behavior. 2014-03-07 Mark H Weaver chars.c: Remove duplicate 'const' specifiers. * libguile/chars.c (scm_r5rs_charnums, scm_r6rs_charnums) (scm_r7rs_charnums, scm_C0_control_charnums, scm_alt_charnums): Remove duplicate 'const' specifiers. snarf.h: Declare static const function name vars as SCM_UNUSED. * libguile/snarf.h (SCM_DEFINE_GSUBR, SCM_DEFINE, SCM_PRIMITIVE_GENERIC, SCM_DEFINE_PUBLIC, SCM_PROC, SCM_REGISTER_PROC, SCM_GPROC): Declare static const function name variables as SCM_UNUSED to avoid spurious warnings. 2014-03-06 Mark H Weaver Make snarfing tools more robust to varied C preprocessor behavior. * libguile/guile-snarf.in (modern_snarf): Rewrite sed script to cope with newlines in the snarfed code segments, or multiple code segments on the same line. * module/scripts/snarf-check-and-output-texi.scm (process-stream): Strip all 'hash' tokens from the stream. (do-command): Remove special cases that handled 'hash' tokens in a few places. 2014-03-03 Mark H Weaver SRFI-19: Update the table of leap seconds. * module/srfi/srfi-19.scm (leap-second-table): Update to include the two most recent leap seconds. Add missing files to the test-suite Makefile. * test-suite/Makefile.am (SCM_TESTS): Add "tests/compiler.test", "tests/encoding-escapes.test", "tests/encoding-iso88591.test", "tests/encoding-iso88597.test", "tests/encoding-utf8.test", "tests/pairs.test", "tests/records.test", "tests/sort.test", "tests/srfi-17.test", "tests/srfi-18.test", "tests/srfi-98.test", "tests/streams.test", "tests/vectors.test", and "tests/web-client.test". 2014-03-02 Andy Wingo Port unrolled one-argument for-each from boot-9 to srfi-1 * module/srfi/srfi-1.scm (for-each): Port unrolled one-argument implementation here from the boot-9 version. 2014-03-02 Andy Wingo Fix for-each bug detecting not-a-list * module/ice-9/boot-9.scm (for-each): Fix detection of not-a-list in the unrolled one-argument case. * test-suite/tests/eval.test ("for-each"): Add a test. 2014-03-01 Andy Wingo ,profile, statprof, gcprof have an outer stack cut * module/statprof.scm (): Add outer-cut member. (fresh-profiler-state): Add outer-cut kwarg. (sample-stack-procs): Stop when the stack-length is zero, which will be before the frames run out if there is an outer cut. (profile-signal-handler): Use the outer cut when capturing the stack. (call-thunk): New helper, for use as an outer cut. (statprof, gcprof): Call the thunk within call-thunk, and use call-thunk as an outer cut. Statprof commentings * module/statprof.scm: Add a big ol' comment. (sample-stack-procs): If slot 0 isn't a primitive, use the IP to mark. In the future we will see more non-procedures in slot 0 as we start to use call-label and tail-call-label. statprof-display prints source locations * module/statprof.scm (call-data): Source is after printable. (addr->printable): Just produce a name, without source. Anonymous printables get "anon " prefixed. (stack-samples->procedure-data): Adapt to call-data change. (stats): Add "proc-source" element. (statprof-call-data->stats): Give a source to the call-data. (statprof-display): Print source also. 2014-02-28 Ludovic Courtès build: Make c-tokenize.c build on non-GNU systems. * libguile/c-tokenize.lex: Add %top directive to include first. This fixes builds on systems that use Gnulib's and similar replacements. See for an example. 2014-02-28 Andy Wingo Refactorings: call-data has source, stats is a record * module/statprof.scm (call-data): Add source member. (stack-samples->procedure-data): Populate source member (stats): Convert to record from vector. (statprof-call-data->stats): Adapt to produce a record. Statprof uses stack trace buffer to always provide full stacks * module/statprof.scm (): Remove record-full-stacks? and stacks members. The stack trace buffer is sufficient. (fresh-profiler-state): Adapt. (sample-stack-procs): Don't save stacks. (statprof-reset): Deprecate the full-stacks? argument. (stack-samples->procedure-data): Remove a needless vector-ref. (stack-samples->callee-lists): New helper. (statprof-fetch-stacks): Use stack-samples->callee-lists. (statprof-fetch-call-tree): Use stack-samples->callee-lists, and implement our own callee->string helper. (statprof, with-statprof, gcprof): Deprecate full-stacks? argument. 2014-02-28 Andy Wingo Statprof always stores full stack traces * module/statprof.scm (): Instead of a boolean count-calls?, treat the presence of a call-counts hash table as indicating a need to count calls. That hash table maps callees to call counts. A "callee" is either the IP of the entry of a program, the symbolic name of a primitive, or the identity of a non-program. New members "buffer" and "buffer-pos" replace "procedure-data". We try to avoid analyzing things at runtime, instead just recording the stack traces into a buffer. This will let us do smarter things when post-processing. (fresh-buffer, expand-buffer): New helpers. (fresh-profiler-state): Adapt to changes. (sample-stack-procs): Instead of updating the procedure-data table (which no longer exists), instead trace the stack into the buffer. (count-call): Update to update the call-counts table instead of the procedure-data table. (statprof-start, statprof-start): Adapt to call-counts change. (call-data): Move lower in the file. Add "name" and "printable" members, and no longer store a proc. (source->string, program-debug-info-printable, addr->pdi) (addr->printable): New helpers. (stack-samples->procedure-data): New procedure to process stack trace buffer into a hash table of the same format as the old procedure-data table. (statprof-fold-call-data, statprof-proc-call-data): Use stack-samples->procedure-data instead of procedure-data. (statprof-call-data->stats): Adapt to count-calls change. (statprof-display, statprof-display-anomalies): Adapt. 2014-02-28 Andy Wingo (system vm program) exports primitive? * module/system/vm/program.scm: Export primitive?. Primitive program-code doesn't map uniquely to the primitive, which may be of interest to various meta-level utilities like statprof. Improve statprof test * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Increase number of calls, as the computer speed increases and VM/compiler speed increases have meant that we get fewer samples than before. Also, compare the maximum deviation to the square root of the expected value. I don't actually know what the right statistical check is here, but this is closer to an "all points fall within a standard deviation" than our previous 30% check. Print a nicer warning when the check fails. Update statprof commentary * module/statprof.scm: Update commentary. More state-related refactors in statprof * module/statprof.scm (statprof-start, statprof-stop): Take optional state arg. (statprof-reset): Return no values. (statprof): Take port keyword arg. Since statprof-reset is now the same as parameterizing profiler-state, there's no need to call statprof-reset. Pass the state argument explicitly to statprof-start, statprof-stop, and statprof-display. Statprof restores previous sigprof handler when stopping * module/statprof.scm (): Add field for the previous SIGPROF handler. (statprof-start, statprof-stop, statprof-reset): Instead of setting the SIGPROF handler in statprof-reset, set it when the profiler becomes active, and actually restore it when the profiler becomes inactive. More statprof refactors * module/statprof.scm (statprof-display, statprof-display-anomalies) (statprof-accumulated-time, statprof-sample-count) (statprof-fetch-stacks, statprof-fetch-call-tree): Take optional state argument. (statprof-display-anomolies): Deprecate this mis-spelling. (statprof): Just compute usecs for the period. Slight gcprof refactor * module/statprof.scm (gcprof): Refactor a bit. statprof uses new setitimer magical usecs ability * module/statprof.scm (sample-stack-procs): Take advantage of setitimer allowing usecs >= 1e6. 2014-02-28 Andy Wingo Fix setitimer documentation. Allow microseconds >= 1e6. * doc/ref/posix.texi (Signals): Fix the documentation for setitimer; it was wrong. * libguile/scmsigs.c (pack_tv): New helper. Allow usecs >= 1e6. (unpack_tv): New helper. (scm_setitimer): Use the new helpers. * test-suite/tests/signals.test: Add setitimer tests. 2014-02-28 Mark H Weaver SRFI-18: Export 'current-thread'. Fixes . Reported by Xin Wang . * module/srfi/srfi-18.scm: Reexport 'current-thread'. * THANKS: Add "Xin Wang" to fixes section. 2014-02-28 Mark H Weaver Rely on Gnulib for . * libguile/async.c: * libguile/backtrace.c: * libguile/error.c: * libguile/filesys.c: * libguile/fports.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/init.c: * libguile/ioext.c: * libguile/load.c: * libguile/mallocs.c: * libguile/mkstemp.c: * libguile/ports.c: * libguile/posix.c: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/rw.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/simpos.c: * libguile/socket.c: * libguile/stime.c: * libguile/strports.c: * libguile/threads.c: Unconditionally include . Rely on Gnulib for fsync, link, readlink, mkdir, rmdir, and rename. * libguile/filesys.c: Remove 'fsync' wrapper for MinGW. (scm_link, scm_readlink, scm_mkdir, scm_rmdir): Define these unconditionally. (my_rename): Remove. (scm_rename): Use 'rename' instead of 'my_rename'. 2014-02-28 Mark H Weaver Import Gnulib modules: link, fsync, readlink, rename, mkdir, rmdir, unistd. * lib/fsync.c: * lib/link.c: * lib/mkdir.c: * lib/strdup.c: * m4/fsync.m4: * m4/link.m4: * m4/mkdir.m4: * m4/strdup.m4: New files. * lib/Makefile.am * m4/gnulib-cache.m4 * m4/gnulib-comp.m4: Add modules. 2014-02-28 Mark H Weaver Fix typo in manual. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): (rnrs bytevector) --> (rnrs bytevectors). 2014-02-27 Andy Wingo Fix newline preservation in @example with lines beginning with @ * module/texinfo.scm (read-char-data): Preserve newlines in @example and similar environments in the case when the next line starts with an @. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test. 2014-02-27 Ludovic Courtès build: Fix out-of-source-tree installation of libguile-2.0-gdb.scm. * libguile/Makefile.am (install-data-local): Use $< instead of just libguile-2.0-gdb.scm. Quote file names in $(INSTALL_DATA) invocation. 2014-02-25 Andy Wingo gcprof tweaks * module/statprof.scm (gcprof): No need to reset in gcprof; the fresh profiler state and the parameterize handle that. Fix mistaken set-vm-trace-level! as well. Refactor representation of sampling periods in statprof * module/statprof.scm (): The sampling frequency is actually a period; label it as such, and express in microseconds instead of as a pair. Likewise for remaining-prof-time. (fresh-profiler-state): Adapt. (reset-sigprof-timer): New helper. (profile-signal-handler): Use the new helper. (statprof-start): Use the new helper. (statprof-stop): Here too. (statprof-reset): Adapt to change. (gcprof): Set remaining prof time to 0. statprof and gcprof procedures use a fresh statprof state * module/statprof.scm (statprof, gcprof): Create a fresh statprof state. Simplification pass prunes all unreachable continuations * module/language/cps/simplify.scm (prune-continuations): Prune continuations as a post-pass with a fresh DFG. Using a pre-eta-conversion DFG as we were doing before missed some cases. 2014-02-22 Andy Wingo simplify profile-signal-handler * module/statprof.scm (profile-signal-handler): Don't bother detecting if we were in a count-call call or not; it doesn't matter, and we should accumulate time in any case. 2014-02-22 Andy Wingo statprof: accumulated-time is in jiffies * module/statprof.scm (fresh-profiler-state): accumulated-time and gc-time-taken are in jiffies, not seconds, so they are exact. (statprof-accumulated-time): Divide by 1.0 so that we get a flonum. Also refactor use of assq to get the gc-time-taken. 2014-02-22 Andy Wingo Zero-offset branches are backward branches; fix "br" backward branches * libguile/vm-engine.c (BR_UNARY, BR_BINARY, BR_ARITHMETIC): A jump with a zero offset is also a backward branch, in the sense that it's not a forward branch. ("br"): We forgot to VM_HANDLE_INTERRUPTS here on backwards branches. Oops! Avoid attempting to eta-reduce self-loops. * module/language/cps/simplify.scm (compute-eta-reductions): Avoid trying to eta-reduce a jump-to-self, as in (let lp () (lp)). This caused the compiler to hang. Pass state around statprof in more places * module/statprof.scm (get-call-data, sample-stack-procs): Take the state as an argument. (profile-signal-handler, count-call, statprof-proc-call-data) (gcprof): Adapt. statprof: call-data is a record type * module/statprof.scm (call-data): Reimplement as a record type. statprof: when/unless instead of if. * module/statprof.scm: Use when or unless instead of if, where appropriate. 2014-02-21 Andy Wingo add a statprof fixme * module/statprof.scm: Add a fixme. statprof-active? instead of checking profile level * module/statprof.scm (statprof-reset, statprof-fold-call-data): (statprof-proc-call-data, statprof-accumulated-time): (statprof-sample-count): Refactor some things to use statprof-active? instead of checking the profile level manually. statprof-reset creates a new state * module/statprof.scm (fresh-profiler-state): New helper. (ensure-profiler-state): Use it. (accumulate-time): No need to add 0.0 here. (statprof-reset): Create a new state instead of mutating the existing one. More statprof state refactorings * module/statprof.scm (existing-profiler-state): New helper, gets the profiler state or fails if there is no state. (sample-stack-procs, profile-signal-handler, count-call) (statprof-fold-call-data, statprof-proc-call-data) (statprof-call-data->stats, statprof-display) (statprof-display-anomolies, statprof-accumulated-time) (statprof-sample-count, statprof-fetch-stacks) (statprof-fetch-call-tree): Use the new helper. (statprof-active?): Don't create a state if there isn't one already. inside-profiler? to parameter instead of global variable * module/statprof.scm (): Add inside-profiler? member. Move mutations of inside-profiler? here. Beginnings of statprof threadsafety * module/statprof.scm (, profiler-state, ensure-profiler-state): A mostly-mechanical refactor to encapsulate profiler state in a parameter and a record instead of global variables. reform statprof commentary * module/statprof.scm: Reformat the commentary. Fix segfault in thread_mark * libguile/threads.c (thread_mark): There is a window in which the thread has a handle but doesn't yet have the set of pointerless freelists, so don't unconditionally dereference t->pointerless_freelists. 2014-02-20 Ludovic Courtès Make sure 'ftw' allows directory traversal when running as root. * module/ice-9/ftw.scm (stat-dir-readable?-proc): Return #t when UID is zero. Reported Frank Terbeck . build: Bail out when 'PKG_CHECK_MODULES' is missing. * configure.ac: Add 'm4_pattern_forbid' invocation. 2014-02-20 Andy Wingo Threadsafe stack relocation * libguile/vm.c (vm_return_to_continuation, vm_expand_stack): (vm_reinstate_partial_continuation): Hold the GC lock while relocating the stack. assertion refactor in the vm * libguile/vm.c: * libguile/vm-engine.c: Change the one use of VM_ENABLE_PARANOID_ASSERTIONS to ASSERT. That becomes the one use of VM_ENABLE_ASSERTIONS, so disable that too. Fix "VM never extends vp->sp ..." commit * libguile/vm.c (vm_expand_stack): Make sure the new SP is visible to vm_error if we throw because of stack overflow. Remove the hard stack size limit * libguile/vm.c (vm_expand_stack): Remove the hard stack size limit. 2014-02-20 Andy Wingo VM never extends vp->sp beyond mapped region of stack * libguile/vm-engine.c (ALLOC_FRAME): Fold CHECK_OVERFLOW into this routine, and rework to not extend vp->sp until the stack has been expanded. * libguile/vm.c (vm_increase_sp): Likewise, don't extend vp->sp until the stack has expanded. (vm_expand_stack): Rework to take the new stack pointer as an argument, and also to update vp->sp_max_since_gc and vp->sp. 2014-02-20 Andy Wingo Unwind-only stack overflow exceptions * module/ice-9/boot-9.scm (catch): Signal an early error if the handler or pre-unwind handler types aren't right. This is more important than it was, given that we dispatch on type now when finding matching catch clauses. * libguile/vm.c (vm_expand_stack): Use the standard scm_report_stack_overflow to signal stack overflow. This will avoid running pre-unwind handlers. * libguile/throw.h: Move scm_report_stack_overflow here. * libguile/throw.c (catch): Define a version of catch in C. (throw_without_pre_unwind): New helper. Besides serving as the pre-boot "throw" binding, it allows stack overflow to throw without running pre-unwind handlers. (scm_catch, scm_catch_with_pre_unwind_handler) (scm_with_throw_handler): Use the new catch in C. (scm_report_stack_overflow): Moved from stackchk.c; throws an unwind-only exception. * libguile/stackchk.h: * libguile/stackchk.c: Remove the scm_report_stack_overflow bits. 2014-02-19 Andy Wingo %exception-handler fluid refactor * libguile/throw.c (scm_init_throw): Define %exception-handler here. * module/ice-9/boot-9.scm (%eh): Use the incoming %exception-handler, and then delete it. This way we should be able to do unwind-only exceptions from C. Reimplement catch, throw, and with-throw-handler * module/ice-9/boot-9.scm: Reimplement catch, throw, and with-throw-handler in such a way that the exception handler is threaded not through the exception-handling closures, but through a data structure in the exception-handler fluid. This will allow us to do unwind-only exception dispatch on stack overflow. boot-9 boot order refactor for catch, throw, and such * module/ice-9/boot-9.scm: Move error-handling initialization after psyntax initialization. Only "throw" is used before psyntax, and both throw and catch have pre-boot variants in C. Fix scm_i_vm_capture_stack comment. * libguile/vm.c (scm_i_vm_capture_stack): Fix a comment. Default stack size is one page. * libguile/vm.c (initialize_default_stack_size): Initial stack size is one page. More robust stack expansion and contraction * libguile/vm.c (allocate_stack, expand_stack): Return NULL on allocation failure instead of throwing an exception. Throwing an exception is tricky to get right, and we need more context to do it correctly. (return_unused_stack_to_os): Try again if madvise returns -EAGAIN. If madvise fails, print an error message. (vm_expand_stack): Abort if stack expansion fails. We'll fix this in a future patch. (make_vm): Abort if we can't mmap a single page. 2014-02-18 Ludovic Courtès Add GDB extension to support Guile. * libguile/libguile-2.0-gdb.scm: New file. * libguile/Makefile.am (install-data-local): New target. Based on code from GNU libstdc++. (EXTRA_DIST): Add 'libguile-2.0-gdb.scm'. * doc/ref/api-debug.texi (GDB Support): New section. Add (system base types). * module/system/base/types.scm, test-suite/tests/types.test: New files. * module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/types.scm. * test-suite/Makefile.am (SCM_TESTS): Add tests/types.test. 2014-02-17 Andy Wingo Don't peval-penalize let-bound lambdas only referenced once * module/language/tree-il/peval.scm (peval): When going to peval a call whose operator isn't just a lambda but is a let-bound lambda, as one bound via define-inlinable, don't create a new counter if the lambda is only referenced once in the source. Avoids needless failure to inline once-referenced procedures. * test-suite/tests/peval.test ("partial evaluation"): Wheeeee 2014-02-17 Andy Wingo PT_DYNAMIC inside some other PT_LOAD segment * libguile/loader.c (load_thunk_from_memory): Only load PT_LOAD segments, as libc does. The PT_DYNAMIC segment should be inside some other PT_LOAD segment. * module/system/vm/linker.scm (segment-kind): Give the .dynamic segment PT_LOAD kind, so that it is written in a PT_LOAD segment. (count-segments): Add one if there is a SHT_DYNAMIC segment. (allocate-segment): Set the paddr to the addr, as binutils do. (record-special-segments): New routine, to write out special segments like PT_DYNAMIC. (allocate-elf): Call record-special-segments. 2014-02-16 Andy Wingo Add elf-symbol-value-offset, for properly relocating symtab entries * module/system/vm/elf.scm (elf-symbol-value-offset): New export. 2014-02-16 Andy Wingo ELF linker can produce objects with native ABI * module/system/vm/elf.scm: Define more ABI types and ELF object types. Export the ABI, object type, and machine type values. * module/system/vm/linker.scm (, process-reloc): Allow rel32/1 relocs. (add-elf-objects, allocate-elf, link-elf): Allow the user to set an ABI, type, and machine-type. 2014-02-14 Andy Wingo bytevector-length reifies to correct module * module/language/cps/reify-primitives.scm (primitive-module): Whoops, bytevector-length is needs to map to the (rnrs bytevectors) module. 2014-02-13 Andy Wingo bytevector-length is an interesting primitive. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): * module/language/cps/effects-analysis.scm: bytevector-length is an interesting primitive. sqrt and abs are interesting primitives * module/language/cps/effects-analysis.scm: * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add sqrt and abs. 2014-02-13 Andy Wingo Add prune-top-level-scopes pass * module/language/cps/prune-top-level-scopes.scm: New pass, to prune unneeded "cache-current-module!" forms. * module/language/cps/compile-bytecode.scm: * module/Makefile.am: Add the new pass to the build and enable by default. 2014-02-13 Mark H Weaver Fix inline asm of VM numerical operations for x32. * libguile/vm-i-scheme.c (_CX): Choose register size based on 'SIZEOF_VOID_P' instead of '__x86_64__'. 2014-02-13 Mark H Weaver Rely on Gnulib for 'select', 'lstat', and 'mkstemp'. * libguile/iselect.h: * libguile/threads.c: * libguile/deprecated.h: Rely on Gnulib for sys/select.h. * libguile/filesys.c: Rely on Gnulib for 'lstat' and 'mkstemp'. 2014-02-13 Mark H Weaver Import 'lstat' and 'mkstemp' modules from Gnulib. * lib/mkstemp.c: * lib/secure_getenv.c: * lib/tempname.c: * lib/tempname.h: * m4/mkstemp.m4: * m4/secure_getenv.m4: * m4/tempname.m4: New files. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Add modules. 2014-02-12 David Thompson Add cooperative REPL server module. Modified-by: Mark H Weaver * module/system/repl/coop-server.scm: New module. * module/system/repl/repl.scm (start-repl): Extract body to start-repl*. (start-repl*): New procedure. (run-repl): Extract body to run-repl*. (run-repl*): New procedure. * module/system/repl/server.scm (run-server): Extract body to run-server*. (run-server*): New procedure. * doc/ref/api-evaluation.texi (Cooperative REPL Servers): New node. * module/Makefile.am (SYSTEM_SOURCES): Add system/repl/coop-server.scm. 2014-02-12 Mark H Weaver REPL Server: Fix 'stop-server-and-clients!'. * module/system/repl/server.scm: Import (ice-9 match) and (srfi srfi-1). (*open-sockets*): Add comment. This is now a list of pairs with a 'force-close' procedure in the cdr. (close-socket!): Add comment noting that it is unsafe to call this from another thread. (add-open-socket!): Add 'force-close' argument, and put it in the cdr of the '*open-sockets*' entry. (stop-server-and-clients!): Use 'match'. Remove the first element from *open-sockets* immediately. Call the 'force-close' procedure instead of 'close-socket!'. (errs-to-retry): New variable. (run-server): Add a pipe, used in the 'force-close' procedure to cleanly shut down the server. Put the server socket into non-blocking mode. Use 'select' to monitor both the server socket and the pipe. Don't call 'add-open-socket!' on the client-socket. Close the pipe and the server socket cleanly when we're asked to shut down. (serve-client): Call 'add-open-socket!' with a 'force-close' procedure that cancels the thread. Set the thread cleanup handler to call 'close-socket!', instead of calling it in the main body. * doc/ref/api-evaluation.texi (REPL Servers): Add a caveat to the manual entry for 'stop-servers-and-clients!'. 2014-02-12 Andy Wingo guile.m4 tweaks * meta/guile.m4 (GUILE_PKG): Don't print "checking for guile 2.0" if we've already found 2.2. Print the correct effective version at the end. (GUILE_PROGS): Allow prereleases, whose micro version does not yet match the effective version. Default to the already-chosen effective version. 2014-02-11 Andy Wingo Bytevector f32 an f64 ops actually map to VM primitives * module/language/cps/primitives.scm (*instruction-aliases*): Whoops! Fix mapping of f32 and f64 instructions to VM primitives. guile.m4 tweaks * meta/guile.m4 (GUILE_PKG): Don't print "checking for guile 2.0" if we've already found 2.2. Print the correct effective version at the end. (GUILE_PROGS): Allow prereleases, whose micro version does not yet match the effective version. Default to the already-chosen effective version. 2014-02-10 Daniel Llorens array-contents returns root for empty arrays with empty root This fixes a compiler issue where (uniform-array->bytevector #2f64()) failed because of the stricter definition of uniform-vector? on this branch. Perhaps it would be better if uniform-array->bytevector didn't require a contiguous argument. * libguile/arrays.c: (scm_array_contents): return the root regardless of the value of SCM_I_ARRAY_DIMS (ra)->inc. * test-suite/tests/arrays.test: check. 2014-02-10 Daniel Llorens Add tests for more kinds of typed arrays. * test-suite/tests/arrays.test: Add more type array tests. Preallocate index list in scm_array_index_map_x * libguile/array-map.c - (scm_array_index_map_x): preallocate the index list instead of constructing it on each rank-1 iteration. - (ramap, rafe): use SCM_I_ARRAY_V just once. Match types used in arrays.c to struct field types * libguile/arrays.c - scm_shared_array_root: check for SCM_I_ARRAYP first. - scm_i_shap2ra: * check valid bounds in the '(lbnd ubnd) case. This makes (make-array 0 '(4 -3)) fail with a 'bad dimension' instead of with a 'wrong index' error. * use ssize_t for lbnd/ubnd/inc, not long. - scm_make_shared_array: use ssize_t for indices, not long. - scm_transpose_array: use size_t for ndim, not ulong. - scm_i_print_array: idem. Don't use ASET in scm_array_index_map_x * libguile/array-map.c: (scm_array_index_map_x): replace ASET by direct use of handle->impl. In scm_ramapc, only check unrolled axes for emptiness * libguile/array-map.c: (scm_ramapc) - Don't check emptiness while preparing ra0, but only after kroll is known, and only before kroll. len = 0 will be caught by the unrolled loop. - Use ra0 axis length in unroll check depth for rest args, not ra1's. - Recover early exit feature when cproc returns 0. 2014-02-10 Daniel Llorens Fix corner cases of scm_ramapc * libguile/array-map.c - (scm_ramapc): mismatched axes limit unrollk (kroll). Reorganize the function to do all checking as we go. - (scm_ra_matchp): unused; remove. - (find_unrollk): inlined in scm_ramapc; remove. - (klen): inlined in scm_ramapc; remove. - (rafill): n is size_t. - (racp): n is size_t. Use n and not i0end to bound the loop. - (ramap): Use n and not i0end to bound the loop. This is needed for the rank 0 case to work with the new scm_ramapc, as inc may be set to 0 in that case. - (rafe): idem. * test-suite/tests/ramap.test - check that size mismatch prevents unrolling (matching behavior III) with both array-copy! and array-map!. - check that non-contiguous stride in non-ref args prevents unrolling (rank 2, discontinuous) with both array-copy! and array-map!. - check rank 0 cases with array-for-each, array-map!. - Test the 0-inc, non empty case for both array-map! and array-copy!. 2014-02-10 Daniel Llorens Rewrite scm_ramapc() * libguile/array-map.c - (cind): replace by cindk, that operates only on the unrolled index set. - (klen): new function. - (make1array): take extra inc argument. - (scm_ramapc): rewrite to unroll as many axes as possible instead of just all or one. - (AREF): lbnd is known to be 0: remove. - (ASET): v is known to come from SCM_I_ARRAY_V; assume base, inc, lbnd. - (racp): use ssize_t instead of long for the indices. - (scm_array_index_map_x): build the index list at the last-but-one axis, then set the car of the last element, instead of building the list at the last axis. * test-suite/tests/ramap.test - add array-map! test with offset arguments. Factor out make1array() in scm_ramapc() * libguile/array-map.c: (scm_ramapc): factor out vector->array conversion to aux function make1array. Check more cases of array-contents * libguile/arrays.c: (scm_array_contents): fix comment. * test-suite/tests/arrays.test: add cases that depend on correct setting of CONTIGUOUS_FLAG. Refactor array-contents * libguile/arrays.c (scm_array_contents): Branch cases not on scm_is_generalized_vector but on SCM_I_ARRAYP. Thus lbnd!=0, which could happen with scm_is_generalized_vector, never appears in the output. * test-suite/tests/arrays.test: Test array-contents. Check the documented matching behavior of array-map!/copy! * test-suite/tests/arrays.test: move array-copy! tests to ramap.test. * test-suite/tests/ramap.test: check the dissimilar matching behavior of array-copy! and array-map! with arguments of different size. 2014-02-09 Andy Wingo Reindent scm_ramapc * libguile/array-map.c (scm_ramapc): Reindent. 2014-02-09 Daniel Llorens Raw pointer loop in array-copy! for vector/vector case This special case improves (define a (make-array 1. 1000000 10)) (define b (make-array *unspecified* 1000000 10)) (define c (transpose-array (make-array *unspecified* 10 1000000) 1 0)) ,time (array-copy! a b) ,time (array-copy! a c) from 0.041598s / 0.072561 to 0.012164s / 0.041886s on a i7-3930K. * libguile/array-map.c: (racp): if both src and dst are on vectors, use the element pointers to do the copy. 2014-02-09 Andy Wingo Simplify scm_array_get_handle for tc7-arrays * libguile/array-handle.c (scm_array_get_handle): Simplify for the array case, as suggested by Daniel Llorens. 2014-02-09 Daniel Llorens Test that typed-array? returns #f with non-array argument * test-suite/tests/arrays.test: ditto. Replace SCM_IMP in array-map.c * libguile/array-map.c - scm_ramapc: check scm_array_contents with scm_is_false. 2014-02-09 Andy Wingo Remove array impl. registry; instead, hard-code array handle creation * libguile/array-handle.h (scm_t_vector_ref, scm_t_vector_set): Rename from scm_t_array_ref, scm_t_array_set. These were named scm_i_t_array_ref and scm_i_t_array_set in 1.8 and 2.0. Change to take the vector directly, instead of the array handle. In this way, generic array handles are layered on top of specific implementations of backing stores. Remove scm_t_array_implementation, introduced in 2.0 but never documented. It was a failed attempt to layer the array implementation that actually introduced too many layers, as it prevented the "vref" and "vset" members of scm_t_array_handle (called "ref" and "set" in 1.8, not present in 2.0) from specializing on array backing stores. (scm_i_register_array_implementation) (scm_i_array_implementation_for_obj): Remove these internal interfaces. (scm_t_array_handle): Adapt to scm_t_vector_ref / scm_t_vector_set change. (scm_array_handle_ref, scm_array_handle_set): Adapt to change in vref/vset prototype. * libguile/array-handle.c (scm_array_get_handle): Inline all the necessary initializations here for all specific array types. * libguile/array-map.c (rafill, racp, ramap, rafe, array_index_map_1): * libguile/arrays.c: Remove array implementation code. * libguile/bitvectors.h: * libguile/bitvectors.c: Remove array implementation code. (scm_i_bitvector_bits): New internal interface. * libguile/bytevectors.c: Remove array implementation code. * libguile/srfi-4.h: Remove declarations for internal procedures that don't exist (!). * libguile/strings.c: Remove array implementation code. * libguile/vectors.c: Remove array implementation code. 2014-02-09 Daniel Llorens Fix array map functions with empty arguments * libguile/array-map.c - scm_ra_matchp: look for empty axes and return new case 5 if so. Use array handles to remove the SCM_I_ARRAYP / not branch. - scm_ramapc: Heed case 5. * test-suite/tests/ramap.test - test empty arguments for array-copy! and array-for-each. Note those that failed in 2.0.9. Fix empty array bug in array-index-map! * libguile/array-map.c: (scm_array_index_map_x): bail out if any one of the axes is empty. * test-suite/tests/ramap.test: add tests for empty array-case of array-index-map!. The 'f64 case with not-last emtpy axis is broken in 2.0.9. 2014-02-08 Andy Wingo Add "vector" member to scm_t_array_handle * libguile/array-handle.h (scm_t_array_handle): Add "vector" member. * libguile/array-handle.c (scm_array_get_handle): Initialize the vector member. Remove "impl" member of array handles. * libguile/array-handle.h (scm_t_array_handle): Remove "impl" member. * libguile/array-handle.c (scm_array_get_handle): Adapt. Inline scm_i_array_implementation_for_obj in scm_i_array * libguile/generalized-arrays.c (scm_is_array, scm_is_typed_array): In preparation for removing the registry of array implementations, remove a couple uss of scm_i_array_implementation_for_obj. 2014-02-08 Andy Wingo vref, vset members of scm_t_array_handle * libguile/array-handle.h (scm_t_array_ref, scm_t_array_set): Rename from scm_i_t_array_ref, scm_i_t_array_set. (scm_t_array_handle): Copy vref and vset from impl to handle. (scm_array_handle_ref, scm_array_handle_set): * libguile/array-map.c (racp, ramap, rafe, rafill, array_index_map_1): * libguile/array-handle.c (scm_array_get_handle): Adapt. 2014-02-08 Mark H Weaver Fix improper use of 'with-locale'. * test-suite/guile-test (run-tests): Use 'setlocale' with check instead of 'with-locale'. 2014-02-08 Daniel Llorens Change uses of scm_is_simple_vector to scm_is_vector * libguile/filesys.c, libguile/random.c, libguile/stime.c, libguile/trees.c, libguile/validate.h: use scm_is_vector instead of scm_is_simple_vector. * libguile/sort.c (scm_sort_x, scm_sort, scm_stable_sort_x) (scm_stable_sort): Remove scm_is_vector check; scm_is_array is sufficient. * test-suite/tests/arrays.test: Fix header. * test-suite/tests/random.test: New coverage test covering random:normal-vector!. * test-suite/Makefile.am: Include random.test in make check. 2014-02-08 Andy Wingo SCM_I_IS_VECTOR only true for tc7_vector, not weak vectors * libguile/tags.h (SCM_TYP7S, SCM_HAS_TYP7S): Remove these, as we no longer do the differs-by-one-bit thing for vectors and weak vectors. * libguile/vectors.h (SCM_I_IS_VECTOR): Use SCM_HAS_TYP7. (SCM_I_IS_NONWEAK_VECTOR): Remove. * libguile/vm-engine.c (vector-length, vector-ref, vector-set!) (vector-ref/immediate, vector-set!/immediate): We can inline these instructions completely now. * libguile/vm.c (vm_error_not_a_vector, vm_error_out_of_range): New error conditions. 2014-02-08 Andy Wingo Merge commit '24cac6554073bb6e691605cd6ac6196f3c0851a3' Conflicts: libguile/vectors.c Merge commit '5cfeff11cc58148c58a85a879fd7a3e7cfbbe8e2' Conflicts: libguile/vectors.c 2014-02-08 Andy Wingo Deprecate the use of the vector interface on arrays * libguile/vectors.c (scm_is_vector): Deprecate use on weak vectors and arrays. (scm_is_simple_vector): Deprecate use on weak vectors. (scm_vector_length, scm_c_vector_ref, scm_c_vector_set_x): Deprecate use on arrays. * libguile/sort.c: Adapt to check explicitly for arrays. 2014-02-08 Andy Wingo Deprecate use of vector-length, vector-ref, vector-set! as primitive-generics * libguile/vectors.c (scm_vector_length, scm_c_vector_ref): (scm_c_vector_set_x): Deprecate the use of vector-length, vector-ref, and vector-set! as primitive generics. 2014-02-08 Andy Wingo Merge commit 'fb7dd00169304a5922838e4d2f25253640a35def' This commit also renames uniform-vector-element-type-code to array-type-code. Conflicts: libguile/uniform.c libguile/uniform.h test-suite/tests/arrays.test 2014-02-08 Andy Wingo Merge commit 'dc65b88d839c326889618112c4870ad3a64e9446' Conflicts: libguile/srfi-4.c Merge commit 'b9b88351ea2c4b43a6f90938554dc5693b17e328' Conflicts: libguile/deprecated.h test-suite/tests/00-socket.test Merge commit '0ce224594ae5a673f6a397c284db5f5a61935334' Merge commit '495cea0c931de23f074892b3f32808e676712a18' Conflicts: libguile/weaks.c Merge commit 'b86069c1308a6ca36f3a3bc56134b3f8fd693592' Conflicts: libguile/hashtab.c Merge commit '54cded99dc5db94b1df0dc417161ebef7c60d874' Merge commit '2f3b7e9a41677bfe802e8a1ee851827297384c58' Conflicts: module/ice-9/pretty-print.scm Merge commit 'a675a2e81b792b9f860bec57c38a1948631c7a41' 2014-02-08 Andy Wingo Deprecate general "uniform-vector" interface * libguile/uniform.h: * libguile/uniform.c (scm_is_uniform_vector, scm_uniform_vector_p) (scm_c_uniform_vector_length, scm_uniform_vector_length) (scm_uniform_vector_element_type, scm_uniform_vector_element_size) (scm_c_uniform_vector_ref, scm_uniform_vector_ref): (scm_c_uniform_vector_set_x, scm_uniform_vector_set_x): (scm_uniform_vector_to_list) (scm_uniform_vector_elements, scm_uniform_vector_writable_elements): Deprecate. This interface lacked both generality and specificity. The general replacement is array-length, array-ref, and friends on the scheme side, or the array handle interface on the C side. On the specific side of things, there are the specific bytevector, srfi-4, and bitvector interfaces. * test-suite/tests/arrays.test: * test-suite/tests/bitvectors.test: * test-suite/tests/ports.test: * test-suite/tests/srfi-4.test: Update to use array interfaces. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): * doc/ref/srfi-modules.texi (SRFI-4): Update. 2014-02-08 Andy Wingo Simplify srfi-4 C implementation * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): In the raw element accessors (e.g scm_u32vector_writable_elements), only permit bytevectors, as the constructors will only make bytevectors. This harmonizes with the Scheme interfaces as well, which expect packed bytevectors. (scm_make_srfi_4_vector): Knowing that the new value is a bytevector with base 0 and inc 1, simplify initialization. 2014-02-08 Andy Wingo Deprecate htons, htonl, ntohs, ntohl * libguile/sockets.h: * libguile/sockets.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_htons, scm_htonl, scm_ntohs, scm_ntohl): Deprecate. Bytevectors adequately subsume their functionality. * doc/ref/posix.texi: * test-suite/tests/00-socket.test: Update. 2014-02-08 Mark H Weaver Improve handling of locales in the test suite. * test-suite/guile-test (run-tests): Load each test file within (with-locale "C" ...). * test-suite/tests/encoding-iso88591.test: * test-suite/tests/encoding-iso88597.test: * test-suite/tests/encoding-utf8.test: * test-suite/tests/srfi-14.test: Remove broken code to save and restore the previous locale. * test-suite/tests/bytevectors.test: * test-suite/tests/format.test: * test-suite/tests/regexp.test: * test-suite/tests/srfi-19.test: * test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before calling it. 2014-02-08 Mark H Weaver Avoid using 'eval-when' with 'expand' in (oop goops). * module/oop/goops.scm: Avoid using 'eval-when' with 'expand'. 2014-02-07 Mark H Weaver Better error reporting in 'weak-vector-ref' and 'weak-vector-set!'. * libguile/weaks.c (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): Pass procedure name to 'scm_out_of_range'. 2014-02-07 Mark H Weaver Make size argument optional to 'make-doubly-weak-hash-table'; fix docs. * libguile/hashtab.c (scm_make_doubly_weak_hash_table): Make 'size' argument optional, like the weak hash table constructors. * doc/ref/api-memory.texi (Weak hash tables): Document that 'size' argument is optional for the weak hash table constructors. 2014-02-07 Mark H Weaver Fix 'weak-vector?' doc: Weak hash tables are not weak vectors. * doc/ref/api-memory.texi (Weak vectors): In 'weak-vector?' entry, don't claim that weak hash tables are weak vectors. Remove statement that weak vectors are mainly useful for implementing weak hash tables. 2014-02-07 Andy Wingo Fix truncated-print for uniform vectors * module/ice-9/pretty-print.scm (truncated-print): Use bytevector? instead of uniform-vector?; the latter could be true for shared arrays with non-zero lower bounds. (srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4) * module/srfi/srfi-4/gnu.scm: Re-use implementation of define-bytevector-type from srfi-4. Remove private unused duplicate c32/c64vector definitions * module/srfi/srfi-4.scm: Remove vestigial definitions for c32vectors and c64vectors. Those are defined in (srfi srfi-4 gnu). SRFI-4 predicates, length accessors only accept bytevectors (not arrays) * module/srfi/srfi-4.scm (define-bytevector-type): For the predicates and length accessors, only accept bytevectors. Since arrays don't work for u32vector-ref et al, they shouldn't pass u32vector?. Merge commit '9b5da400dde6e6bc8fd0e318e7ca1feffa5870db' Conflicts: libguile/vectors.c test-suite/tests/weaks.test Merge commit '1e3fd6a0c81bb3e9900a93a9d1923cc788de0f99' Conflicts: doc/ref/api-memory.texi libguile/weaks.c libguile/weaks.h module/ice-9/weak-vector.scm Merge commit '40a723a92236fe4e58feb89057b4182b1fc76810' Merge commit 'c8e839cfeb647aca034b9bcd5a321d419dedca1f' Merge commit '5e69ceb7a667377a61cb0c31d7ac20e245b3fafd' Merge commit '866af5da3d11ac4a9df44ee8c5b1781a0073c288' Removes the special arity handler, and instead relies on the procedure returning the correct number of values. Merge commit '34e89877342f20fdb8a531ad78dab34cfd2b0843' Conflicts: module/Makefile.am Merge commit '58147d67806e1f54c447d7eabac35b1a5086c3a6' Merge commit 'e6c1c5f6cb16913eadeb8758cd817c5a58d146b8' Merge commit 'ca5e0414e96886177d883a249edd957d2331db65' Conflicts: module/language/tree-il/primitives.scm Merge commit '60617d819d77a1b92ed6c557a0b49b8e9a8e97b9' Conflicts: libguile/continuations.c libguile/eval.c libguile/goops.c libguile/instructions.c Merge commit 'f6ddf827f8f192af7a8cd255bd8374a0d38bbb74' Conflicts: module/ice-9/boot-9.scm module/oop/goops.scm Merge commit '45a28515c13348dfd18e53038ad63dd091a5a3c1' Merge commit 'a5cbbaa66a2491453db0edff9b0cb592a98f61bf' Merge commit '8ca97482b01cf1a6aa538cc5a2d1f71fb60f080c' Conflicts: libguile/r6rs-ports.c Merge commit '122f24cc8a3637ed42d7792ad1ff8ec0c49c58df' Conflicts: libguile/fports.c libguile/ports.c 2014-02-07 Andy Wingo Add weak-vector-length, weak-vector-ref, weak-vector-set! * libguile/weak-vectors.h: * libguile/weak-vectors.c (scm_is_weak_vector, scm_c_weak_vector_length): (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for dealing with weak vectors from C. (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x): New Scheme interfaces to weak vectors; to be used instead of vector-length, vector-ref, etc. * module/ice-9/weak-vector.scm: Export the new interfaces. 2014-02-07 Andy Wingo Deprecate vector-ref, vector-length, vector-set! on weak vectors * libguile/vectors.c (scm_vector_length, scm_c_vector_length): (scm_c_vector_ref, scm_c_vector_set_x): Deprecate the use of these procedures on weak vectors. * test-suite/tests/guardians.test: * test-suite/tests/weaks.test: Adapt test suites. 2014-02-07 Andy Wingo Add weak-vector-length, weak-vector-ref, weak-vector-set! * libguile/weaks.c (scm_is_weak_vector, scm_c_weak_vector_length): (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for dealing with weak vectors from C. (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x): New Scheme interfaces to weak vectors; to be used instead of vector-length, vector-ref, etc. * module/ice-9/weak-vector.scm: Export the new interfaces. * doc/ref/api-memory.texi (Weak vectors): Document them. 2014-02-07 Daniel Llorens Fix bad uses of base and lbnd on rank 1 arrays * libguile/array-map.c - rafill, ramap, rafe, racp: object from SCM_I_ARRAY_V always has base 0, lbnd 0 and inc 1; make use of this. * libguile/arrays.c - array_handle_ref, array_handle_set: idem. - array_get_handle: sanity check. * libguile/generalized-vectors.c - scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x: pos should be base when idx is lbnd. Furthermore, pos should be signed and have its overflow checked; do this by handling the job to scm_c_array_ref_1, scm_c_array_set_1_x. * libguile/generalized-vectors.h - fix prototypes. 2014-02-06 Daniel Llorens Reorder arrays.test * test-suite/tests/arrays.test: dependence reordering: first sanity, then make-array, then array-equal?, then make-shared-array, shared-array-root, then the rest, many of which use make-shared-array. Don't use scm_is_generalized_vector in transpose-array * libguile/arrays.c (scm_transpose_array) - Use scm_c_array_rank(), which contains an implicit is_array test. - Handle the rank 0 case. * test-suite/tests/arrays.test - Add test for rank 0 case. - Add failure test for non array argument. Tests for transpose-array * test-suite/tests/arrays.test: test transpose-array for ranks 1, 2, 3. Don't use scm_is_generalized_vector in shared-array-root * libguile/arrays.c: (scm_shared_array_root): replace check for scm_is_generalized_vector. Tests for shared-array-root * test-suite/tests/arrays.test: check shared-array-root against make-shared-array, array-contents. Remove unnecessary conditions in array constructors * libguile/arrays.c: (scm_make_type_array, scm_from_contigous_typed_array, scm_from_contigous_array): Remove conditions known to be true. Remove generalized-vectors.h includes * libguile/srfi-4.c, libguile/uniform.h: ditto. 2014-02-06 Andy Wingo Fix array-index-map refactor * libguile/ramap.c (array_index_map_1): Fix to use array handle properly. Array-map refactors * libguile/array-map.c (scm_ra_matchp): Refactor logic a bit. (array_index_map_1, array_index_map_n) (scm_array_index_map_x): Internally refactor array-index-map! to use separate implementations for rank 1 versus rank >1 arrays. 2014-02-06 Daniel Llorens Don't use generalized-vector in array-map.c (II) * libguile/array-map.c - replace scm_is_generalized_vector by scm_is_array && !SCM_I_ARRAY_P. - replace scm_c_generalized_vector_length by scm_c_array_length. - remove header. Don't use generalized-vector in array-map.c (I) * array-map.c: (AREF, ASET): Rename from GVREF, GVSET and use rank-1 array accessors. 2014-02-06 Daniel Llorens Don't use generalized-vector functions in uniform.c * libguile/uniform.c (scm_is_uniform_vector): Replace scm_is_generalized_vector and scm_generalized_vector_get_handle by scm_is_array and manual rank check. (scm_c_uniform_vector_length): Use scm_c_array_length. (scm_c_uniform_vector_ref): Use scm_c_array_ref_1. (scm_c_uniform_vector_set): Use scm_c_array_set_1_x. (scm_uniform_vector_writable_elements): Use scm_array_get_handle, and assert that the rank is 1. * test-suite/test/arrays.test: Rename the uniform-vector-ref block to uniform-vector. Exercise uniform-vector-length and shared arrays remaining uniform. Modifications by Andy Wingo . 2014-02-06 Andy Wingo Replace generalized-vector calls in array_handle_ref/set * libguile/arrays.c: (array-handle-ref, array-handle-set): Use the rank-1 array accessors. 2014-02-06 Daniel Llorens Replace scm_c_generalized_vector_length in arrays.c * libguile/arrays.c: (scm_array_contents, scm_make_shared_array): arrays are known of rank 1 so replace by scm_c_array_length. Replace scm_c_generalized_vector_length in random.c * libguile/random.c: (random:solid-sphere!): array is of known rank 1, so use scm_c_array_length() instead. Tests for array-copy!, empty case * test-suite/tests/ramap.test: test array-copy! with empty destination. Fix uses of constant array as destination. 2014-02-06 Mark H Weaver Remove outdated documentation of LTDL_LIBRARY_PATH. * doc/ref/guile-invoke.texi (Environment Variables): Remove documentation of 'LTDL_LIBRARY_PATH'. Document 'equal?' in list of R6RS incompatibilities. * doc/ref/r6rs.texi (R6RS Incompatibilities): Mention that 'equal?' may not terminate when applied to cyclic datums. 2014-02-05 Andy Wingo Various VM stack management fixes * libguile/vm.c (vm_increase_sp): New interface, to increase the SP to some new level, possibly expanding the stack. (vm_push_sp, vm_restore_sp): Intefaces to vm_increase_sp. (vm_return_to_continuation): Don't throw an error if there's not enough space; instead, expand. (vm_reinstate_partial_continuation): Use the new helper. (return_unused_stack_to_os): Avoid off-by-one error (sp points to valid memory.) (scm_call_n): Never write beyond the sp. 2014-02-04 Mark H Weaver REPL Server: Remove unneeded error case in 'run-server'. * module/system/repl/server.scm (run-server): Remove case that handled 'interrupt' exceptions specially. It is no longer needed since e6c8e6047ed2e772cc4e1fb5ad4d389e5c616feb (REPL Server: Don't establish a SIGINT handler.) REPL Server: Redirect warnings to client socket. * module/system/repl/server.scm (serve-client): Use parameterize. Redirect warnings to client socket. Don't check HAVE_ALARM, which no longer exists. * libguile/scmsigs.c (scm_alarm): Remove check for HAVE_ALARM. Conditionalize only on HAVE_DECL_ALARM. Update Gnulib to v0.1-77-gd9361da 2014-02-03 Mark H Weaver define-values: Blackhole 'dummy'; work around lack of toplevel hygiene. * module/ice-9/boot-9.scm (define-values): Use 'generate-temporaries' to generate a fresh name for 'dummy', to work around the lack of hygiene for macro-introduced toplevel identifiers. Blackhole 'dummy' to avoid keeping garbage alive. Add more comments. 2014-02-02 Andy Wingo Add VM and compiler support for calls to known procedures * module/language/cps.scm ($callk): New expression type, for calls to known labels. Part of "low CPS". * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: Adapt call sites. * libguile/vm-engine.c (call-label, tail-call-label): New instructions. Renumber the rest; this is an ABI change. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. * doc/ref/compiler.texi (CPS in Guile): Document $callk. 2014-02-02 Andy Wingo Remove code to run GC more frequently as process image size increased * libguile/gc.c: Remove code that would try to run GC more frequently as the process image size was increasing. Before, it was often the case that the heap was the main component of image size, but with expandable stacks and statically allocated data that is no longer true. Also, once scm_gc_register_allocation was incorporated, we don't need to be so conservative any more. It seems this code was simply causing too many gc's to run. Removing it improves some micro-benchmarks; time will tell. 2014-02-02 Andy Wingo Add thread-local lock-free, TLS-free freelists. * libguile/bdw-gc.h: Remove a needless compatibility hack. * libguile/gc-inline.h: New file, implementing thread-local freelists providing faster allocation if we already have a scm_i_thread* pointer. Based on gc_inline.h from libgc. * libguile/threads.h (scm_i_thread): Add freelists here. * libguile/threads.c (guilify_self_1, guilify_self_2): Initialize freelists. * libguile/vm.c: Include gc-inline.h. * libguile/vm-engine.c: Rename current_thread to thread. Use scm_inline_cons instead of scm_cons, scm_inline_cell instead of scm_cell, and scm_inline_words instead of words. 2014-02-02 Andy Wingo Add dead slot map cache * libguile/vm.c (find_dead_slot_map, scm_i_vm_mark_stack): Use a little cache for dead slot maps. Helps when marking very deep recursive stacks. 2014-02-02 Mark H Weaver Implement R7RS 'define-values'. * module/ice-9/boot-9.scm (%define-values-arity-error): New procedure. (define-values): New macro. * doc/ref/api-binding.texi (Binding Multiple Values): Add docs. * test-suite/tests/syntax.test: Add tests. 2014-02-01 Mark H Weaver Implement SRFI-64 - A Scheme API for test suites. * module/srfi/srfi-64.scm: New file. * module/srfi/srfi-64/testing.scm: New file. * module/Makefile.am: Add rule for srfi-64.go dependency on srfi-64/testing.scm. (SRFI_SOURCES): Add srfi/srfi-64.scm. (NOCOMP_SOURCES): Add srfi/srfi-64/testing.scm. * doc/ref/srfi-modules.texi (SRFI-64): New node. * test-suite/tests/srfi-64.test: New file. * test-suite/tests/srfi-64-test.scm: New file. * test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-64.test. (EXTRA_DIST): Add tests/srfi-64-test.scm. Implement SRFI-43 Vector Library. * module/srfi/srfi-43.scm: New file. * module/Makefile.am (SRFI_SOURCES): Add module/srfi/srfi-43.scm. * test-suite/tests/srfi-43.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-43.test. * doc/ref/srfi-modules.texi (SRFI-43, SRFI-43 Constructors) (SRFI-43 Predicates, SRFI-43 Selectors, SRFI-43 Iteration) (SRFI-43 Searching, SRFI-43 Mutators, SRFI-43 Conversion): New nodes. Compile numerical comparisons with more than 2 arguments to VM code. * module/language/tree-il/primitives.scm (chained-comparison-expander): New procedure. (*primitive-expand-table*): Add primitive expanders for '<', '>', '<=', '>=', and '='. 2014-01-31 Andy Wingo Return unused parts of the stack to the OS * libguile/vm.h (struct scm_vm): Reorder fields. Add "sp_max_since_gc" field. * libguile/vm-engine.c (ALLOC_FRAME, RESET_FRAME): * libguile/vm.c (vm_return_to_continuation) (vm_reinstate_partial_continuation, scm_call_n): In places where we could increase the stack height, update sp_max_since_gc. (vm_expand_stack): Relocate sp_max_since_gc on expansion. (scm_bootstrap_vm): Record the page size using gnulib's getpagesize. (return_unused_stack_to_os): New routine, run when marking stacks. Micro-optimization to scm_i_vm_mark_stack * libguile/vm.c (scm_i_vm_mark_stack): Micro-optimize GC_MARK_AND_PUSH to cache the plausible heap bounds locally. 2014-01-31 Mark H Weaver Revert "Primitive expand numerical comparisons with more than 2 arguments." This reverts commit 4dc4b86e858d391d20d0ea2551614a89fa3bd4d1. 2014-01-28 Mark H Weaver Primitive expand numerical comparisons with more than 2 arguments. * module/language/tree-il/primitives.scm (chained-comparison-expander): New procedure. (*primitive-expand-table*): Add primitive expanders for '<', '>', '<=', '>=', and '='. Add 'positive?' and 'negative?' as primitives. * module/language/tree-il/primitives.scm (*interesting-primitive-names*) (*effect-free-primitives*): Add 'positive?' and 'negative?'. (*primitive-expand-table*): Add primitive expanders for 'positive?' and 'negative?'. 2014-01-28 Andy Wingo Minor for-each speedup * module/ice-9/boot-9.scm (for-each): Minor speedup by unrolling tortoise/hare loop. Minor for-each speedup * module/ice-9/boot-9.scm (for-each): Minor speedup by unrolling tortoise/hare loop. Unnecessary VM_HANDLE_INTERRUPTS elision * libguile/vm-engine.c: Remove VM_HANDLE_INTERRUPTS before entering a subr or foreign call. The bytecode stub will have already done so when entering the stub, and the return sequence handles doing so before returning. Fix tracing * module/system/vm/trace.scm (print-return): Remove frame argument. (trace-calls-to-procedure, trace-calls-in-procedure): Adapt callers. * module/system/vm/traps.scm (trap-in-procedure, trap-frame-finish): (trap-calls-to-procedure): Since the pop continuation hook is now called after the continuation is popped, we need to check the right frame. Fixes tail-calls in the trace root, and probably other things. 2014-01-26 Andy Wingo More precise stack marking via .guile.frame-maps section * module/language/cps/slot-allocation.scm (lookup-dead-slot-map) (allocate-slots): For each non-tail call in a function, compute the set of slots that are dead after the function has begun the call. * module/language/cps/compile-bytecode.scm (compile-fun): Emit the `dead-slot-map' macro instruction for non-tail calls. * module/system/vm/assembler.scm (): Add `dead-slot-maps' member. (dead-slot-map): New macro-instruction. (link-frame-maps, link-dynamic-section, link-objects): Write dead slots information into .guile.frame-maps sections of ELF files. * module/system/vm/elf.scm (DT_GUILE_FRAME_MAPS): New definition. * libguile/loader.h: * libguile/loader.c (DT_GUILE_FRAME_MAPS, process_dynamic_segment): (load_thunk_from_memory, register_elf): Arrange to parse DT_GUILE_FRAME_MAPS out of the dynamic section. (find_mapped_elf_image_unlocked, find_mapped_elf_image): New helpers. (scm_find_mapped_elf_image): Refactor. (scm_find_dead_slot_map_unlocked): New interface. * libguile/vm.c (scm_i_vm_mark_stack): Mark the hottest frame conservatively, as before. Otherwise use the dead slots map, if available, to avoid marking data that isn't live. 2014-01-26 Andy Wingo Add NEWS for Guile 2.2 * NEWS: Update for 2.1.1. Document top-level pseudo-hygiene * doc/ref/api-macros.texi (Hygiene and the Top-Level): Add a section documenting our pseudo-hygienic top-level names. 2014-01-24 Mark H Weaver Implement SRFI-111 Boxes. * module/srfi/srfi-111.scm: New file. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-111.scm. * test-suite/tests/srfi-111.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-111.test. * doc/ref/srfi-modules.texi (SRFI-111): New node. 2014-01-24 Mark H Weaver Fix thread-unsafe lazy initializations. * libguile/backtrace.c (print_exception_var): New static variable. (init_print_exception_var): New static function. (scm_print_exception): Remove thread-unsafe lazy initialization. Call 'init_print_exception_var' using 'scm_i_pthread_once'. Use 'print_exception_var'. * libguile/continuations.c (call_cc): New static variable. (init_call_cc): New static function. (scm_i_call_with_current_continuation): Remove thread-unsafe lazy initialization. Call 'init_call_cc' using 'scm_i_pthread_once'. * libguile/debug.c (local_eval_var): New static variable. (init_local_eval_var): New static function. (scm_local_eval): Remove lazy initialization using mutexes. Call 'init_local_eval_var' using 'scm_i_pthread_once'. Use 'scm_variable_ref' instead of 'SCM_VARIABLE_REF'. * libguile/eval.c (map_var, for_each_var): New static variables. (init_map_var, init_for_each_var): New static functions. (scm_map, scm_for_each): Remove thread-unsafe lazy initializations. Call 'init_map_var' (or 'init_for_each_var') using 'scm_i_pthread_once'. Use 'map_var' (or 'for_each_var'). * libguile/frames.c (frame_arguments_var): New static variable. (init_frame_arguments_var): New static function. (scm_frame_arguments): Remove thread-unsafe lazy initialization. Call 'init_frame_arguments_var' using 'scm_i_pthread_once'. Use 'frame_arguments_var'. Use 'scm_variable_ref' instead of 'SCM_VARIABLE_REF'. * libguile/goops.c (delayed_compile_var): New static variable. (init_delayed_compile_var): New static function. (make_dispatch_procedure): Remove thread-unsafe lazy initialization. Call 'init_delayed_compile_var' using 'scm_i_pthread_once'. Use 'delayed_compile_var'. Use 'scm_variable_ref' instead of 'SCM_VARIABLE_REF'. * libguile/instructions.c (instructions_by_name): New static variable. (init_instructions_by_name): New static function. (scm_lookup_instruction_by_name): Remove thread-unsafe lazy initialization. Call 'init_instructions_by_name' using 'scm_i_pthread_once'. * libguile/ports.c (current_warning_port_var) (current_warning_port_once): New static variables. (init_current_warning_port_var): New static function. (scm_current_warning_port): Remove lazy initialization using mutexes. Call 'init_current_warning_port_var' using 'scm_i_pthread_once'. Use 'current_warning_port_var'. (scm_set_current_warning_port): Remove thread-unsafe lazy initialization. Call 'init_current_warning_port_var' using 'scm_i_pthread_once'. Use 'current_warning_port_var'. * libguile/strings.c (null_stringbuf): New static variable. (init_null_stringbuf): New static function. (scm_i_make_string): Remove thread-unsafe lazy initialization. Call 'init_null_stringbuf' using 'scm_i_pthread_once'. * libguile/strports.c (eval_string_var, k_module): New static variables. (init_eval_string_var_and_k_module): New static function. (scm_eval_string_in_module): Remove lazy initialization using mutexes. Call 'init_eval_string_var_and_k_module' using 'scm_i_pthread_once'. Use 'eval_string_var'. * libguile/throw.c (CACHE_VAR): Remove incorrect macro. (catch_var, throw_var, with_throw_handler_var): New static variables. (scm_catch, scm_catch_with_pre_unwind_handler): Remove thread-unsafe lazy initialization. Use 'catch_var'. (init_with_throw_handler_var): New static function. (scm_with_throw_handler): Remove thread-unsafe lazy initialization. Call 'init_with_throw_handler_var' using 'scm_i_pthread_once'. Use 'with_throw_handler_var'. (scm_throw): Remove thread-unsafe lazy initialization. Use 'throw_var'. (scm_init_throw): Initialize 'catch_var' and 'throw_var'. 2014-01-23 Mark H Weaver Improve correctness and consistency of 'eval-when' usage. * module/ice-9/boot-9.scm: * module/ice-9/i18n.scm: * module/ice-9/poll.scm: * module/ice-9/popen.scm: * module/ice-9/r6rs-libraries.scm: * module/oop/goops.scm: * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: * module/srfi/srfi-88.scm: * module/system/foreign.scm: * module/texinfo/serialize.scm: Change most uses of 'compile' to 'expand', except where we must avoid it during initial bootstrap before the module system is loaded. Remove redundant uses of 'compile' where 'expand' is also given. Standardize on the "(expand load eval)" order of conditions. Improve docs for 'eval-when'. * doc/ref/api-macros.texi (Eval When): Explain in detail what each condition means, including 'expand' which was previously undocumented. Change the example to use (expand load eval) and recommend that set of conditions, instead of (compile load eval) which was previously recommended and shown in the example. 2014-01-21 Ludovic Courtès Buffered custom binary input ports correctly handle partial read requests. * libguile/r6rs-ports.c (cbip_fill_input): Always initialize 'read_pos' when BUFFERED. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port buffered partial reads"]: New test. 2014-01-21 Mark H Weaver Fix nested block comment example in manual. Reported by Chris K. Jester-Young . * doc/ref/api-evaluation.texi (Block Comments): Fix example. 2014-01-21 Mark H Weaver REPL Server: Don't establish a SIGINT handler. * module/system/repl/server.scm (call-with-sigint): Remove. (accept-new-client): Don't wrap 'call-with-sigint' around call to 'accept'. 2014-01-21 Mark H Weaver Write out HTTP Basic auth headers correctly. Fixes . Reported by Atom X Zane . * module/web/http.scm (write-credentials): Handle the Basic auth scheme correctly. * test-suite/tests/web-http.test (pass-if-round-trip): Use 'pass-if-equal' for better error reporting. ("request headers"): Add tests. * THANKS: Add "Atom X Zane" to bug fix section. 2014-01-21 Mark H Weaver Merge branch 'stable-2.0' Conflicts: libguile/read.c test-suite/tests/web-response.test 2014-01-21 Andy Wingo Add support for content-disposition * module/web/http.scm ("Content-Disposition"): Add a parser and serializer. Defined in RFC2616 section 19.5.1. * test-suite/tests/web-http.test ("entity headers"): New test case. 2014-01-20 Mark H Weaver Fix (port-conversion-strategy #f). Reported by Doug Evans . * libguile/ports.c (scm_port_conversion_strategy): Don't validate that 'port' is an open port until after the (port == #f) case has been handled. 2014-01-18 Ludovic Courtès Custom binary input ports support 'setvbuf'. * libguile/r6rs-ports.c (CBIP_BUFFER_SIZE): Adjust comment. Set to 8KiB. (SCM_SET_CBIP_BYTEVECTOR): New macro. (cbip_setvbuf): New function. (make_cbip): Set PORT's 'setvbuf' internal field. (cbip_fill_input): Check whether PORT is buffered. When unbuffered, check whether BV can hold C_REQUESTED bytes, and allocate a new bytevector if not; copy the data back from BV to c_port->read_pos. Remove 'again' label, and don't loop there. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port unbuffered & 'port-position'", "custom binary input port unbuffered & 'read!' calls", "custom binary input port, unbuffered then buffered", "custom binary input port, buffered then unbuffered"]: New tests. * doc/ref/api-io.texi (R6RS Binary Input): Document the buffering of custom binary input ports, and link to 'setvbuf'. Prepare 'setvbuf' to support for non-file ports. * libguile/ports-internal.h (struct scm_port_internal): Add setvbuf' field. Change 'pending_eof' to a 1-bit unsigned char. * libguile/ports.c (scm_new_port_table_entry): Clear 'pti->setvbuf'. * libguile/fports.c (scm_setvbuf): Accept any open port, and error out when PORT's setvbuf' field is NULL. Remove explicit 'scm_gc_free' calls. (scm_i_fdes_to_port): Set PORT's 'setvbuf' field. * test-suite/tests/ports.test ("setvbuf")["closed port", "string port"]: New tests. * doc/ref/posix.texi (Ports and File Descriptors): Suggest that 'setvbuf' works for different port types. 2014-01-18 Andy Wingo Add support for content-disposition * module/web/http.scm ("Content-Disposition"): Add a parser and serializer. Defined in RFC2616 section 19.5.1. * test-suite/tests/web-http.test ("entity headers"): New test case. 2014-01-17 Arne Babenhauserheide doc: embedding example more readable. * doc/ref/guile.texi (A Sample Guile Main Program): Easier to read example code and building split into 2 subsections. 2014-01-17 Ludovic Courtès Thank Sree Harsha. 2014-01-17 Ludovic Courtès Arrange so that 'file-encoding' does not truncate the encoding name. Fixes . Reported by Sree Harsha Totakura . * libguile/read.c (ENCODING_NAME_MAX_SIZE): New macro. (SCM_ENCODING_SEARCH_SIZE): Change to 500 + ENCODING_NAME_MAX_SIZE. (scm_i_scan_for_encoding): Return NULL if there's less than ENCODING_NAME_MAX_SIZE bytes once "coding: *" has been read. * test-suite/tests/coding.test ("line comment")["http://bugs.gnu.org/16463"]: New test. 2014-01-16 Andy Wingo Finish documenting the new compiler * doc/ref/compiler.texi (An Introduction to CPS): Reword. (Compiling CPS): New sub-sub-section. (Bytecode): New sub-section. Fix CPS doc typos * doc/ref/compiler.texi (CPS in Guile): Fix a couple typos. 2014-01-15 Ludovic Courtès web: Don't throw if a response is longer than its Content-Length says. * module/web/response.scm (make-delimited-input-port): Read at most LEN bytes from PORT, instead of trying to read more and returning an error if more is available. Try again when 'get-bytevector-n!' return zero. * test-suite/tests/web-response.test (example-1): Add garbage after the body itself. Custom binary input ports sanity-check the return value of 'read!'. * libguile/r6rs-ports.c (cbip_fill_input): Throw an exception when C_OCTETS is greater than what was requested. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port 'read!' returns too much"]: New test. 2014-01-15 Mark H Weaver Document that we support srfi-46 and add it to %cond-expand-features. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-46. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-46 to the list of core features. (SRFI-46): New node. * doc/ref/api-macros.texi (Syntax Rules): Mention that the custom ellipsis identifier support is specified by SRFI-46. * test-suite/tests/syntax.test ("syntax-rules"): Add ellipsis hygiene test from SRFI-46. 2014-01-15 Mark H Weaver Document that we support srfi-87 and add it to %cond-expand-features. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-87. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-87 to the list of core features. (SRFI-87): New node. 2014-01-15 Mark H Weaver Merge branch 'stable-2.0' print: In R7RS |...| symbols, print most graphic characters unescaped. * libguile/print.c (print_r7rs_extended_symbol): Print any unicode graphic character other than '|' or '\' unescaped. Escape any spacing character other than ASCII space. Merge branch 'stable-2.0' Conflicts: libguile/print.c libguile/read.c test-suite/tests/print.test 2014-01-15 Mark H Weaver print: Support R7RS |...| symbol notation. * libguile/print.c (scm_print_opts): Add 'r7rs-symbols' print option. (symbol_has_extended_read_syntax): If the 'r7rs-symbols' option is enabled, then disallow '|' and '\' from bare symbols. (print_extended_symbol): Use 'scm_lfwrite' and 'scm_putc' instead of 'display_string' and 'display_character' when printing ASCII literals. (print_r7rs_extended_symbol): New static function. (scm_i_print_symbol_name): If the 'r7rs-symbols' option is enabled, use 'print_r7rs_extended_symbol' instead of 'print_extended_symbol'. * libguile/private-options.h (SCM_PRINT_R7RS_SYMBOLS_P): New macro. (SCM_N_PRINT_OPTIONS): Increment. * doc/ref/api-evaluation.texi (Scheme Write): Mention 'r7rs-symbols' print option. * test-suite/tests/print.test ("write"): Add tests. 2014-01-15 Mark H Weaver read: Support R7RS |...| symbol notation. * libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro. (SCM_N_READ_OPTIONS): Increment. * libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'. (t_read_opts): Add field for 'r7rs_symbols_p'. (scm_read_string_like_syntax): New function based on earlier 'scm_read_string' that handles either string literals or R7RS quoted symbols (delimited by vertical bars), depending on the value of 'chr'. (scm_read_string): Reimplement based on 'scm_read_string_like_syntax'. (scm_read_r7rs_symbol): New static function. * doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS symbol syntax, mention the 'r7rs-symbols' read option, and give some examples. * doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols' read option. * test-suite/tests/reader.test ("reading"): Add test. 2014-01-14 Mark H Weaver Document that we support srfi-62 and add it to %cond-expand-features. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-62. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-62 to the list of core features. (SRFI-62): New node. 2014-01-14 Mark H Weaver Merge branch 'stable-2.0' Conflicts: libguile/chars.c libguile/read.c test-suite/tests/reader.test read: use 'c_tolower' instead of 'tolower' in 'try_read_ci_chars'. * libguile/read.c: Include . (try_read_ci_chars): Use 'c_tolower' instead of 'tolower'. 2014-01-14 Mark H Weaver Recognize 'escape' character name, per R7RS. * libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums): New static constants. (SCM_N_R7RS_CHARNAMES): New macro. (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS char names. * doc/ref/api-data.texi (Characters): Document #\escape. * test-suite/tests/reader.test ("reading"): Add test. 2014-01-14 Mark H Weaver read: Accept "\|" in string literals. * libguile/read.c (scm_read_string): Accept "\|" in string literals. * doc/ref/api-data.texi (String Syntax): Add "\|" to the list of supported backslash escapes. * test-suite/tests/reader.test ("reading"): Add test. 2014-01-14 Mark H Weaver read: Support R7RS '#true' and '#false' syntax for booleans. * libguile/read.c (try_read_ci_chars): New static function. (scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'. * doc/ref/api-data.texi (Booleans): Update docs. * test-suite/tests/reader.test ("reading"): Add tests. 2014-01-14 Mark H Weaver Add srfi-16 and srfi-30 to %cond-expand-features. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-16 and srfi-30. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-16 and srfi-30 to the list of core features. * module/srfi/srfi-16.scm: Remove call to 'cond-expand-provide'. 2014-01-14 Mark H Weaver Merge branch 'stable-2.0' Conflicts: libguile/hash.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/tests/r6rs-ports.test 2014-01-13 Ludovic Courtès 'port-position' works on CBIPs that do not support 'set-port-position!'. * libguile/r6rs-ports.c (cbp_seek)[WHENCE == SEEK_CUR]: Break out of the switch statement when OFFSET is zero. Pass 'scm_wrong_type_arg_msg' a phrase suitable for use after "expecting". * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port supports `port-position', not `set-port-position!'"]: New test. 2014-01-12 Andy Wingo Finish CPS documentation * doc/ref/compiler.texi (Continuation-Passing Style): Flesh out the documentation. 2014-01-12 Mark H Weaver Fix 'exact-integer?' comment in numbers.test. * test-suite/tests/numbers.test: Fix 'exact-integer?' comment. 2014-01-12 Mark H Weaver Fix hashing of empty vectors. Fixes a bug introduced in cc1cd04f8111c306cf48b93e131d5c1765c808a3 "Fix hashing of vectors to run in bounded time." * libguile/hash.c (scm_hasher): Avoid division by zero. * test-suite/tests/hash.test ("hash"): Add tests. 2014-01-12 Andy Wingo Rename $ktrunc to $kreceive * module/language/cps.scm ($kreceive): Rename from ktrunc. * module/language/cps/arities.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/dce.scm: * module/language/cps/dfg.scm: * module/language/cps/effects-analysis.scm: * module/language/cps/elide-values.scm: * module/language/cps/simplify.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt all users. 2014-01-12 Andy Wingo Returning too many values to call-with-values raises a runtime error * module/language/cps/compile-bytecode.scm (compile-fun): Now that all $call expressions continue to $ktail or $ktrunc, remove the $kargs case, and make receive-values bail if too many values are returned. 2014-01-12 Mark H Weaver Bump user-visible copyright years to 2014. * doc/ref/guile.texi: Add 2014 to list of copyright years in @copying section. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2014. * module/system/repl/common.scm (*version*): Add 2014 to the range of copyright years. 2014-01-12 Mark H Weaver Fix hashing of vectors to run in bounded time. * libguile/hash.c (SCM_MIN): New macro. (scm_hasher): In vector case, do nothing if d is 0. Make sure to recurse with a reduced d. Move the loop out of the 'if'. 2014-01-11 Andy Wingo Insert explicit $ktrunc nodes everywhere that truncates multiple values * module/language/tree-il/compile-cps.scm (init-default-value, convert): Explicitly insert $ktrunc nodes on all places that can truncate to single values. Add simplification pass * module/Makefile.am: * module/language/cps/compile-bytecode.scm: * module/language/cps/simplify.scm: New pass. Add DCE pass. * module/language/cps/dce.scm: New pass. * module/Makefile.am: * module/language/cps/compile-bytecode.scm: Wire up the new pass. Shuffle the first return value from truncating calls * module/language/cps/slot-allocation.scm (allocate-slots): For truncating calls, shuffle the first return value (if any). Avoids frame size growth due to sparse locals, pegged where they were left by procedure call returns. With this patch, eval with $ktrunc nodes goes from 31 locals to 18 (similar to the size before adding $ktrunc nodes). All $values expressions go through allocate-values * module/language/cps/slot-allocation.scm (allocate-slots): Make all $values expressions go through allocate-values, and refactor allocate-values. Fix allocate-slots bug * module/language/cps/slot-allocation.scm (allocate-slots): Fix bug in allocate!, whereby a previously hinted allocation would not be added to the live set if a hint was not given later. More robust compute-hints * module/language/cps/slot-allocation.scm (allocate-slots): Allow the compute-hints pass to traverse through $values with 0 or 1 value. Prefer "receive" over "receive-values"+"reset-frame" * module/language/cps/compile-bytecode.scm (compile-fun): Attempt to emit "receive" instead of "receive-values"+"reset-frame" where possible. Only emit receive-values if it is needed * module/language/cps/compile-bytecode.scm (compile-fun): Don't emit receive-values unless there is a minimum or maximum number of values. Remove "pop" from $prompt * module/language/cps.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/dfg.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Remove "pop" member from $prompt data type, as it is no longer used. Enable prompt analysis * module/language/cps/dfg.scm (compute-live-variables, visit-fun): Use the new prompt analysis pass in analyze-control-flow instead of always adding a link in the DFG. Avoids problems if there are parts of the prompt body that have no path to the pop. Add prompt analysis to the DFG's analyze-control-flow * module/language/cps/dfg.scm (compute-reachable, find-prompts) (compute-interval, find-prompt-bodies, visit-prompt-control-flow): New helpers. (analyze-control-flow): Add a mode that adds on CFA edges corresponding to non-local control flow in a prompt. compute-live-variables uses CFA analysis * module/language/cps/dfg.scm ($dfa): Store a CFA instead of a separate k-map and order. (dfa-k-idx, dfa-k-sym, dfa-k-count): Adapt. (compute-live-variables): Use analyze-control-flow instead of rolling out own RPO numbering. Will allow us to fix some prompt-related things in a central place. Internal analyze-control-flow refactor * module/language/cps/dfg.scm (reverse-post-order): Fold-all-conts is now a required arg. (analyze-control-flow): Reverse CFA adds forward-reachable continuations to the numbering. 2014-01-11 Andy Wingo Fix constant-needs-allocation? for $values uses * module/language/cps/dfg.scm (constant-needs-allocation?): Use of a constant in a $values expression of any arity does not cause slot allocation. * module/language/cps/compile-bytecode.scm (compile-fun): Allow $values with a constant value to be compiled in test context. Really we should fold these in a previous pass! 2014-01-11 Andy Wingo Add effects analysis pass on CPS * module/Makefile.am: * module/language/cps/effects-analysis.scm: New helper module. 2014-01-11 Andy Wingo Fix prim -> VM op mapping for u8/s8 bytevector ops * module/language/cps/primitives.scm (*instruction-aliases*): Fix aliases for bytevector u8 / s8 operations. * module/language/cps/compile-bytecode.scm (compile-fun): Fix s8 operations. 2014-01-09 Mark H Weaver Implement R7RS 'syntax-error'. * module/ice-9/psyntax.scm (syntax-error): New macro. (syntax-rules): Handle 'syntax-error' templates specially for improved error reporting. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-macros.texi (Syntax Rules): Add new subsection "Reporting Syntax Errors in Macros". * test-suite/tests/syntax.test: Add tests. 2014-01-09 Mark H Weaver psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules. * module/ice-9/psyntax.scm (binding-type): Update the header comment to mention the new 'ellipsis' binding type. (macros-only-env): Preserve ellipsis bindings. (ellipsis?): Add 'r' and 'mod' as arguments. Search the lexical environment for an ellipsis binding, and use it. (gen-syntax): Adapt to the additional arguments of 'ellipsis?'. (with-ellipsis): New core syntax. (convert-pattern): Add unary 'ellipsis?' procedure as an argument. (gen-clause): Adapt to the additional arguments of 'ellipsis?'. Pass unary 'ellipsis?' procedure to 'convert-pattern'. (syntax-case): Adapt to the additional arguments of 'ellipsis?'. (syntax-local-binding): Support new 'ellipsis' binding type. (syntax-rules): Add support for a custom ellipsis identifier as the first operand, as per R7RS. Collect common code within new local procedure 'expand-syntax-rules'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/local-eval.scm (analyze-identifiers): Add support for 'ellipsis' binding type. * doc/ref/api-macros.texi (Syntax Rules): Add docs for R7RS custom ellipsis syntax. Use @dots{}. (Syntax Case): Add docs for 'with-ellipsis'. Use @dots{}. (Syntax Transformer Helpers): Update to include new 'ellipsis' binding type. * test-suite/tests/syntax.test: Add tests. 2014-01-09 Mark H Weaver psyntax: toplevel variable definitions discard previous syntactic binding. * module/ice-9/psyntax.scm (expand-top-sequence): When defining a toplevel variable, use the value of the same-named imported _variable_, if any. Do _not_ use an existing syntactic binding. * module/ice-9/psyntax-pp.scm: Regenerate. 2014-01-09 Mark H Weaver Merge branch 'stable-2.0' Conflicts: module/system/vm/traps.scm test-suite/tests/peval.test 2014-01-09 Ian Price Fix trap handlers to handle applicable structs. Reported by Jordy Dickinson . Fixes . * module/system/vm/traps.scm (frame-matcher): Extract procedure when proc is an applicable struct. 2014-01-09 Mark H Weaver Fix 'string-copy!' to work properly with overlapping src/dest. * libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with overlapping src/dest. * test-suite/tests/srfi-13.test ("string-copy!"): Add tests. 2014-01-09 Mark H Weaver Implement 'exact-integer?' and 'scm_is_exact_integer'. * libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer): New procedures. (scm_integer_p): Improve docstring. * libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer): New prototypes. * doc/ref/api-data.texi (Integers): Add docs. * test-suite/tests/numbers.test ("exact-integer?"): Add tests. 2014-01-09 Mark H Weaver Fix doc that incorrectly claimed (integer? +inf.0) => #t. Fixes . Reported by Zefram . * doc/ref/api-data.texi (Integers): Add docs. Fix outdated example that incorrectly showed (integer? +inf.0) => #t. 2014-01-09 Mark H Weaver scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'. * libguile/load.c (scm_primitive_load): Use 'scm_open_file_with_encoding'. boot-9: add comment about autoload thread-unsafety. * module/ice-9/boot-9.scm: Add comment about lack of thread-safety in handling of autoloads. read: Avoid signed integer overflow in 'read_decimal_integer'. * libguile/read.c (read_decimal_integer): Avoid overflow. Increment SCM_N_READ_OPTIONS for 'curly-infix' option. * libguile/private-options.h (SCM_N_READ_OPTIONS): Increment to 8. This should have been done when the 'curly-infix' was added. 2014-01-07 Ian Price Fix inlining of tail list to apply. Fixes . * module/language/tree-il/peval.scm (peval): Final list argument to `apply' should not be inlined if it is mutable. * test-suite/tests/peval.test ("partial evaluation"): Add test. 2013-12-21 Ludovic Courtès Thank Aleix. 2013-12-21 Aleix Conchillo Flaque allow specifying a required version in GUILE_PROGS * meta/guile.m4: GUILE_PROGS now takes an optional argument to specify a required Guile version. By default, it requires Guile >= 2.0. A micro version can also be specified (e.g. GUILE_PROGS([2.0.10])). 2013-12-17 Mark H Weaver Revert "Fix bound-identifier=? to compare binding names, not just symbolic names." This reverts commit 70c74b847680d3b239e591afa2e99c51a712980c. 2013-12-16 Mark H Weaver Fix bound-identifier=? to compare binding names, not just symbolic names. Fixes . * module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare binding names (gensyms), not just symbolic names. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add test. 2013-12-15 Ludovic Courtès Hide EINTR returns from 'accept'. * libguile/socket.c (scm_accept): Wrap 'accept' call in 'SCM_SYSCALL'. 2013-12-13 Mark H Weaver syntax-case: fix error reporting for misplaced ellipses. Reported by taylanbayirli@gmail.com (Taylan Ulrich B.). * module/ice-9/psyntax.scm (cvt*): Use 'syntax-case' to destructure the pattern tail, instead of 'pair?', 'car', and 'cdr'. (gen-clause): When checking for errors, check for misplaced ellipsis before duplicate pattern variables, to improve the error message in case of multiple misplaced ellipses. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add tests. 2013-12-13 Mark H Weaver THANKS Tom Tromey. * THANKS: Add Tom Tromey to fixes section. Merge branch 'stable-2.0' Conflicts: libguile/pairs.c libguile/vm.c test-suite/tests/control.test 2013-12-13 Tom Tromey Remove unused function scm_i_tag_name. * libguile/gc.c (scm_i_tag_name): Remove. Add missing FUNC_NAME defines for pair accessors. * libguile/pairs.c (scm_car, scm_cdr, scm_caar, scm_cadr, scm_cdar, scm_cddr, scm_caaar, scm_caadr, scm_cadar, scm_caddr, scm_cdaar, scm_cdadr, scm_cddar, scm_cdddr, scm_caaaar, scm_caaadr, scm_caadar, scm_caaddr, scm_cadaar, scm_cadadr, scm_caddar, scm_cadddr, scm_cdaaar, scm_cdaadr, scm_cdadar, scm_cdaddr, scm_cddaar, scm_cddadr, scm_cdddar, scm_cddddr): Add missing FUNC_NAME defines. 2013-12-13 Tom Tromey Fix computation of LIBLOBJS. Fixes . * configure.ac (LIBLOBJS): Add prefix to computed .lo file name so dependencies work properly. 2013-12-10 Andy Wingo Fix section table writing for non-loadable sections * module/system/vm/linker.scm (add-elf-objects): Don't fill in the sh_addr field if the section is not loadable. Quick documentation fixes. * doc/ref/compiler.texi: Make it build. Non-loadable sections should not have an sh_addr field set * module/system/vm/linker.scm (relocate-section-header): (write-linker-object): Sections that are not loadable should not have their sh_addr fields set. Fix. Beginnings of CPS section in manual * doc/ref/compiler.texi (Continuation-Passing Style): Beginnings of this section. Will be finished when we fix implicit truncation. Fix cross-references in api-macros.texi * doc/ref/api-macros.texi (Macro Expansion): Fix cross-references. 2013-12-06 Andy Wingo Arities-fixing pass handles incoming $ktrunc with rest args * module/language/cps/arities.scm (fix-clause-arities): Allow $ktrunc arities with rest arguments. Elide values primcalls with continuations with rest arguments * module/language/cps/elide-values.scm (elide-values): Elide values primcalls when continuation has rest arguments. 2013-12-06 Andy Wingo (call-with-values foo (lambda (a . b) a)) avoids consing rest list * module/language/cps/slot-allocation.scm (allocate-slots): Don't allocate slots to unused results of function calls. This can allow us to avoid consing a rest list for call-with-values with an ignored rest parameter, and can improve the parallel move code. * module/language/cps/compile-bytecode.scm (compile-fun): Adapt to avoid emitting bind-rest in values context if the rest arg is unused. 2013-12-05 Ludovic Courtès vm: Gracefully handle stack overflows. Fixes . Reported by rvclayton@verizon.net (R. Clayton). * libguile/vm.c (reinstate_stack_reserve): New function. (vm_error_stack_overflow): Install it as an unwind handler. * test-suite/tests/control.test ("the-vm")["stack overflow reinstates stack reserve"]: New test. 2013-12-05 Andy Wingo compiler.texi tweaks * doc/ref/compiler.texi (Compiler Tower): Reword a couple things. (Tree-IL): Add more vertical space, for readability in info. 2013-12-04 Andy Wingo Doc updates to macroexpansion, compiled procs, and compiler.texi * doc/ref/api-macros.texi (Macro Expansion): New section. * doc/ref/api-procedures.texi (Compiled Procedures): Beginnings of a revision. Not finished. * doc/ref/compiler.texi (Compiling to the Virtual Machine): Beginnings of a revision. CPS and bytecode are not done yet. 2013-12-02 Andy Wingo Rename "RTL" to "bytecode" "RTL" didn't make any sense, and now that there's no other bytecode to disambiguate against, just call it bytecode. * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/bytecode.scm: * module/language/bytecode/spec.scm: * module/language/cps/arities.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/contification.scm: * module/language/cps/elide-values.scm: * module/language/cps/primitives.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/spec.scm: * module/language/cps/specialize-primcalls.scm: * module/language/rtl.scm: * module/language/rtl/spec.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * module/system/repl/common.scm: * module/system/vm/assembler.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/dwarf.scm: * test-suite/tests/cross-compilation.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: * test-suite/vm/run-vm-tests.scm: Fixups. 2013-12-02 Andy Wingo Fix brainfuck comment * module/language/brainfuck/parse.scm: Fix outdated comment. Fix brainfuck->scheme compiler. * module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix brainfuck compiler. Fix brainfuck comment * module/language/brainfuck/parse.scm: Fix outdated comment. Fix brainfuck->scheme compiler. * module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix brainfuck compiler. 2013-12-02 Mark H Weaver GOOPS doc fix: #:dsupers is the init keyword for the dsupers slot. * doc/ref/goops.texi (Metaclasses): #:dsupers is the initialization keyword for the dsupers slot, not #:supers. 2013-12-02 Mark H Weaver Thread safe port properties. * libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x): Lock the port mutex while accessing the port alist. * libguile/read.c (set_port_read_option): Lock the port mutex while modifying port read options. 2013-12-01 Andy Wingo Add section to vm.texi about Guile's use of ELF * doc/ref/vm.texi (Object File Format): New section. 2013-11-30 Andy Wingo vm.texi tweak * doc/ref/vm.texi (Why a VM?): Small tense tweak. Update vm.texi's "Instruction Set" section. * doc/ref/vm.texi (Instruction Set): Update. Fix more vm-engine comments * libguile/vm-engine.c: Fix more comments. Remove slot-ref and slot-set! ops * libguile/vm-engine.c: Remove slot-ref and slot-set! ops. 2013-11-30 Andy Wingo Remove GOOPS-internal @slot-ref and @slot-set! * module/oop/goops.scm: Remove definitions of @slot-ref and @slot-set!. They are equivalent to struct-ref and struct-set!. (define-standard-accessor-method): Reimplement using syntax-case. (bound-check-get, standard-get, standard-set): Replace @slot-ref and @slot-set! uses with struct-ref and struct-set!. * module/language/cps/reify-primitives.scm (primitive-module): Remove @slot-set! and @slot-ref references. 2013-11-30 Andy Wingo Beginning vm.texi updates * doc/ref/vm.texi: Updates. Fix vm-engine.c comments * libguile/vm-engine.c: Fix some comments. Unknown files print as (unknown file) in disassembler * module/system/vm/disassembler.scm (disassemble-buffer): Print unknown files as "(unknown file)". ,x disassembles nested programs too * module/system/vm/disassembler.scm (code-annotation): (disassemble-buffer, disassemble-addr, disassemble-program): Arrange to disassemble nested procedures. (disassemble-image): Adapt. Update history.texi * doc/ref/history.texi (A Timeline of Selected Guile Releases, Status): Update. 2013-11-29 Andy Wingo Remove outdated section of api-memory.texi * doc/ref/api-memory.texi (Memory Blocks): Remove section documenting scm_must_malloc and friends. 2013-11-28 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Critical sections in guardians do not need to block asyncs * libguile/guardians.c: Critical sections here cannot cause an async_tick, so they do not need to block asyncs. Merge commit 'd364a8971828e38e8f9112b711066f4962bb400e' Conflicts: libguile/deprecated.h libguile/gc.c Merge commit 'e7bd20f7d9b2110fdc0fa25db5a2bfe6b2214923' Merge commit '17330398d50524058c2ef488bd21ac5ec9c8b6e8' Merge commit 'a38024baaa32d1a6d91fdc81388c88bbb926c3ae' Conflicts: libguile/ports.h Merge commit '2437c7b2e8b4ab7786847ee1ce0b59e446a70fe2' Conflicts: libguile/guardians.c Merge commit '8571dbde639e0ee9885bad49c9e180474bd23646' Conflicts: libguile/procprop.c Merge commit '750ac8c592e792e627444f476877f282525b132e' Conflicts: .gitignore libguile/deprecated.c Merge commit 'c61be45084d04b1db792b7e232f5bd77099f3287' Conflicts: libguile/ports.c Merge commit 'd360671c1cca335600079f1c5714572d1c2e676d' Deprecate gc-live-object-stats * libguile/gc.h: * libguile/gc.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_gc_live_object_stats): Deprecate; it hasn't worked in the whole 2.0 series. Avoid needless GC on startup due to scm_gc_register_allocation * libguile/gc.c (bytes_until_gc): Initialize to DEFAULT_INITIAL_HEAP_SIZE, to avoid forced GC on the first mallocation. 2013-11-28 Andy Wingo Remove private-gc.h * libguile/simpos.c (scm_getenv_int): Move here, from gc.c. * libguile/private-gc.h: Remove, unused. * libguile/simpos.h: Move scm_getenv_int declaration here. * libguile/vm.c: * libguile/gc.c: Adapt scm_getenv_int users. * libguile/gc-malloc.c: * libguile/load.c: * libguile/script.c: Remove private-gc includes from non-users of scm_getenv_int. * libguile/Makefile.am: Adapt. 2013-11-28 Andy Wingo scm_i_tag_name internal to gc.c * libguile/gc.c (scm_i_tag_name): Make internal to gc.c. * libguile/private-gc.h: Remove from here. 2013-11-28 Andy Wingo More private-gc excisions * libguile/private-gc.h (SCM_DOUBLECELL_ALIGNED_P): Remove; unused. * libguile/filesys.c (MAX, MIN): Move definitions here, from private-gc.h. (scm_sendfile, scm_readdir): Adapt uses of SCM_MAX and SCM_MIN to use MAX or MIN. Remove unused enum policy_on_error * libguile/private-gc.h (enum policy_on_error): Remove unused enum. 2013-11-28 Andy Wingo Tune initial heap size * libguile/fluids.c (new_fluid): Don't run an explicit GC for the first fluid. * libguile/gc.c (DEFAULT_INITIAL_HEAP_SIZE, scm_storage_prehistory): Enlarge from 32 kB to 512 or 1024 kB, depending on word size. Reduces startup time by 10 or 15% by avoiding excessive GC. * libguile/private-gc.h: Remove SCM_DEFAULT_INIT_HEAP_SIZE_2 definition here. 2013-11-28 Andy Wingo Remove another GC 6.8 hack * libguile/gc.c (scm_storage_prehistory): Remove hack for BDW-GC 6.8. Fix "include" doc typo * doc/ref/api-evaluation.texi (Local Inclusion): Fix typo. Use version 2.2 in manual examples * doc/ref/api-evaluation.texi (Load Paths): * doc/ref/api-options.texi (Build Config): * doc/ref/guile-invoke.texi (Environment Variables): * doc/ref/libguile-parallel.texi (Parallel Installations): Use 2.2 in examples, rather than 2.0. Fix some references to objcode in the manual * doc/ref/api-evaluation.texi (Compilation): Update references from "objcode" to "rtl". 2013-11-27 Andy Wingo Remove nonfunctional gdb interface * libguile/gdb_interface.h: * libguile/gdbint.c: * libguile/gdbint.h: Remove. These were last modified significantly in 1997 and I think they are unused. * libguile/guile.c: Remove use. * libguile.h: Remove inclusion. * libguile/Makefile.am: Remove reference. * libguile/init.c: Remove use. 2013-11-27 Andy Wingo Remove the restore-continuation-hook. * libguile/vm.h: * libguile/vm.c: * libguile/vm-engine.c: * module/system/vm/traps.scm: * module/system/vm/vm.scm: Remove the unused and redundant restore-continuation-hook. Declare r6rs-ports functions * libguile/r6rs-ports.h: * libguile/r6rs-ports.c: Declare scm_unget_bytevector and scm_i_make_transcoded_port. Fix uninitialized variable error in some peek-char error cases * libguile/ports.c (scm_peek_char): Don't require error cases to set *len. Fixes a bug caught by GCC whereby an EOF while reading a multibyte character with iconv would leave len uninitialized. Declare scm_i_open_file to silence a warning * libguile/fports.c (scm_i_open_file): Declare. Remove generalized vector interface; deprecated in 2.0 already. * libguile/deprecated.c: Remove the generalized-vector interface, deprecated since 2.0.8. Declare scm_nil_p * libguile/boolean.h: Declare scm_nil_p. 2013-11-26 Andy Wingo Build psyntax-pp serially after eval.go. * module/Makefile.am: Arrange to build psyntax-pp.go in serial mode, after eval.go. Before the expander is compiled, expanding all the Scheme files dominates compile-time, even for larger files like psyntax-pp.scm. If we compile psyntax in parallel with other files, it could be one of the other files finishes first, leading to two consecutive compiles that have to use an uncompiled psyntax expander. Ordering the compilation minimizes total real and user time, at least locally on a 4-core machine. Also take the opportunity to shuffle compile order for the rest of the Scheme files, to build parts of the RTL compiler early. 2013-11-26 Andy Wingo Contification converges more quickly * module/language/cps/contification.scm (compute-contification): Converge more quickly by using the information we compute within a compute-contification pass. 2013-11-25 Andy Wingo Compute-contification also visits body * module/language/cps/contification.scm (compute-contification): If we decide to contify, don't forget to visit the body. Should make contification converge faster. 2013-11-23 Mark H Weaver Make (ice-9 popen) thread-safe. Fixes . Reported by David Pirotte . * module/ice-9/popen.scm: Import (ice-9 threads) and (srfi srfi-9). (): New record type. (port/pid-table): Mark as deprecated in comment. (port/pid-table-mutex): New variable. (open-pipe*): Store the pid in the pipe-info record, and store the pipe-info as a port property. Guard the pipe-info instead of the port. Lock 'port/pid-table-mutex' while mutating 'port/pid-table'. (fetch-pid): Removed. (fetch-pipe-info): New procedure. (close-process-quietly): Removed. (close-pipe): Use 'fetch-pipe-info' instead of 'fetch-pid'. Clear the pid from the pipe-info. Improve error messages. (reap-pipes): Adapt to the fact that the pipe-info is now guarded instead of the port. Incorporate the 'waitpid' code that was previously in 'close-process-quietly', but let the port finalizer close the port. Clear the pid from the pipe-info. 2013-11-23 Mark H Weaver Stylistic improvements for (ice-9 popen). * module/ice-9/popen.scm (close-process, close-process-quietly): Accept 'port' and 'pid' as separate arguments. Improve style. (close-pipe, read-pipes): Improve style. 2013-11-23 Mark H Weaver Make port properties accessible from Scheme. * libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): Removed. (scm_i_port_property, scm_i_set_port_property_x): New procedures, available from Scheme as '%port-property' and '%set-port-property!'. * libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Removed. (scm_i_port_property, scm_i_set_port_property_x): New prototypes. * libguile/read.c (set_port_read_option, init_read_options): Adapt to use scm_i_port_property and scm_i_set_port_property_x. 2013-11-23 Mark H Weaver Make guardians thread-safe. * libguile/guardians.c (t_guardian): Add mutex. (finalize_guarded, scm_i_guard, scm_i_get_one_zombie): Lock mutex and block system asyncs during critical sections. (scm_make_guardian): Initialize mutex. Block system asyncs while 'overrides_lock' is held. * libguile/procprop.c (scm_set_procedure_property_x): Block system asyncs while overrides_lock is held. Use dynwind block in case an exception is thrown. 2013-11-23 Mark H Weaver Add mutex locking functions that also block asyncs. * libguile/async.h (scm_i_pthread_mutex_lock_block_asyncs, scm_i_pthread_mutex_unlock_unblock_asyncs): New macros. * libguile/threads.c (do_unlock_with_asyncs): New static helper. (scm_i_dynwind_pthread_mutex_lock_block_asyncs): New function. * libguile/threads.h (scm_i_dynwind_pthread_mutex_lock_block_asyncs): Add prototype. 2013-11-23 Chris K. Jester-Young Convert test-suite/tests/exceptions.test to use hygienic macros. * test-suite/tests/exceptions.test (push): New syntax parameter. (throw-test): Convert to a syntax-rules macro, using syntax parameters to support the otherwise-unhygienic use of "push". 2013-11-22 Andy Wingo Expandable stacks. * libguile/vm-engine.c (CHECK_OVERFLOW): Call vm_expand_stack, not vm_error_stack_overflow. * libguile/vm.c (hard_max_stack_size, default_max_stack_size): Recast #defines as locals. Have both hard and soft stack limits. (initialize_default_stack_size): Set soft stack limit from GUILE_STACK_SIZE. (expand_stack, vm_expand_stack): Support for expanding stacks as needed. Whee! (make_vm): Adapt limits. (scm_call_n): Expand stack if needed. * libguile/vm.h (struct scm_vm): Add max_stack_size member. 2013-11-22 Andy Wingo VM copes with moving FP * libguile/_scm.h (SCM_ASYNC_TICK_WITH_GUARD_CODE): New macro. * libguile/vm-engine.c (VM_HANDLE_INTERRUPTS): Restore FP after ticking. (CACHE_FP): New macro. (CHECK_OVERFLOW): Use CACHE_FP. (BR_ARITHMETIC, RETURN_EXP, RETURN_ONE_VALUE, BINARY_INTEGER_OP): (call, return-values, subr-call, foreign-call) (resolve, define!, toplevel-box, module-box): Restore the FP from the vp where needed. Simplify state sync in VM before potential bailout. * libguile/vm-engine.c (SYNC_IP): Remove calls to SYNC_BEFORE_GC, a no-op. Replace SYNC_REGISTER / SYNC_ALL calls with just SYNC_IP. More precise stack marking. * libguile/vm.c (scm_i_vm_mark_stack): Mark the stack more precisely. 2013-11-22 Andy Wingo Allocate stacks using mmap, and mark them via the thread marker * libguile/threads.c (thread_mark): Mark the VM stack, if we have one. (on_thread_exit): Free the VM stack here. * libguile/vm.c (make_vm): Allocate the VM stack using mmap, and arrange for it to be marked by the thread marker. (scm_i_vm_mark_stack, scm_i_vm_free_stack): New internal interfaces. (allocate_stack, free_stack): New helpers. 2013-11-22 Andy Wingo Add thread mark procedure * libguile/threads.c (thread_mark): A mark procedure for threads. Eventually will mark the stack. (guilify_self_1): Move initialization of VP earlier. Allocate thread using thread_gc_kind. (scm_threads_prehistory): Initialize thread_gc_kind. Remove unused scm_i_thread fields * libguile/threads.h (scm_i_thread): * libguile/threads.c (guilify_self_1): Remove unused mark stack fields. 2013-11-22 Andy Wingo Remove tests and shims for pre-7.2 bdw-gc. * configure.ac: Remove checks for symbols present in bdw-gc 7.2. * libguile/finalizers.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/guardians.c: * libguile/scmsigs.c: * libguile/threads.c: Remove shims. 2013-11-21 Andy Wingo Add explicit nopcodes * libguile/vm-engine.c (VM_NAME): Add explicit nopcodes, later to be interspersed with others. This will allow us some extensibility without always shuffling around opcodes. Also avoid lazy initialization; have the linker do it for us. * libguile/instructions.c (parse_instruction): (scm_instruction_list): Rework instruction parsing to avoid using malloc. It would seem that this would fix some GC issue -- but who knows! 2013-11-21 Andy Wingo Setjmp before calling into the VM * libguile/vm-engine.c (CACHE_REGISTER): Remove an unneeded cast. (VM_NAME): * libguile/vm.c (scm_call_n): Setjmp out here. This leaves the VM without any initialization work to do. It also makes it possible to restart the VM in another mode (with hooks, for example). scm_call_n sets up boot continuation frame for VM * libguile/vm-engine.c: * libguile/vm.c (scm_call_n): Move boot continuation setup to scm_call_n, so that vm-engine takes all of its state from the vp. scm_call_n avoids double TLS lookup * libguile/vm-engine.c (VM_NAME): Take the current thread as an argument. * libguile/vm.c (scm_i_capture_current_stack): Call thread_vm. (thread_vm): New helper. (scm_the_vm): Call thread_vm. (scm_call_n): Call thread_vm. Avoids a double TLS lookup. 2013-11-21 Andy Wingo Remove scm_tc7_vm * libguile/tags.h (scm_tc7_vm): Return to pool. * libguile/goops.c: * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): * libguile/print.c (iprin1): Remove tc7_vm things. * libguile/vm.h (scm_the_vm_fluid): Remove stray declaration. Remove SCM_VM_P. Remove SCM_VM_DATA. Remove SCM_VALIDATE_VM. * libguile/vm.c (scm_i_vm_print): Remove. 2013-11-21 Andy Wingo Remove last use of SCM vm * libguile/threads.h (scm_i_thread): Hold a struct scm_vm*, not a SCM vm. * libguile/threads.c (guilify_self_2): * libguile/vm.c (make_vm): Adapt. 2013-11-21 Andy Wingo scm_the_vm now returns raw struct scm_vm pointer * libguile/vm.h (scm_the_vm): Return struct scm_vm*. (scm_c_vm_run): Remove. * libguile/control.c: * libguile/eval.c: * libguile/throw.c: * libguile/vm.c: Adapt. 2013-11-21 Andy Wingo Prefer scm_call_n to scm_c_vm_run (scm_the_vm()) * libguile/vm.c (scm_i_capture_current_stack): Cosmetic tweak. (scm_call_n): Define here instead of in eval.c. All callers of scm_c_vm_run were passing scm_the_vm() as the VM. Eventually scm_call_n will replace scm_c_vm_run. * libguile/eval.c: Adapt all callers. 2013-11-21 Andy Wingo scm_i_prompt_pop_abort_args_x takes struct scm_vm* as arg * libguile/control.h: * libguile/control.c (scm_i_prompt_pop_abort_args_x): Change to take VP as an arg, not VM. * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Adapt. 2013-11-21 Andy Wingo Engine takes struct scm_vm* as argument * libguile/vm-engine.c: * libguile/vm.c (scm_c_vm_run): VM engine now takes struct scm_vm* as argument, not SCM vm. 2013-11-21 Andy Wingo One more SCM vm user: continuations. * libguile/continuations.c: * libguile/continuations.h (struct scm_t_contregs): Rename SCM vm member to struct scm_vm *vp. (scm_i_make_continuation): Take vp instead of vm. (scm_i_contregs_vp): Rename from scm_i_contregs_vm, return vp. * libguile/vm-engine.c (continuation-call, call/cc): Fix remaining SCM vm user. * libguile/vm.c (vm_return_to_continuation): Adapt prototype. 2013-11-21 Andy Wingo Remove last use of SCM vm in VM * libguile/control.h: * libguile/control.c (reify_partial_continuation, scm_c_abort): Take struct scm_vm *vp as an arg. * libguile/dynstack.h: Remove control.h include. * libguile/vm.c (vm_abort): Take struct scm_vm *vp as an arg. * libguile/vm-engine.c (abort): Adapt to vm_abort change. 2013-11-21 Andy Wingo Remove use of SCM vm in compose-continuation * libguile/vm.c (vm_reinstate_partial_continuation): Take struct scm_vm argument instead of SCM. * libguile/vm-engine.c (compose-continuation): Adapt. Dispatch hooks use "vp" rather than "vm" * libguile/vm.c (vm_dispatch_hook): (vm_dispatch_apply_hook): (vm_dispatch_push_continuation_hook): (vm_dispatch_pop_continuation_hook): (vm_dispatch_next_hook): (vm_dispatch_abort_hook): (vm_dispatch_restore_continuation_hook): Use scm_vm pointer instead of Scheme vm object. 2013-11-21 Andy Wingo Heap frame "stack holders" are raw scm_vm / scm_vm_cont pointers * libguile/frames.h (struct scm_frame): stack_holder is a void*. * libguile/frames.c (scm_i_frame_stack_base, scm_i_frame_offset): Expect stack_holder to be the raw struct scm_vm or scm_vm_cont. * libguile/continuations.c (scm_i_continuation_to_frame): * libguile/stacks.c (scm_make_stack) * libguile/vm.c (vm_dispatch_hook): Adapt creators. 2013-11-21 Andy Wingo Heap frames have a "frame kind" bit * libguile/frames.h (enum scm_vm_frame_kind, SCM_VM_FRAME_KIND) (scm_c_make_frame): Add a "frame kind" bit to the first word. This will allow the "stack holder" to be a non-SCM object. * libguile/continuations.c (scm_i_continuation_to_frame): * libguile/frames.c (scm_c_make_frame, scm_frame_previous) * libguile/stacks.c (scm_make_stack): * libguile/vm.c (vm_dispatch_hook): Adapt frame creators to set the frame kind bit. 2013-11-21 Andy Wingo The dynamic stack records SP and FP values as offsets * libguile/dynstack.h: * libguile/dynstack.c (PROMPT_FP, PROMPT_SP): (scm_dynstack_push_prompt, scm_dynstack_find_prompt): Prompts on the dynstack are recorded as offsets from the base stack address in this thread. * libguile/control.c (scm_c_abort): * libguile/eval.c (eval): * libguile/stacks.c (find_prompt, narrow_stack): * libguile/throw.c (pre_init_catch): * libguile/vm-engine.c (prompt): Adapt. 2013-11-21 Andy Wingo Reorder struct scm_vm fields. * libguile/vm.h (struct scm_vm): Reorder fields, perhaps for better locality. 2013-11-21 Andy Wingo No more VM objects visible to Scheme * libguile/vm.h: * libguile/vm.c (scm_the_vm): Don't expose to Scheme. (scm_vm_p): Remove, as it is not needed. * module/system/vm/vm.scm: Remove the-vm and vm? exports. * doc/ref/api-coverage.texi (Code Coverage): * test-suite/tests/coverage.test: * module/system/vm/coverage.scm (with-code-coverage): Don't take a VM argument. Adapt documentation and tests. * module/ice-9/command-line.scm: Remove the-vm autoload. * module/system/vm/trace.scm (trace-calls-to-procedure): (trace-calls-in-procedure): (trace-instructions-in-procedure): (call-with-trace): Remove #:vm kwarg, and adapt to trap changes. * module/system/vm/trap-state.scm (the-trap-state): Rework to use a parameter underneath instead of a weak key on (the-vm). * module/system/vm/traps.scm (new-disabled-trap): (new-enabled-trap): Remove vm argument. (trap-at-procedure-call): (trap-in-procedure): (trap-instructions-in-procedure): (trap-at-procedure-ip-in-range): (trap-at-source-location): (trap-frame-finish): (trap-in-dynamic-extent): (trap-calls-in-dynamic-extent): (trap-instructions-in-dynamic-extent): (trap-calls-to-procedure): (trap-matching-instructions): Remove vm keyword arguments. * test-suite/tests/control.test ("unwind"): Adapt test. * test-suite/tests/eval.test (test-suite): Remove the-vm import. 2013-11-21 Andy Wingo VM accessors take VM as implicit argument, not explicit argument * libguile/vm.h: * libguile/vm.c: (scm_vm_apply_hook, scm_vm_push_continuation_hook, scm_vm_pop_continuation_hook, scm_vm_abort_continuation_hook, scm_vm_restore_continuation_hook, scm_vm_next_hook, scm_vm_trace_level, scm_set_vm_trace_level_x, scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): The VM argument is now implicit: the VM for the current thread. * doc/ref/api-debug.texi (VM Hooks): Try to adapt. * module/ice-9/command-line.scm: * module/statprof.scm: * module/system/vm/coverage.scm: * module/system/vm/trace.scm: * module/system/vm/trap-state.scm: * module/system/vm/traps.scm: * test-suite/tests/control.test: * test-suite/tests/eval.test: Adapt users that set hooks or ensure that we have a debug engine. 2013-11-21 Andy Wingo Change eval.c to use scm_c_vm_run instead of scm_call_with_vm. * libguile/eval.c (scm_apply_0, scm_apply_1, scm_apply_2, scm_apply_3) (scm_map, scm_for_each, scm_apply): Change to prefer scm_apply_0, and to have it call vm_run instead of call_with_vm. (eval): Use scm_apply_0 and scm_call_0. * libguile/srfi-1.c (scm_srfi1_count): Use scm_apply_0. 2013-11-21 Andy Wingo Remove unused vm:ip, vm:sp, vm:fp * libguile/vm.h: * libguile/vm.c (scm_vm_ip, scm_vm_fp, scm_vm_sp): Remove unused functions. * module/system/vm/vm.scm: Remove exports. 2013-11-21 Andy Wingo Remove make-vm; there will be one vm per thread now. * libguile/vm.h: * libguile/vm.c (scm_make_vm): Remove. * module/system/vm/vm.scm: Remove make-vm export. * test-suite/tests/control.test ("the-vm"): * test-suite/tests/coverage.test (%test-vm): * test-suite/tests/eval.test ("stack overflow"): Adapt tests. 2013-11-21 Andy Wingo Scheme frame objects hold relative stack offsets * libguile/frames.h: Wrap the C interface to VM frames in BUILDING_LIBGUILE. Change VM frames to record relative offsets into a stack held by some other object, so that if the stack moves they will remain valid. * libguile/frames.c (scm_c_make_frame): Remove offset argument. (scm_i_frame_offset): Instead, compute the offset from the stack holder. (scm_i_frame_stack_base): New helper. (scm_frame_previous): Adapt. * libguile/stacks.c (scm_make_stack) * libguile/vm.c (vm_dispatch_hook): * libguile/continuations.c (scm_i_continuation_to_frame): Adapt. 2013-11-21 Andy Wingo Prepare for moveable stacks in the VM. * libguile/vm-engine.c (CHECK_OVERFLOW, ALLOC_FRAME, vm_engine): Prepare for moveable stacks. CHECK_OVERFLOW tweak * libguile/vm-engine.c (CHECK_OVERFLOW): Now that we aren't checking for overflow on every push, fetch the stack limit from the vm instead of a local. 2013-11-20 Andy Wingo Fix standalone tests * test-suite/vm/run-vm-tests.scm: Fix for objcode -> loader rename. vm-engine cosmetic cleanup * libguile/vm-engine.c: Reindent UNPACK macros. Remove unused resolve_variable helper * libguile/vm.c (resolve_variable): Remove unused helper. 2013-11-19 Andy Wingo Rework hook dispatch mechanism * libguile/vm-engine.c (RUN_HOOK, RUN_HOOK0, RUN_HOOK1): Rework to dispatch through specific per-hook procedures. Might reduce register pressure in the VM. * libguile/vm.c (vm_dispatch_apply_hook): (vm_dispatch_push_continuation_hook): (vm_dispatch_pop_continuation_hook): (vm_dispatch_next_hook): (vm_dispatch_abort_hook): (vm_dispatch_restore_continuation_hook): New internal helpers. 2013-11-19 Andy Wingo Remove VM_ENABLE_STACK_NULLING * libguile/vm.c: Remove code dependent on VM_ENABLE_STACK_NULLING. This defined didn't work and doesn't apply to the RTL model. 2013-11-19 Andy Wingo Rename objcodes?.{scm,c,h} to loader.{scm,c,h} * libguile/loader.c: * libguile/loader.h: Rename from objcodes.[ch]. * module/system/vm/loader.scm: Rename from objcode.scm. * libguile/Makefile.am: * libguile/gsubr.c: * libguile/init.c: * libguile/procs.c: * libguile/vm.c: * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/rtl/spec.scm: * module/system/base/target.scm: * module/system/repl/command.scm: * module/system/repl/common.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/objcode.scm: * test-suite/tests/compiler.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: Adapt. 2013-11-19 Andy Wingo Remove (oop goops) export * module/oop/goops.scm (oop): Remove objcode export. Fix gsubr comment * libguile/gsubr.c: Update comment to excise RTL. 2013-11-19 Andy Wingo Lingering RTL excision in vm.c * libguile/vm-engine.c: * libguile/vm.c: Rework VM inclusion so that we don't define VM_ENGINE and expect vm-engine.c to understand that -- since there is only VM_USE_HOOKS, define that in vm.c directly. Rename rtl_vm_foo to vm_foo. * libguile/vm.h: Remove scm_t_vm_engine typedef. 2013-11-19 Andy Wingo Move RTL unpack macros to vm-engine.c * libguile/instructions.h: Remove SCM_UNPACK macros from here. * libguile/vm-engine.c: Add them here, without the RTL_, and without the SCM_ prefix. 2013-11-19 Andy Wingo Change SCM_PACK_RTL macros to SCM_PACK_OP / SCM_PACK_OP_ARG * libguile/instructions.h: Guard in BUILDING_LIBGUILE. (SCM_PACK_OP_24): (SCM_PACK_OP_8_8_8): (SCM_PACK_OP_8_16): (SCM_PACK_OP_16_8): (SCM_PACK_OP_12_12): Rename from SCM_PACK_RTL_*, and splice in the opcode. (SCM_PACK_OP_ARG_8_24): New helper. * libguile/vm.c: * libguile/gsubr.c: * libguile/foreign.c: * libguile/control.c: * libguile/continuations.c: Adapt. 2013-11-19 Andy Wingo scm_rtl_op_* -> scm_op_* * libguile/instructions.h (scm_opcode): Rename from scm_rtl_opcode. Rename opcodes from scm_rtl_op_* to scm_op_*. * libguile/continuations.c: * libguile/control.c: * libguile/foreign.c: * libguile/gsubr.c: * libguile/instructions.c: * libguile/vm.c: Adapt. 2013-11-19 Andy Wingo (system vm instruction) rtl-instruction-list -> (language rtl) instruction-list * libguile/instructions.c (struct scm_instruction, fetch_instruction_table) (scm_instruction_list): Remove rtl_ infix. * libguile/instructions.h: Adapt. * module/system/vm/instruction.scm: Remove. * module/language/rtl.scm: Export instruction-list from here. * module/Makefile.am: * module/language/cps/primitives.scm: * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm: * module/system/vm/frame.scm: * module/system/vm/program.scm: * module/system/vm/trace.scm: * module/system/vm/traps.scm: Adapt. 2013-11-19 Andy Wingo Internal RTL excision in vm.c * libguile/vm.c (vm_boot_continuation, vm_boot_continuation_code): Rename from rtl_boot_continuation[_code]. (scm_bootstrap_vm): * libguile/vm-engine.c (rtl_vm_engine): Adapt. Small comment fix. * libguile/vm-builtins.h: Rename RTL to VM in a comment. Rename DT_GUILE_VM_VERSION. * libguile/objcodes.c (DT_GUILE_VM_VERSION, process_dynamic_segment): * module/system/vm/elf.scm (DT_GUILE_VM_VERSION): Rename from DT_GUILE_RTL_VERSION. * module/system/vm/assembler.scm (link-dynamic-section): Adapt. 2013-11-19 Andy Wingo Rename internal rtl-program-properties -> program-properties * module/system/vm/program.scm (program-properties): Rename from rtl-program-properties. * libguile/programs.c (scm_i_program_properties): Adapt. 2013-11-19 Andy Wingo Excise "rtl-" from fallback program printer * libguile/programs.c (scm_i_program_print): Fallback printer uses "program", not "rtl-program". 2013-11-19 Andy Wingo Rename internals of (system vm program) program-minimum-arity * module/system/vm/debug.scm (find-program-minimum-arity): Rename from program-minimum-arity. * module/system/vm/program.scm (program-minimum-arity): Rename from rtl-program-minimum-arity. * libguile/programs.c (scm_i_program_arity): Adapt. 2013-11-19 Andy Wingo Rename (system vm program) internal functions to remove rtl- * module/system/vm/program.scm (program-name) (program-documentation): Rename (removing rtl-). * libguile/programs.c (scm_i_program_name): (scm_i_program_documentation): Adapt callers. Remove unused C scm_program_source. * libguile/programs.c (scm_program_source): Remove; not called. (The definition is in Scheme.) Reorganize programs.h. * libguile/programs.h: Reorganize. 2013-11-19 Andy Wingo rtl-program-code -> program-code * libguile/programs.h: * libguile/programs.c (scm_program_code): Rename from scm_rtl_program_code. Also renames rtl-program-code to program-code. * module/statprof.scm: * module/system/repl/command.scm: * module/system/repl/debug.scm: * module/system/vm/coverage.scm: * module/system/vm/disassembler.scm: * module/system/vm/program.scm: * module/system/vm/traps.scm: * test-suite/tests/dwarf.test: * test-suite/tests/rtl.test: Adapt callers. 2013-11-19 Andy Wingo rtl-program? -> program? * libguile/programs.c (scm_program_p): Rename from scm_rtl_program_p. Changes name also from rtl-program? to program?. * libguile/programs.h: * module/ice-9/session.scm: * module/language/tree-il/analyze.scm: * module/statprof.scm: * module/system/repl/command.scm: * module/system/repl/debug.scm: * module/system/vm/coverage.scm: * module/system/vm/disassembler.scm: * module/system/vm/frame.scm: * module/system/vm/program.scm: * module/system/vm/traps.scm: * module/system/xref.scm: Adapt. 2013-11-19 Andy Wingo Remove make-rtl-program. * libguile/programs.h: * libguile/programs.c (scm_make_rtl_program): Remove. Unused. * module/system/vm/program.scm (system): Remove make-rtl-program export. Unused. 2013-11-19 Andy Wingo scm_i_rtl_program_* -> scm_i_program_* * libguile/programs.h (scm_i_make_program): * libguile/programs.c (scm_i_program_name): (scm_i_program_documentation): (scm_i_program_properties): Remove "rtl_" infix. * libguile/objcodes.c: * libguile/procprop.c: * libguile/vm.c: Adapt callers. 2013-11-19 Andy Wingo scm_i_make_rtl_program in BUILDING_LIBGUILE * libguile/programs.h (scm_i_make_rtl_program): Enclose in a BUILDING_LIBGUILE guard. 2013-11-19 Andy Wingo Remove RTL_ infix from macros * libguile/programs.h (SCM_PROGRAM_P): (SCM_PROGRAM_CODE): (SCM_PROGRAM_FREE_VARIABLES): (SCM_PROGRAM_FREE_VARIABLE_REF): (SCM_PROGRAM_FREE_VARIABLE_SET): (SCM_PROGRAM_NUM_FREE_VARIABLES): (SCM_VALIDATE_PROGRAM): Remove RTL_ infix. * libguile/continuations.c: * libguile/continuations.h: * libguile/control.c: * libguile/foreign.c: * libguile/frames.c: * libguile/gsubr.c: * libguile/gsubr.h: * libguile/procprop.c: * libguile/procs.c: * libguile/programs.c: * libguile/stacks.c: * libguile/vm-engine.c: Adapt. 2013-11-19 Andy Wingo Rename scm_tc7_rtl_program to scm_tc7_program * libguile/tags.h (scm_tc7_program): Rename from scm_tc7_rtl_program. * libguile/continuations.c: * libguile/control.c: * libguile/evalext.c: * libguile/foreign.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/print.c: * libguile/programs.c: * libguile/programs.h: * libguile/vm-engine.c: Adapt users. * module/system/vm/assembler.scm: Rename a tc7-rtl-program local to tc7-program. * libguile/tags.h (scm_tc7_program): Rename from scm_tc7_rtl_program. * libguile/continuations.c: * libguile/control.c: * libguile/evalext.c: * libguile/foreign.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/print.c: * libguile/programs.c: * libguile/programs.h: * libguile/vm-engine.c: Adapt users. * module/system/vm/assembler.scm: Rename a tc7-rtl-program local to tc7-program. 2013-11-19 Andy Wingo All instruction pointers are now scm_t_uint32* * libguile/frames.h (SCM_FRAME_RTL_RETURN_ADDRESS) (SCM_FRAME_SET_RTL_RETURN_ADDRESS): Remove. The variants without _RTL now work fine. (struct scm_vm_frame): Change the return address to be a scm_t_uint32*. (struct scm_frame): Change IP to be scm_t_uint32*. * libguile/frames.c (scm_c_make_frame) * libguile/control.c (reify_partial_continuation, scm_c_abort) * libguile/dynstack.c (PROMPT_IP) (scm_dynstack_push_prompt, scm_dynstack_find_prompt) * libguile/dynstack.h: * libguile/vm-engine.c (SYNC_IP, RETURN_ONE_VALUE) (call, return-values, prompt): Adapt. 2013-11-19 Mark H Weaver Web: accept "UTC" as the zone offset in date headers. Fixes . Reported by Aleix Conchillo Flaqué . * module/web/http.scm (parse-zone-offset): Accept "UTC". 2013-11-19 Mark H Weaver THANKS David Thompson * THANKS: Add David Thompson to list of contributors. 2013-11-19 David Thompson Add procedures to convert alists into hash tables. * module/ice-9/hash-table.scm: New module. * test-suite/tests/hash.test ("alist conversion"): Add tests. * doc/ref/api-compound.texi (Hash Table Reference): Add docs. 2013-11-18 Mark H Weaver Convert guile exceptions to R6RS conditions in R6RS exception handlers. * module/rnrs/exceptions.scm (&guile): New condition type. (guile-condition-converters): New variable. (convert-guile-condition, default-guile-condition-converter, set-guile-condition-converter!, guile-common-conditions, guile-lexical-violation-converter, guile-syntax-violation-converter, guile-assertion-violation-converter, guile-system-error-converter, guile-undefined-violation-converter, guile-error-converter, guile-implementation-restriction-converter): New procedures. (with-exception-handler): Catch all exceptions, not just R6RS exceptions. Convert native Guile exceptions to R6RS conditions, preserving the original Guile exception information in the &guile condition object. (raise): If the condition includes a &guile condition, use 'throw' to throw the original native guile exception instead of raising an R6RS exception. * test-suite/tests/r6rs-exceptions.test ("guile condition conversions"): Add tests. 2013-11-18 Mark H Weaver Improve error when 'include' form with relative path is not in a file. Reported by Nala Ginrut . * module/ice-9/psyntax.scm (include): Give a proper error message when given a relative file name, and when the form is not in a file. * module/ice-9/psyntax-pp.scm: Regenerate. 2013-11-17 Andy Wingo Frame pointer points to local 0 instead of local 1 * libguile/frames.h: Change so that fp points at local 0 instead of local 1, and clean up a bit. (struct scm_vm_frame): Remove program, and rename stack to locals. (SCM_FRAME_DATA_ADDRESS): Remove; it was redundant with SCM_FRAME_LOWER_ADDRESS. (SCM_FRAME_STACK_ADDRESS): Remove; replace with the new SCM_FRAME_LOCALS_ADDRESS. (SCM_FRAME_UPPER_ADDRESS): Remove; unused. (SCM_FRAME_NUM_LOCALS, SCM_FRAME_PREVIOUS_SP): New defines. (SCM_FRAME_BYTE_CAST, SCM_FRAME_STACK_CAST): Remove; unused; (SCM_FRAME_LOCAL): New define, replaces SCM_FRAME_VARIABLE. (SCM_FRAME_PROGRAM): Add cautionary commentary. * libguile/frames.c: Adapt static asserts. (scm_frame_num_locals, scm_frame_local_ref, scm_frame_local_set_x): Adapt. This means that frame-local-ref 0 now returns the procedure. * libguile/vm-engine.c (ALLOC_FRAME, RESET_FRAME) (FRAME_LOCALS_COUNT, LOCAL_REF, LOCAL_SET, RETURN_VALUE_LIST): Adapt to change in fp. (LOCAL_ADDRESS): New helper. (POP_CONTINUATION_HOOK): Reimplement, taking the previous FP as an argument. (ABORT_CONTINUATION_HOOK): Reimplement, taking no arguments. (RETURN_ONE_VALUE): Reimplement. (RETURN_VALUE_LIST): Adapt to FP change. (halt, return-values, subr-call, foreign-call, prompt) (continuation-call, compose-continuation, call/cc, abort): Adapt to FP change, mostly via using LOCAL_ADDRESS, etc abstractions instead of using the raw frame pointer. * libguile/control.c (reify_partial_continuation): Update for fp change. * libguile/vm.c (vm_reinstate_partial_continuation): Adapt to removal of SCM_FRAME_UPPER_ADDRESS. * module/system/vm/frame.scm (frame-call-representation): Adapt to frame-local-ref change. * module/system/vm/trace.scm (print-return): Remove unused frame-num-locals call. 2013-11-17 Mark H Weaver Add more entries to .gitignore * .gitignore: Add /lib/poll.h, /lib/sys/select.h, /lib/sys/times.h, and /test-suite/standalone/test-scm-c-bind-keyword-arguments. 2013-11-15 Andy Wingo Remove use of SCM_CRITICAL_SECTION in smob.c * libguile/smob.c (scm_make_smob_type): Use a mutex instead of a critical section, which does an async tick. Not important, just a thing I saw. 2013-11-15 Andy Wingo Remove MVRA from VM frames * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for frame layout change. * libguile/frames.c: Update some static checks. (scm_frame_num_locals, scm_frame_local_ref, scm_frame_local_set_x): Update to not skip over uninitialized frames, as that's not a thing any more. * libguile/frames.h: Update to remove MVRA. Woo! * libguile/vm-engine.c (ALLOC_FRAME, RETURN_ONE_VALUE): (rtl_vm_engine): Update for 3 words per frame instead of 4. * libguile/vm.c (vm_return_to_continuation): Likewise. * module/language/cps/slot-allocation.scm (allocate-slots): 3 words per frame, not 4. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. Also remove a couple of tc7's that aren't around any more. 2013-11-15 Andy Wingo Remove MVRA accessors in libguile * libguile/vm.c (scm_i_vm_capture_stack): Remove MVRA argument, in preparation for removing MVRA from frames. (scm_i_capture_current_stack): Adapt to scm_i_vm_capture_stack change. (vm_reinstate_partial_continuation): Remove references to MVRA. * libguile/vm.h (struct scm_vm_cont): Remove mvra member. * libguile/vm-engine.c (call): Set MVRA to 0. Will remove later. (return-values): Return to RA. (call/cc): Remove MVRA from capture call. * libguile/frames.c: * libguile/frames.h (SCM_FRAME_MV_RETURN_ADDRESS) (SCM_FRAME_RTL_MV_RETURN_ADDRESS, scm_frame_mv_return_address): Remove accessors. * libguile/control.c (reify_partial_continuation): Adapt to scm_i_vm_capture_stack change. 2013-11-15 Andy Wingo Try to allocate arguments directly in call frames * module/language/cps/slot-allocation.scm (allocate-slots): Convert cont-table to a vector, for ease of access. Run a pass before allocation that determines the set of variables whose slot allocation can and should be delayed, so that they can ideally be allocated directly in an argument slot. 2013-11-15 Andy Wingo Rewrite slot allocation pass * module/language/cps/slot-allocation.scm ($allocation): Refactor internal format of allocations. Instead of an allocation being a hash table of small $allocation objects, it is an $allocation object that contains packed vectors. (find-first-trailing-zero): Rework to not need a maximum. (lookup-maybe-slot): New interface. (lookup-slot): Raise an error if a var has no slot. (lookup-call-allocation): New helper. (lookup-constant-value, lookup-maybe-constant-value): (lookup-call-proc-slot, lookup-parallel-moves): Adapt to $allocation change (allocate-slots): Rewrite so that instead of being recursive, it traverses the blocks in CFA order. Also, procedure call frames are now allocated with respect to the live set after using arguments (and killing any dead-after-use vars); this should make call frames more compact but it does necessitate a parallel move solution. Therefore parallel moves are recorded for all calls, for arguments; also if the continuation is a $ktrunc, the continuation gets parallel moves for the results. This rewrite is in preparation to allocating call args directly in the appropriate slots, where possible. * module/language/cps/compile-rtl.scm (compile-fun): Adapt to slot allocation changes, using lookup-maybe-slot where appropriate, performing parallel moves when calling functions, and expecting return moves to be associated with $ktrunc continuations. 2013-11-13 Andy Wingo Replace ($var sym) with ($values (sym)). * module/language/cps.scm: Remove $var. Replaced by $values with one value. * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/dfg.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt all the world. 2013-11-13 Ludovic Courtès i18n: Fix null pointer dereference when locale info is missing. * libguile/i18n.c (scm_nl_langinfo): Check whether C_RESULT is NULL before calling 'strdup'. 2013-11-10 Andy Wingo Add specialize-primcalls pass; bump objcode version. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/objcodes.c (process_dynamic_segment): Expect the minor version to be present and, while we are still banging on the VM, exactly equal to SCM_OBJCODE_MINOR_VERSION. * libguile/vm-engine.c: Renumber ops. Remove the general make-vector. Rename constant-FOO to FOO/immediate. Remove struct-ref and struct-set!, replace with struct-ref/immediate and struct-set!/immediate. * module/Makefile.am: * module/language/cps/specialize-primcalls.scm: New pass, inlines FOO to FOO/immediate -- e.g. vector-ref to vector-ref/immediate. * module/language/cps/arities.scm: Remove struct-set! case, now that there is no struct-set! opcode. * module/language/cps/compile-rtl.scm (compile-fun): Remove dispatch to constant-FOO versus FOO here -- that decision is made by specialize-primcalls. (optimize): Add specialize-primcalls pass. * module/language/cps/dfg.scm (constant-needs-allocation?): Adapt to name changes. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*primitive-constructors*): Add allocate-struct. * module/system/vm/assembler.scm (*bytecode-major-version*): (*bytecode-minor-version*, link-dynamic-section): Write minor version into resulting image. 2013-11-10 Andy Wingo Effects analysis distinguishes between struct fields * module/language/tree-il/effects.scm (compile-time-cond): (define-effects): Make the effects analysis more precise, distinguishing between different kinds of mutable data. On 64-bit systems we take advantage of the additional bits to be even more precise. (make-effects-analyzer): Inline handlers for all "accessor" primitives and their corresponding mutators. * module/language/tree-il/peval.scm (peval): Reflow to remove use of the "accessor-primitive?" predicate. * module/language/tree-il/primitives.scm (accessor-primitive?): Remove. 2013-11-10 Andy Wingo Effects analysis sees match-error, throw-bad-structs as bailouts * module/language/tree-il/effects.scm (make-effects-analyzer): Allow module-ref calls to be treated as bailouts, if the procedure has the "definite-bailout?" property. Perhaps this should be renamed. * module/ice-9/match.upstream.scm (match-error): * module/srfi/srfi-9.scm (throw-bad-struct): Give these procedures the definite-bailout? property. 2013-11-09 Andy Wingo Binary search to find procedure properties. * module/system/vm/debug.scm (find-program-properties): Use binary search. Fix RTL linking of procedure properties. * module/system/vm/assembler.scm (link-procprops): Fix procedure property embedding in bytecode. Binary search to find docstrings. * module/system/vm/debug.scm (find-program-docstring): Use binary search. 2013-11-09 Andy Wingo Finding a procedure's arity uses binary search * module/system/vm/assembler.scm (pack-arity-flags): (write-arity-headers): Add a flag to indicate that an arity is part of a case-lambda, so that we can use binary search to find arities. * module/system/vm/debug.scm (is-in-case-lambda?) (arity-is-in-case-lambda?, find-first-arity): Use binary search. 2013-11-09 Andy Wingo Use binary search in find-elf-symbol * module/system/vm/debug.scm (binary-search): New helper. (find-elf-symbol): Use binary search. 2013-11-08 Andy Wingo Fix run-vm-tests * test-suite/vm/run-vm-tests.scm: Fix for RTL. 2013-11-08 Andy Wingo Remove stack programs, objcode, and the old VM. * libguile/Makefile.am: * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Remove the old VM files, and the rules to build the .i files. * libguile/vm-engine.c: * libguile/vm.c: Remove the old VM. Woot! * libguile/_scm.h (SCM_OBJCODE_COOKIE, SCM_OBJCODE_ENDIANNESS_OFFSET) (SCM_OBJCODE_WORD_SIZE_OFFSET): Remove. * libguile/evalext.c (scm_self_evaluating_p): Remove objcode and program cases. * libguile/frames.c (scm_frame_num_locals, scm_frame_previous): Remove program cases. * libguile/gc.c (scm_i_tag_name): Remove objcode case. * libguile/goops.c (scm_class_of, create_standard_classes): Remove objcode and program cases. * libguile/instructions.h: * libguile/instructions.c (scm_instruction_list, scm_instruction_p) (scm_instruction_length, scm_instruction_pops, scm_instruction_pushes) (scm_instruction_to_opcode, scm_opcode_to_instruction): Remove old VM code. * libguile/objcodes.h: * libguile/objcodes.c: Remove the objcode data type, and handling for objcode files. * libguile/print.c: Remove objcode and program printers. * libguile/procprop.c: Remove program cases. * libguile/procs.c: * libguile/programs.h: * libguile/programs.c: Remove old program code. * libguile/smob.c: Remove objcodes include. * libguile/snarf.h: Remove static program defines. * libguile/stacks.c: Remove program case. * libguile/tags.h: Remove program and objcode tc7s. * module/ice-9/session.scm (procedure-arguments) * module/language/tree-il/analyze.scm (validate-arity) * module/statprof.scm (get-call-data, procedure=?) * module/system/vm/frame.scm (frame-bindings) (frame-call-representation): Remove old program cases. * module/system/repl/debug.scm (frame->module): Add a FIXME. * module/system/vm/instruction.scm: Remove old exports. * module/system/vm/program.scm: Remove old program code. 2013-11-08 Andy Wingo Miscellaneous fixups related to objcode removal. * module/scripts/compile.scm: Fix --help message. * module/system/repl/command.scm (disassemble): Fix error message. * module/system/vm/frame.scm: Remove objcode import. * module/system/vm/objcode.scm: Remove some exports related to the objcode type. 2013-11-08 Andy Wingo Remove program-sources-pre-retire case for stack programs. * module/system/vm/program.scm (program-sources-pre-retire): Remove stack program case. Remove (language objcode) * module/language/objcode.scm: Remove. Seems to have been unused. Move assemble-program to test cases. * module/system/vm/assembler.scm (assemble-program): Remove. * test-suite/tests/rtl.test (assemble-program): Move here. Per-instruction tracing doesn't try to disassemble stack VM code * module/system/vm/trace.scm (trace-instructions-in-procedure): Don't try to disassemble the procedure, for now. 2013-11-08 Andy Wingo (system vm traps) support for rtl programs * module/system/vm/debug.scm: Export program-debug-info-size. * module/system/vm/traps.scm (frame-matcher): Remove stack program case. Use absolute frame-instruction-procedure to match if match-code?. (program-last-ip): Use (system vm debug) interfaces. (program-sources-by-line): Use program-sources, as program-sources-pre-retire will go away soon. Return absolute addresses. 2013-11-08 Andy Wingo Remove objcode language. * module/language/objcode/elf.scm: * module/language/objcode/spec.scm: Remove objcode language. * module/Makefile.am: Adapt. 2013-11-08 Andy Wingo Remove bytecode language. * module/language/bytecode/spec.scm: Remove. * module/Makefile.am: Adapt. 2013-11-08 Andy Wingo Remove assembly language. * module/system/repl/command.scm: Remove disassembly cases for stack procedures. * module/system/vm/inspect.scm: Adapt to disassemble RTL programs. * module/language/assembly.scm: * module/language/assembly/compile-bytecode.scm: * module/language/assembly/decompile-bytecode.scm: * module/language/assembly/disassemble.scm: * module/language/assembly/spec.scm: Remove assembly language. * module/Makefile.am: Adapt. 2013-11-08 Andy Wingo Decompile goes from tree-il to scheme by default. * module/system/base/compile.scm (decompile): By default, go from tree-il to Scheme, now that the assembly language is going away. Rewrite (system xref) to work with RTL programs * module/system/xref.scm (nested-procedures): New helper. (program-callee-rev-vars): Rewrite using fold-program-code and nested-procedures. (add-sources, forget-sources): Use match instead of pmatch. Use nested-procedures. Add fold-program-code to (system vm disassembler) * module/system/vm/disassembler.scm (fold-code-range): New helper. (fold-program-code): New interface. Remove GLIL language * module/Makefile.am: * module/language/glil.scm: * module/language/glil/compile-assembly.scm: * module/language/glil/spec.scm: Remove. 2013-11-08 Andy Wingo Remove tree-il->glil compiler * module/Makefile.am: * module/language/tree-il/compile-glil.scm: Remove. * module/language/tree-il/spec.scm: Remove tree-il->glil link. 2013-11-08 Andy Wingo Move useful parts of asm-to-bytecode.test to cross-compilation.test * test-suite/tests/cross-compilation.test: Rename from asm-to-bytecode, and remove the bits testing assembly->bytecode but keep the cross-compilation things. * test-suite/Makefile.am: Adapt. 2013-11-08 Andy Wingo Tree-IL warnings tests compile to CPS instead of "assembly" * test-suite/tests/tree-il.test ("warnings"): Change warnings test to compile to CPS instead of assembly. Remove tree-il->glil test cases * test-suite/tests/tree-il.test: Remove GLIL test cases. They have never been helpful to me in the 2.0 series, so there is no loss. Remove a couple of uses of GLIL from the test suite. * test-suite/tests/cse.test ("cse"): * test-suite/tests/peval.test: Remove uses of GLIL. Fix program-minimum-arity to work better with case-lambda. * module/system/vm/debug.scm (program-minimum-arity): Be more precise with case-lambdas. 2013-11-08 Andy Wingo Builtins have procedure properties * libguile/vm-builtins.h (FOR_EACH_VM_BUILTIN): Add arity information. (enum scm_vm_builtins): * libguile/vm.c (scm_vm_builtin_ref): (scm_vm_builtin_name_to_index): (scm_vm_builtin_index_to_name): Adapt to macro interface change. (scm_init_vm_builtin_properties): New helper, sets procedure properties on builtins. (scm_bootstrap_vm): Just define the builtins here. Later in the bootstrap we set their properties. (scm_sym_apply): Move definition here from expand.c. * libguile/procprop.c (scm_init_procprop): Call scm_init_vm_builtin_properties. 2013-11-08 Andy Wingo Fix procedure-arguments on RTL programs, and tweak session.test * module/ice-9/session.scm (procedure-arguments): Add an rtl-program? case. * module/system/vm/debug.scm (arity-arguments-alist): Use the order that session.test expects. * test-suite/tests/session.test ("procedure-arguments"): Adapt tests with keywords for the new starting-with-the-procedure numbering of locals. 2013-11-08 Andy Wingo Fix make-vector peval test * test-suite/tests/peval.test ("partial evaluation"): Fix to expect a primcall. Fix case-lambda* dispatching to agree with manual. * module/system/vm/assembler.scm (kw-prelude): Emit br-if-npos-gt as appropriate. Add br-if-npos-gt * libguile/vm-engine.c (br-if-npos-gt): New instruction (sigh!). For case-lambda* dispatching on the number of positional args, as the manual describes. Renumber other opcodes. Fix BR_NARGS data type width * libguile/vm-engine.c (BR_NARGS): Fix width of "expected". Fixes bug with > 65536 arguments in case-lambda clauses. Fix arity selection in compute-contification * module/language/cps/contification.scm (compute-contification): Fail as soon as we see an arity with rest, optional, or keyword arguments. Fixes ((case-lambda ((a . b) #t) ((a b) #f)) 1 2). Fix error message in lambda* eval closures with keywords * module/ice-9/eval.scm (primitive-eval): For ((lambda* (#:key foo) foo) 'bar), give an "invalid keyword" error instead of a "wrong number of arguments" error. 2013-11-08 Andy Wingo Fix reading and writing arities into DWARF. * libguile/gsubr.h: * libguile/gsubr.c (scm_i_primitive_call_ip): * libguile/programs.c (scm_primitive_call_ip): Adapt to return an absolute address. * module/system/vm/assembler.scm (write-arity-headers): Adapt to write byte addresses (relative to the text base). * module/system/vm/debug.scm (arity-low-pc, arity-high-pc): Return absolute addresses, instead of word offsets relative to the text base. (find-first-arity): Adapt for absolute addresses. * module/system/vm/program.scm (program-arguments-alist): Adapt for arity-low-pc / arity-high-pc absolute addresses. 2013-11-08 Andy Wingo Fix eval.test: stack involving a primitive * test-suite/tests/eval.test ("stacks"): Revert expect-fail introduced in 27337b6373954e1a975d97d0bf06b5c03d65b64d. Fix coverage.test: instrumented-source-files * test-suite/tests/coverage.test ("instrumented-source-files"): Adapt to new expectation that all files loaded on the system will be present in the source information. Fix coverage.test: "procedure-execution-count: never" * test-suite/tests/coverage.test ("procedure-execution-count"): Adapt test to new behavior of procedure-execution-count of an unseen procedure: zero, not false. Fix coverage.test: "line-execution-counts: one proc hit, one proc unused" * test-suite/tests/coverage.test ("line-execution-counts"): Fix test for even/odd? in letrec. The test profiles the execution of even?, not the letrec, so the last line is in fact not reached. 2013-11-07 Andy Wingo frame-instruction-pointer is absolute; rewrite (system vm coverage) * libguile/frames.c (scm_frame_source): Instead of assuming that scm_frame_procedure is correct, use the IP to get the source. (scm_frame_instruction_pointer): Return an absolute value instead of assuming that slot 0 is correct. (It isn't, when preparing for a tail call.) * libguile/programs.h: * libguile/programs.c (scm_find_source_for_addr): New internal helper. * module/system/repl/debug.scm (print-registers): Readably print absolute instruction pointers. * module/system/vm/coverage.scm: Complete rewrite to use absolute IP's. We can't assume that frame-procedure is cheap if it is correct, or correct if it is cheap. Anyway using the address is better anyway. (coverage-data->lcov): Disable per-function info temporarily. (loaded-modules, module-procedures, closest-source-line) (closed-over-procedures): Remove these. Instead of going from procedures to source info, now we go from ELF image to source info. * module/system/vm/debug.scm (debug-context-length): New interface. * module/system/vm/program.scm (source-for-addr): New internal helper. 2013-11-07 Andy Wingo scm_from_uintptr_t / scm_from_ptrdiff_t usage * libguile/frames.c: * libguile/programs.c: Use scm_from_ptrdiff_t and scm_from_uintptr_t where appropriate. 2013-11-07 Andy Wingo Program sources are always pre-retire now * module/system/repl/debug.scm (): Remove for-trap?. Backtraces with RTL will always happen pre-retire on the top frame, source info is pre-retire, and continuations will always have a source-marked receive or receive-values or whatever with the right source marking, so we can remove this complication. (print-frame): Use frame-source. (print-frames): Remove for-trap? kw. * module/system/repl/command.scm (define-stack-command, backtrace) (up, down, frame): Remove for-trap? introduced local, and its uses. (repl-pop-continuation-resumer): Adapt to make-debug change. * module/system/repl/error-handling.scm (call-with-error-handling): Adapt to make-debug change. * module/system/vm/frame.scm (frame-next-source): Remove. RTL sources are pre-retire. * module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Adapt to use frame-source. Still some work to do here. 2013-11-07 Andy Wingo add fold-all-debug-contexts, fold-source-locations * module/system/vm/objcode.scm: * libguile/objcodes.c (scm_all_mapped_elf_images): New proc. * module/system/vm/debug.scm (fold-all-debug-contexts): (fold-source-locations): New public interfaces. 2013-11-07 Andy Wingo Fix DWARF source test now that we have more precise source info. * test-suite/tests/dwarf.test: Fix test after the $continue/$cont source change, which reifies proper source info for the +. Fix line advance DWARF opcodes when line advance is exactly 128 * module/system/vm/assembler.scm (link-debug): Fix off-by-one error in which forward jumps of 128 were mis-rendered. Write DWARF files list in correct order. * module/system/vm/assembler.scm (link-debug): Fix order of writing the source files list; it was being written backwards. 2013-11-07 Andy Wingo Source information goes on the $continue, not the $cont. * module/language/cps.scm ($continue, $cont): Put source information on the $continue, not on the $cont. Otherwise it is difficult for CPS conversion to preserve source information. ($fun): Add a src member to $fun. Otherwise we might miss the source info for the start of the function. * .dir-locals.el: * module/language/cps/arities.scm: * module/language/cps/closure-conversion.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/constructors.scm: * module/language/cps/contification.scm: * module/language/cps/dfg.scm: * module/language/cps/elide-values.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Update the whole CPS world for this change. 2013-11-06 Andy Wingo Fix first find-program-sources result * module/system/vm/debug.scm (find-program-sources): Manually set the pc of the first result in a function. 2013-11-05 Andy Wingo compiler.test fix for rtl compilation * test-suite/tests/compiler.test ("current-reader"): Fix the way we make programs from objcode. fix docstring assembly and fetching * module/system/vm/assembler.scm (link-docstrs): Write pc offsets as byte addresses. Works better with native code. * module/system/vm/debug.scm (find-program-docstring): Fix the linear search. How embarassing! asm-labels is a hash table * module/system/vm/assembler.scm (make-assembler, label): (link-data, process-relocs, process-labels): Change labels to be a hash table. fix make-long-immediate, make-long-long-immediate for dst >= 256 * libguile/vm-engine.c (make-long-immediate, make-long-long-immediate): Fix declaration of "dst" variable. Re-add the list hack to compile-cps * module/language/tree-il/compile-cps.scm (convert): Re-add the list hack. Ideally these go into some tree-il pass. squish to primitive reification * test-suite/tests/tree-il.test: Update for primitive-ref reification fix. 2013-11-05 Mark H Weaver Don't use the identifier 'noreturn'. Fixes . Reported by Matt Sicker . * libguile/__scm.h (SCM_NORETURN): Use ((__noreturn__)) instead of ((noreturn)). * libguile/throw.h (scm_ithrow): Rename formal parameter from 'noreturn' to 'no_return'. * libguile/throw.c (scm_ithrow): Rename formal parameter from 'noreturn' to 'no_return'. 2013-11-03 Andy Wingo Fix test case for uniform-array->bytevector on bitvectors * test-suite/tests/bytevectors.test ("uniform-array->bytevector"): Bitvectors are accessed in 32-bit chunks. 2013-11-03 Andy Wingo RTL compiler supports static bitvectors * libguile/arrays.c (scm_from_contiguous_typed_array): * libguile/bytevectors.c (scm_uniform_array_to_bytevector): For bitvectors, round up the length to 32-bit units, as they are stored internally. Otherwise I think this probably does the wrong thing for the last word on big-endian systems. * libguile/bitvectors.c (BITVECTOR_LENGTH, BITVECTOR_BITS): (scm_c_make_bitvector): Reorder the length and pointer words to match the layout of bytevectors. * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/system/vm/assembler.scm (br-if-bitvector): * module/system/vm/disassembler.scm (code-annotation): Add bitvector test support. * module/system/vm/assembler.scm (): Add an element-size field. (intern-constant): Adapt make-uniform-vector-backing-store call. Use uniform-array->bytevector, as the old compiler did. (link-data): Add bitvector cases. 2013-11-03 Andy Wingo struct-set! returns a value, yuck * module/language/cps/arities.scm (fix-clause-arities): Add a hack to ensure that (struct-set! OBJ POS VAL) evaluates to VAL. Yuck. Correctness fix for vector constructor inlining. * module/language/tree-il/compile-cps.scm (convert): Don't inline the vector constructor if any arg could capture the current continuation. Eval evaluates initializers before creating environment ribs. * module/ice-9/eval.scm (let-env-evaluator, primitive-eval): Evaluate initializers of let expressions before creating the environment rib. This prevents call/cc-related shenanigans. "length" is an interesting primitive * module/language/tree-il/primitives.scm (*effect-free-primitives*): (*interesting-primitive-names*): Add "length", so that we can constant-fold it. 2013-11-01 Andy Wingo Revert "Compile-time debugging" This reverts commit 6a37b7faaf150e9fb7945ef79969cb7671d17367. Fix call/cc with the RTL VM * libguile/vm.c (vm_return_to_continuation): The RTL VM saves the registers for the caller of call/cc, but the caller will expect values in the normal MV return location: above the frame. Make it so, number four! Fix order of evaluation in elisp lexer * module/language/elisp/lexer.scm (lex): Use let*, to ensure that the port position is read before reading the next char. Fix contification of non-recursive closures * module/language/cps/contification.scm (compute-contification): When eliding let-bound functions, also record the cont that declares the function. (apply-contification): Instead of reifying ($values ()) gotos instead of the elided function, inline the body that binds the function directly. This ensures that the function gets contified in its own scope. 2013-11-01 Andy Wingo RTL compilation sorts continuations topologically before visiting them * module/language/cps/compile-rtl.scm (compile-fun): Rewrite to visit conts in reverse-post-order, which is a topological sort on the basic blocks. * module/language/cps/slot-allocation.scm (allocate-slots): Expect a DFG as an argument. 2013-11-01 Andy Wingo Failed match errors generate less code * module/ice-9/match.upstream.scm (match-next): Call out to an external procedure on error, and use a begin instead of double-parens. This results in less generated code. Add compile-cps hack for vectors * module/language/tree-il/compile-cps.scm (convert): Add a special case for "vector" primcalls. Boo! 2013-10-31 Andy Wingo Better range checks in the assembler * module/system/vm/assembler.scm (pack-u8-u24, pack-u8-s24): (pack-u1-u7-u24, pack-u8-u12-u12, pack-u8-u8-u16, pack-u8-u8-u8-u8): Prevent adjacent fields from stompling each other. 2013-10-31 Andy Wingo Be smarter about capturing the environment for memoized code * libguile/memoize.h (SCM_M_CAPTURE_MODULE) * libguile/memoize.c (MAKMEMO_CAPTURE_MODULE, capture_env): (maybe_makmemo_capture_module, memoize): Determine when to capture the module on the environment chain at compile-time, instead of at runtime. Introduces a new memoized expression type, capture-module. (scm_memoized_expression): Start memoizing with #f as the environment. (unmemoize): Add unmemoizer. (scm_memoize_variable_access_x): Cope with #f as module, and treat as the root module (captured before modules were booted). * libguile/eval.c (eval): * module/ice-9/eval.scm (primitive-eval): Adapt. 2013-10-31 Andy Wingo define! is an interesting primitive * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add define!. fix compilation of (let lp () (lp)) * module/language/cps/dfg.scm (reverse-post-order): Add an optional "fold-all-conts" argument. (compute-live-variables): Take the function as an arg instead of the start continuation, and implement fold-all-conts so that nodes that never reach the tail also get liveness information. DFG: Export analyze-control-flow. * module/language/cps/dfg.scm ($cfa, $dominator-analysis): Remove dominator things from $cfa, to break out to separate structure. (cfa-k-idx, cfa-k-count, cfa-k-sym, cfa-predecessors): New public accessors. (analyze-control-flow): New public function. (analyze-dominators): Adapt. static-patch! for pair and vector fields * module/system/vm/assembler.scm (intern-constant): Use static-patch! for fields. Better REPL support for disassembling RTL images * module/system/repl/command.scm (load-image): New helper. (compile, disassemble): Handle bytevectors. 2013-10-31 Andy Wingo Default to compiling to RTL * module/ice-9/eval-string.scm (eval-string) * module/language/tree-il/spec.scm (tree-il) * module/scripts/compile.scm (compile) * module/system/base/compile.scm (compile-file, read-and-compile) * module/system/repl/common.scm (repl-compile, repl-prepare-eval-thunk): Default to compiling to RTL. * module/language/rtl/spec.scm (rtl->value): Add value compiler. 2013-10-31 Andy Wingo Avoid calling procedure-name when doing a make-procedure-with-setter * libguile/procs.c (scm_make_procedure_with_setter): Don't set the name of the procedure. Instead rely on procedure-name to look it up from the wrapped procedure as needed. * libguile/procprop.c (scm_procedure_name): If there was no override and the procedure is a procedure-with-setter, recurse on the procedure. Better aliased primcall compilation * libguile/vm-engine.c (define!): Rename from define. * module/language/cps/arities.scm (fix-clause-arities): If a prim aliases an RTL instruction with a different name and we reify a primcall, reify the instruction name. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Update emit-define! for new name. * module/language/cps/primitives.scm (*rtl-instruction-aliases*): Add bytevector native accessors. Better compiler support for bytevector ops * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add emitters for bytevector ops. Add br-if-bytevector emitter. * module/language/cps/primitives.scm (*branching-primcall-arities*): Mark bytevector? as a branching primitive. * module/system/vm/assembler.scm (br-if-bytevector): New instruction * module/system/vm/disassembler.scm (code-annotation): Add support for bytevector?. Fix bytevector error messages. * libguile/vm-engine.c (BV_FIXABLE_INT_SET, BV_INT_SET): (BV_FLOAT_SET): Fix instruction names in error messages. 2013-10-31 Andy Wingo Support serialization of uniform vector literals * libguile/uniform.h: * libguile/uniform.c (scm_uniform_vector_element_type_code): New interface, returns a type code as an integer. * module/system/vm/assembler.scm () (simple-vector?, uniform-array?, statically-allocatable?) (intern-constant, link-data, link-constants): Support uniform arrays, and punt on vectors aren't contiguous from 0. Support for general arrays will come later. * test-suite/tests/rtl.test ("load-constant"): Add tests. 2013-10-31 Andy Wingo Compile-time debugging * module/language/cps/compile-rtl.scm: * module/language/cps/contification.scm: Add some compile-time printouts. Will be removed later. DFG: $block no longer stores control-flow analysis * module/language/cps/dfg.scm ($block): Remove dominator-related things from $block. (reverse-post-order, convert-predecessors): Be more abstract, taking arbitrary identifiers for nodes instead of assuming the nodes are continuation names. (make-block-mapping): New helper. ($cfa): New data type, for dominator and loop analysis. Not yet public. (analyze-control-flow): Rewrite to only compute the dominator tree in one direction, but take that direction as an argument. To be public once there is some code that uses it. ($dfa): Refactor function fields to be hash tables. (dfa-k-idx, dfa-var-idx): Adapt to refactor. (compute-live-variables): Adapt to refactor. static-patch! replaces link-procedure! * libguile/vm-engine.c (static-patch!): Replace link-procedure! with this more versatile primitive. * module/system/vm/assembler.scm (intern-constant): Emit static-patch! for static procedures and for strings. * module/system/vm/disassembler.scm (code-annotation): Remove annotation for link-procedure!. There can be no annotation for static-patch!, as neither operand is guaranteed to be a SCM value. Fix primitive reification for class-of, bytevector-u8-ref, etc * module/language/cps/reify-primitives.scm (primitive-module): Not all primitives are bound in (guile). DFG: Disable control-flow analysis. * module/language/cps/dfg.scm (visit-fun): Disable control-flow analysis for now, as it is not used. 2013-10-31 Andy Wingo Add "pop" field to $prompt * module/language/cps.scm ($prompt): Add a "pop" field, indicating the continuation at which this prompt is popped. The body of the prompt is dominated by the prompt, and post-dominated by the pop. Adapt all builders and users. * module/language/cps/closure-conversion.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/slot-allocation.scm: * module/language/cps/verify.scm: * module/language/tree-il/compile-cps.scm: Adapt. * module/language/cps/dfg.scm (visit-fun): Add an arc from the pop to the handler, to keep handler variables alive through the prompt body. 2013-10-29 Andy Wingo DWARF return arity fixen * module/system/vm/dwarf.scm (read-die-abbrev): Fix return arity. (read-compilation-unit): Fix return arity of read-die. 2013-10-27 Andy Wingo Dynamic-wind doesn't call thunk? on the out-guard. * module/ice-9/boot-9.scm (dynamic-wind): Remove the thunk? check of the out-guard. Walk the stack to determine extent of partial continuation * libguile/control.c (reify_partial_continuation): Walk the stack to determine the bottom of the captured stack. 2013-10-27 Andy Wingo Resumable partial continuations in the RTL VM * libguile/vm-engine.c (receive-values): Bugfix for the case where we want an exact number of values. (abort): Advance the IP before capturing. The captured SP is fp - 1, not fp. * libguile/vm.c (vm_reinstate_partial_continuation): Don't push on a number-of-values marker. 2013-10-27 Andy Wingo VM has "builtins": primitives addressable by emitted RTL code * libguile/Makefile.am: * libguile/vm-builtins.h: New header, declaring stubs needed by the compiler like values, apply, and abort-to-prompt. * libguile/vm.c: Adapt the apply and values stubs to conform to a standard interface. Add an abort-to-prompt stub. Add call/cc and call-with-values stubs. (scm_vm_builtin_ref): New helper, for the builtin-ref opcode. (scm_vm_builtin_name_to_index) (scm_vm_builtin_index_to_name): New helpers, for the compiler and disassembler, respectively. (scm_init_vm_builtins, scm_bootstrap_vm): Allow the compiler helpers to be loaded later into a module. * module/language/rtl.scm: Export builtin-index->name and builtin-name->index. * libguile/vm-engine.c (RETURN_VALUE_LIST): Update to use new names of "apply" and "values". (tail-call/shuffle): New opcode. (abort): Update to be a tail VM op, and reorder and renumber other ops. (builtin-ref): New opcode. * libguile/continuations.h: * libguile/continuations.c (scm_i_call_with_current_continuation): Move this to vm.[ch], implemented as a builtin. * module/language/tree-il/compile-cps.scm (convert): Convert to 'abort-to-prompt calls, possibly with 'apply, effectively undoing the tree-il transformation. * module/language/cps/reify-primitives.scm (builtin-ref): New helper. (reify-primitives): Convert builtin primitives to builtin-ref. * module/language/cps/dfg.scm (constant-needs-allocation?): * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add support for compiling builtin-ref. * module/system/vm/disassembler.scm (code-annotation): Add annotation for builtin-ref. 2013-10-27 Andy Wingo Partial continuations are RTL stubs * libguile/control.c: Implement partial continuations as RTL programs. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Add partial continuation case. * libguile/vm-engine.c (compose-continuation): Fix to look for vm_cont from the free variables. * libguile/vm-i-system.c (abort): Poison continuations captured in the stack VM, as the can't be rewound by the RTL stubs. 2013-10-27 Andy Wingo Fix toplevel-ref with named modules before boot in stack VM * libguile/vm.c (resolve_variable): Fix, as in e23f9e4423bbbe8521d13e1c9a223612a5e86762. 2013-10-27 Andy Wingo Memoized expressions are pairs, not SMOBs * libguile/memoize.c (MAKMEMO): Memoized objects are pairs now, not SMOBs. This lets eval.scm destructure them more efficiently. (scm_print_memoized, scm_memoized_p, scm_memoized_expression_typecode) (scm_memoized_expression_data): Remove these interfaces. (unmemoize, scm_memoize_variable_access_x): Remove SMOB type checks. (scm_init_memoize): Remove SMOB type definition. * libguile/memoize.h (scm_tc16_memoized, SCM_MEMOIZED_P) (scm_memoized_expression_typecode, scm_memoized_expression_data) (scm_memoized_p): Remove declarations. * libguile/validate.h (SCM_VALIDATE_MEMOIZED): Remove declaration. * libguile/eval.c (eval): Remove memoized type check, and inline the inum unpacking. * module/ice-9/eval.scm (memoized-expression-case): Use car and cdr to destructure memoized expressions. A big win! 2013-10-27 Andy Wingo Tree-IL->GLIL: Fix primitive-ref reification bug * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Fix a bug whereby a primitive that is present in the compilation module but not at runtime was getting compiled as a toplevel-ref. This was causing current-module to fail to resolve in R6RS modules. 2013-10-26 Andy Wingo Mark current-module as an interesting primitive * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add current-module, to allow RTL compilation. 2013-10-26 Andy Wingo New pass: elide-values * module/Makefile.am: * module/language/cps/elide-values.scm (elide-values): New pass. * module/language/cps/compile-rtl.scm (optimize): Call the new pass. 2013-10-26 Andy Wingo Add make-vector, constant-make-vector instructions * libguile/vm-engine.c (rtl_vm_engine): Add make-vector and constant-make-vector instructions and renumber. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Emit constant-make-vector and make-vector as appropriate. * module/language/cps/dfg.scm (constant-needs-allocation?): In some cases, make-vector doesn't need to allocate its index. * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *primitive-constructors*): Add make-vector. 2013-10-26 Andy Wingo Emit constant-vector-ref, constant-vector-set! for known small indices * libguile/vm-engine.c (rtl_vm_engine): Add constant-vector-set! instruction and renumber. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Emit constant-vector-ref and constant-vector-set! as appropriate. * module/language/cps/dfg.scm (constant-needs-allocation?): In some cases, vector-ref and vector-set! don't need to allocate their index. 2013-10-26 Andy Wingo New pass: inline-constructors * module/Makefile.am: * module/language/cps/constructors.scm (inline-constructors): New pass. * module/language/cps/compile-rtl.scm (optimize): Call the new pass. * module/language/tree-il/compile-cps.scm (convert): Don't handle "list" specially here. 2013-10-26 Andy Wingo Compile variable-ref, variable-set! * libguile/vm-engine (box-ref, box-set!): Instead of aborting if a box isn't a var, call out to vm_error_not_a_variable. This makes these instructions equivalent to variable-ref/variable-set!. (vector-set!): Rename from vector-set. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add variable-set! case, and adapt vector-set!. * module/language/cps/primitives.scm (*rtl-instruction-aliases*): Add variable-ref / variable-set! aliases to box-ref / box-set!. 2013-10-26 Andy Wingo Recognize tree-il variable? primitive * module/language/tree-il/primitives.scm (*interesting-primitive-names*) (*effect-free-primitives*, *effect+exception-free-primitives*): Add variable?. Fix nil? spelling. RTL compiler: Compile TC7 branches. * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm (code-annotation): * module/language/cps/primitives.scm (*branching-primcall-arities*): * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add support for compiling symbol?, variable?, vector?, and string? branches. Fix primcall return arities * module/language/cps/arities.scm (fix-clause-arities): Primcalls of known arity that continue to ktrunc should, if their return arity does not match the ktrunc, adapt via a call to `values'. This call may later get removed. RTL compiler: Compile `wind' primcalls * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add handler for `wind'. RTL VM: Fix fluid-ref local addressing. * libguile/vm-engine.c (push-fluid): Fix variable addressing. RTL VM: Fix variable lookup before modules boot * libguile/vm-engine.c (toplevel-box, module-box): Handle the case where the module system isn't booted yet. Add stringbuf printer * libguile/strings.h: * libguile/strings.c (scm_i_print_stringbuf): * libguile/print.c (iprin1): Add a printer for stringbufs. The disassembler can print a stringbuf. Peval: Fold `thunk?' in more cases. * module/language/tree-il/peval.scm (peval): Better folding of the `thunk?' predicate. Setting procedure properties does not cause metadata lookup * libguile/procprop.c (scm_procedure_properties, scm_procedure_property) (scm_set_procedure_properties_x, scm_set_procedure_property_x) (scm_procedure_name, scm_procedure_documentation): Rework to treat the overrides table as complementary to the RTL program properties. In this way setting a procedure property doesn't require loading up the (system vm debug) module. Evaluator sets same procedure properties as compiler * libguile/memoize.c (MAKMEMO_LAMBDA, memoize): Instead of passing the docstring in the memoized lambda, pass the meta as-is. That way we get all procedure properties, including "name". * module/ice-9/eval.scm (primitive-eval): Set procedure properties when making lambdas. Don't set the name when defining toplevel variables -- before we did so only if the procedure didn't have a name property, but I would like to avoid calls to procedure-property in eval, because getting the name for an RTL function requires loading up other modules. 2013-10-25 Andy Wingo Evaluator uses two-dimensional environment * libguile/memoize.c (MAKMEMO_LEX_REF, MAKMEMO_LEX_SET): Change to address lexicals by depth and width. (try_lookup_rib, lookup_rib, make_pos): New helpers. (lookup): Adapt to return a pair. (memoize, unmemoize_bindings, unmemoize_lexical): Adapt. * libguile/eval.c (eval, prepare_boot_closure_env_for_eval): (prepare_boot_closure_env_for_apply): * module/ice-9/eval.scm (make-fixed-closure, make-general-closure) (eval): Adapt to new environment. This is currently a slight win for C, and a slight lose for Scheme -- because the lookup loop is so poorly compiled by the stack VM. I expect that the RTL-compiled eval will fix this. 2013-10-23 Andy Wingo Always resolve-primitives in the root module. * module/language/tree-il/primitives.scm (resolve-primitives): If we are compiling in the root module, ignore local definitions. RTL VM: Fix LOCAL_REF, LOCAL_SET for unsigned indices * libguile/vm-engine.c (LOCAL_REF, LOCAL_SET): Fix so to work with unsigned 0. Previously subtracting 1 was making the index wrap around. Optimize closures with only required and rest arguments in eval * module/ice-9/eval.scm: Pregenerate closures with rest arguments, as we do for fixed arguments. This is important given the amount of (lambda args (apply foo args)) that we are doing lately. 2013-10-22 Andy Wingo Fix assembler for keyword args * module/system/vm/assembler.scm (begin-kw-arity, kw-prelude): Fix functions with keywords. CPS conversion doesn't automatically produce $values * module/language/tree-il/compile-cps.scm (convert): Don't convert values primcalls to $values, because we don't know that the continuation can accept that number of values. Contify returns via calls to "values" * module/language/cps/contification.scm: Returns from contified functions should primcall to 'values, as in general the return continuation is a multiple value context ($ktrunc or $ktail). A later pass can elide the primcall if appropriate. 2013-10-21 Andy Wingo CPS->RTL compiler: add push-fluid and pop-fluid * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Add cases for push-fluid and pop-fluid. DFG: Remove lift-definition! * module/language/cps/dfg.scm: Remove lift-definition!. Fix contification bugs * module/language/cps/contification.scm (compute-contification): Rewrite to avoid mutating the DFG and the function while we are rewriting. Instead we compute a contification, and if it is not empty, we apply it and loop. More robust contification * module/language/cps/contification.scm (contify): It could be that visiting pending contifications could enqueue more contifications, so iterate to a fixed point. Signal an error if there are any pending contifications at the end of an iteration. add lookup-block-scope * module/language/cps/dfg.scm (lookup-block-scope): New interface. (visit-fun): Give a bit more info if link-blocks! fails. DFG fixup. * module/language/cps/dfg.scm: Remove dead-after-def? and dead-after-use? export. 2013-10-21 Andy Wingo RTL slot allocator uses more precise, correct liveness information * module/language/cps/dfg.scm (control-point?): New interface, replaces branch?. (dead-after-def?, dead-after-use?, dead-after-branch?): Remove these. The first one was fine; dead-after-use? was conservative but OK; but dead-after-branch? was totally bogus. Instead we use precise liveness information in the allocator. * module/language/cps/slot-allocation.scm ($allocation): Remove "def" and "dead" slots. We'll communicate liveness information in some other way to the compiler. (allocate-slots): Rework to use precise liveness information. 2013-10-21 Andy Wingo DFG: Add code to compute live variable sets. * module/language/cps/dfg.scm (compute-live-variables) (compute-maximum-fixed-point, print-dfa): New code to compute live variable sets. DFG: Use maps have variable names * module/language/cps/dfg.scm ($use-map): Add variable names to the use maps. (visit-fun, lookup-def, lookup-uses, constant-needs-allocation?) (variable-free-in?, dead-after-def?, dead-after-use?) (dead-after-branch?): Adapt to use-map change. 2013-10-20 Ian Price Fix optional end argument in `uniform-vector-read!'. Fixes . Reported by Thien-Thi Nguyen . * libguile/deprecated.c (scm_uniform_vector_read_x): Only multiply by width when argument supplied. 2013-10-20 Ian Price Doc: 'unfold-right' takes a tail not a tail generator. Reported by David Kastrup . * doc/ref/srfi-modules.texi (SRFI-1 Fold and Map): Change argument name, and default value. 2013-10-18 Andy Wingo Continuations are RTL stubs * libguile/continuations.h: * libguile/continuations.c: Reimplement continuations and the call_cc stub as RTL programs. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Add a case for continuations. * libguile/vm-engine.c (rtl_vm_debug_engine): Always call the abort continuation hook with the number of non-procedure locals. Fix compose-continuation argument count. Enable call/cc. 2013-10-18 Andy Wingo (language tree-il analyze) works better with RTL programs * module/system/vm/program.scm (program-arguments-alists): Export this interface. Fall back to grovelling through procedure-minimum-arity if the program has no arities, as might be the case for continuations. * module/language/tree-il/analyze.scm (validate-arity): Use program-arguments-alists instead of the program-arities interface, to cover both stack VM and RTL programs. 2013-10-18 Andy Wingo Foreign procedures are RTL programs * libguile/foreign.c: Convert to using RTL stubs. Because RTL code has different GC characteristics than objcode -- it's mostly assumed that RTL code will never go away -- we go ahead and pre-generate code for 100 arguments. This is actually less memory than the stack VM code, and doesn't require any relocations at load-time: bonus! We'll cross the >=100 args bridge if we ever come to it. (get_foreign_stub_code) New function. (scm_i_foreign_arity): New helper, like scm_i_primitive_arity. (cif_to_procedure): Rework to make RTL programs. * libguile/foreign.h: Declare scm_pointer_to_scm and scm_scm_to_pointer. Declare new internal helpers. * libguile/gsubr.c (create_subr): Refactor to set the flags when the object is allocated. * libguile/instructions.h: Define SCM_PACK_RTL_12_12. * libguile/programs.c (scm_i_rtl_program_minimum_arity): Dispatch to scm_i_foreign_arity if the procedure has the FOREIGN flag. * libguile/programs.h (SCM_F_PROGRAM_IS_FOREIGN) (SCM_PROGRAM_IS_FOREIGN): New interfaces. * test-suite/tests/foreign.test ("procedure->pointer"): Add a test for foreign arities. 2013-10-18 Ian Price Doc: mention vectors are self-quoting Reported by Dmitry Bogatov . * doc/ref/api-compound.texi (Vector Syntax, Vector Creation): Mention that vectors are self-quoting. Remove examples with quote signs. 2013-10-18 Andy Wingo Fix statprof-proc-call-data for recent changes * module/statprof.scm (statprof-proc-call-data): Fix statprof for recent fixes. 2013-10-18 Andy Wingo Subrs are RTL programs * libguile/gsubr.c: Define RTL stubs instead of stack VM stubs. (SUBR_STUB_CODE, get_subr_stub_code): Adapt to return a uint32_t* pointer instead of a SCM value. (create_subr): Create RTL procedures instead of stack VM procedures. For RTL procedures, the function pointer, name, and generic address pointer go inline to the procedure, as free variables. (scm_i_primitive_arity, scm_i_primitive_call_ip): New helpers. (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic) (scm_c_define_gsubr_with_generic): Adapt to create_gsubr being renamed to create_subr. Remove gsubr test code. * libguile/gsubr.h (SCM_PRIMITIVE_P, SCM_PRIMITIVE_GENERIC_P): Only RTL programs can be primitives now. (SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC): These fields are now in the RTL free variables, not the object table. * libguile/programs.c (scm_i_rtl_program_name): (scm_i_rtl_program_documentation): (scm_i_rtl_program_properties): (scm_i_rtl_program_minimum_arity): Implement these appropriately for primitives, which lack debugging information. (scm_primitive_p, scm_primitive_call_ip): New helpers. * libguile/snarf.h: Remove static allocation for subrs. Since there is nothing to allocate besides the program itself, which needs runtime relocation, static allocation is not a win. * system/vm/program.scm: Fix up various arity-related things for primitives, which don't use ELF arity info. * test-suite/tests/eval.test ("stack involving a primitive"): Add an XFAIL until we get just one VM. 2013-10-18 Andy Wingo (system vm debug): implement arity-low-pc, arity-high-pc * module/system/vm/debug.scm (arity-low-pc, arity-high-pc): Implement these exports. class-of fix for RTL programs * libguile/goops.c (scm_class_of): Use the same logic for RTL programs and stack VM programs. 2013-10-17 Andy Wingo Stack traces skip RTL boot frames * libguile/frames.c (frame-previous) * libguile/stacks.c (make-stack): Skip RTL boot frames. RTL engine can apply smobs and applicable structs w/o stack VM * libguile/vm-engine.c (rtl_vm_engine): Allow the RTL VM to handle the dispatch for SMOBs and applicable structs. Fix subr-call * libguile/vm-engine.c (subr-call): Fix for locals count including the procedure. Fix tail-apply bugs * libguile/vm-engine.c (tail-apply): Fix for old change that made the procedure indexed 0 instead of -1. Better vm.c support for RTL programs * libguile/vm.c (scm_c_vm_run): Directly dispatch to the RTL VM for RTL programs. (scm_bootstrap_vm): Initialize the RTL program stubs early, and mark the RTL boot program with the boot flag. Procedure traps work with RTL programs. * module/system/vm/traps.scm (frame-matcher): Work with RTL programs. minimal RTL program support in (system xref) * module/system/xref.scm (procedure-sources*): Work with RTL programs. (system vm coverage) works with RTL programs * module/system/vm/coverage.scm (hashq-proc, assq-proc) (program-sources*, closed-over-procedures, coverage-data->lcov): Work with RTl procedures. Statprof works better with RTL programs * module/statprof.scm (get-call-data, procedure=?): Work with RTL programs. bind-rest works in the optional-and-rest-arg case. * libguile/vm-engine.c (bind-rest): If the sp is below the dst reg, alloc the frame to ensure there is enough space, and to fill in intermediate values with SCM_UNDEFINED. 2013-10-14 Ludovic Courtès 'scm_c_read' goes through the fast path with ISO-8859-1 unbuffered ports. Discussed in . * libguile/ports.c (scm_c_read): Enter the 'swap_buffer' case when pt->encoding is "ISO-8859-1". 2013-10-14 Ludovic Courtès doc: Update the section on SMOBs and memory management. * doc/ref/libguile-smobs.texi (Describing a New Type): Only list 'print' and 'equalp' as compulsory. Explain why 'mark' and 'free' are optional. (Creating Smob Instances): Remove paragraphs about allocations that might fail etc. Use 'scm_gc_malloc_pointerless' for the pixel buffer. (Garbage Collecting Smobs): Explain when the 'mark' and 'free' functions are needed. (Garbage Collecting Simple Smobs): Remove. 2013-10-14 Andy Wingo Refactor vm_abort * libguile/vm.c (vm_abort): * libguile/vm-i-system.c (abort): Refactor abort interface so that it is more amenable to the RTL VM. 2013-10-14 Andy Wingo Reify call-thunk/no-inline. * module/language/cps/reify-primitives.scm (reify-primitives): Remove call-thunk/no-inline in this late phase. 2013-10-14 Andy Wingo RTL: Compile prompts * libguile/vm-engine.c (prompt): Adapt to explicitly set the saved SP so we know how many incoming values the handler will receive, and to make escape-only? a flag. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): $prompt should only be found in a "seq" context, as it just pushes on a prompt and doesn't bind any values. On the other hand it should emit appropriate code for the handler to bind its values, so do that. * module/language/cps/slot-allocation.scm ($cont-allocation): Add a note that proc-slot is used by prompts as well. (allocate-slots): Compute the allocation of a prompt handler's args. * module/language/tree-il/compile-cps.scm (convert): Use "unwind" instead of the nonexistent "pop-prompt". * module/system/vm/disassembler.scm (code-annotation): Adapt to change in prompt VM op. 2013-10-14 Andy Wingo RTL VM: receive-values has allow-extra? flag * libguile/vm-engine.c (receive-values): Add an ALLOW-EXTRA? flag in unused bits of the third word. Without it, receive-values will check for the exact number of incoming values. * libguile/vm.c (vm_error_wrong_number_of_values): New error case. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): Adapt to add the ALLOW-EXTRA? flag. 2013-10-14 Andy Wingo Add SCM_F_DYNSTACK_PROMPT_PUSH_NARGS prompt flag * libguile/dynstack.h (scm_t_dynstack_prompt_flags): New flag, SCM_F_DYNSTACK_PROMPT_PUSH_NARGS, set if the continuation expects the number of args to be pushed on the top of the stack. * libguile/control.c (scm_c_abort): Only push nargs if requested. * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): * libguile/vm-i-system.c (prompt): Set SCM_F_DYNSTACK_PROMPT_PUSH_NARGS. 2013-10-14 Andy Wingo call-with-prompt always compiles to CPS $prompt * module/language/tree-il/compile-cps.scm (convert): For prompts without inline handlers, eta-convert the handler. 2013-10-14 Andy Wingo Put the readline extension in the extensionsdir * GUILE-VERSION: * acinclude.m4: * guile-readline/LIBGUILEREADLINE-VERSION: * guile-readline/Makefile.am: Rename libguile-readline-v-18.so to guile-readline.so, and install it to the extensions dir instead of the libdir. * guile-readline/ice-9/readline.scm: Load guile-readline instead of libguile-readline-v-18. 2013-10-12 Andy Wingo More precise dead-after-use? for loop variables * module/language/cps/dfg.scm (dead-after-use?): (dead-after-branch?): A symbol defined in the header block of a loop is still within the same loop. RTL slot allocation: Don't kill variables that flow into loops * module/language/cps/dfg.scm (dead-after-use?): Don't kill a variable if it was defined outside the current loop. (dead-after-branch?): Likewise, but I don't think this helper is correct yet :/ Compute post-dominators * module/language/cps/dfg.scm ($block): Add pdom and pdom-level fields, for post-dominators. (reverse-post-order, convert-predecessors): Arrange to work either way: for dominators or for post-dominators. (analyze-control-flow!): Compute post-dominators. (dominates?): Refactor. (post-dominates?): New helper. 2013-10-12 Andy Wingo Identify loops * module/language/cps/dfg.scm (compute-dom-edges) (compute-join-edges, compute-reducible-back-edges) (compute-irreducible-dom-levels, compute-nodes-by-level) (mark-loop-body, mark-irreducible-loops, identify-loops): Identify loops. Irreducible loops are TODO. * test-suite/tests/rtl-compilation.test ("contification"): Add an irreducible loop test. 2013-10-12 Andy Wingo DFG refactorings * module/language/cps/dfg.scm ($block): Add "irreducible" field, format TBD. (reverse-post-order): Return a vector directly. (convert-predecessors, compute-dom-levels, compute-idoms): (analyze-control-flow!): Factor out control flow analsysis a bit better. (identify-loops): New helper. Currently a NOP. (visit-fun): Adapt to compute-dominator-tree rename to analyze-control-flow!. 2013-10-11 Andy Wingo Replace conservatively-dominates? with a precise dominator lookup * module/language/cps/dfg.scm (dominates?): Use the dominator tree instead of the scope tree. Compute a dominator tree * module/language/cps/dfg.scm (reverse-post-order, for-each/enumerate) (convert-predecessors, finish-idoms, compute-dominator-tree): Compute a dominator tree. We don't use it yet. 2013-10-10 Andy Wingo DFG refactor to allow dominator tree construction * module/language/cps/dfg.scm: Refactor so that we can think about building a dominator tree. Split continuations out of use maps and put them in a separate table, which will have more flow information. (visit-fun): Mark clauses as using their bodies. (lookup-predecessors, lookup-successors): New exports. (find-defining-expression): Add an exception for clauses, now that clauses are in the flow graph. (continuation-bound-in?): Rename from variable-bound-in?, as it can currently only be used for continuations. * module/language/cps/contification.scm (contify): Adapt to use lookup-predecessors and continuation-bound-in?. 2013-10-10 Andy Wingo A couple of fixes when no source info is available * module/system/vm/assembler.scm (link-debug): If there was no debugging info, reset the file register to 0 from its default value of 1 before adding the final row. * module/system/vm/dwarf.scm (line-prog-scan-to-pc): If we rescanned from the beginning and still found no source info for this pc, return #f instead of the default value of the file register (1). 2013-10-10 Andy Wingo Fix peval bug with inlining and optional argument initializers * module/language/tree-il/peval.scm (peval): Fix a bug whereby inlined function applications with default argument initializers were putting the initializers in the wrong scope. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2013-10-05 Andy Wingo Fix slot allocation bug * module/language/cps/slot-allocation.scm (allocate-slots): Fix dead-after-use computation to use the expression's label and not its continuation. 2013-10-04 Andy Wingo better RTL debugging * libguile/frames.c (scm_frame_source, scm_frame_instruction_pointer): Fix to work with RTL programs. * module/system/vm/debug.scm (find-debug-context): Allow for the possibility of there being no ELF image. (find-program-debug-info, find-program-arities) (program-minimum-arity, find-program-docstring) (find-program-properties, find-source-for-addr) (find-program-die, find-program-sources): Don't bail if we couldn't get the debug context. * module/system/vm/frame.scm (frame-next-source) (frame-call-representation): Allow RTL programs. * module/system/vm/program.scm (program-arguments-alist): Placeholder implementation for RTL programs. (program-arguments-alists): Don't bail if we couldn't get the arities. 2013-10-04 Andy Wingo Fix nested contification bugs * module/language/cps/contification.scm (contify): Exhaustively replace contified tail continuations, to fix a bug in nested tail-recursive contifications. Likewise, call lookup-return-cont when searching for common return continuations. Fix variable-bound-in? * module/language/cps/dfg.scm (variable-bound-in?): Fix to look up correct variable. Fix verify-cps * module/language/cps/verify.scm (verify-cps): Fix visiting functions. Disassembling RTL prints source information. * module/system/vm/disassembler.scm (disassemble-buffer): Print source information. add contification test * test-suite/tests/rtl-compilation.test ("contification"): Add contification test where non-recursive call is not in tail position relative to the letrec. Contify functions in the scope of their continuation. * module/language/cps/contification.scm (contify): Fix to contify functions in the scope of their continuation. 2013-10-04 Andy Wingo dfg: variable-free-in?, add variable-bound-in? * module/language/cps/dfg.scm (variable-free-in?): Rename from variable-used-in?, to match CWCC language. (variable-bound-in?): New interface. * module/language/cps/contification.scm (contify): Adapt caller. Add more comments. 2013-10-04 Mark H Weaver Fix edge case in 'ash'. * libguile/numbers.c (left_shift_exact_integer): Fix edge case where N is -1 and count is SCM_I_FIXNUM_BIT-1 to return the most negative fixnum. Previously this result was returned as a bignum. * test-suite/tests/numbers.test (ash): Add tests. 2013-10-04 Mark H Weaver Revert "Fix edge case in 'ash'." This reverts commit 8df68898b9f6ba15171244f1f3549688f13d605f. 2013-10-03 Andy Wingo anonymous RTl functions print with source info * module/system/vm/debug.scm (find-program-sources): If there is no source location before the low-pc of the procedure we're grovelling for, we were skipping the source loc info. Fix that. * module/system/vm/program.scm (write-program): Get source info for anonymous RTL functions. (program-sources, program-sources-pre-retire): Provide program counters relative to the beginning of the procedure. 2013-10-03 Andy Wingo program-source / program-sources works with RTL programs * libguile/programs.c (scm_program_sources): Define as %program-sources, and let Scheme export the program-sources proper. (scm_program_source): Call out to Scheme. * module/system/vm/program.scm: Convert to use match instead of pmatch. Adapt existing callers. (program-sources, program-source): New Scheme implementations of these functions. (program-sources-pre-retire): Add RTL program case. 2013-10-03 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/deprecated.h libguile/programs.c libguile/programs.h Deprecate scm_c_program_source, as it has no internal users. * libguile/programs.c: * libguile/programs.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_c_program_source): Deprecate. 2013-10-03 Mark H Weaver Fix edge case in 'ash'. * libguile/numbers.c (scm_ash): Fix (ash -1 SCM_I_FIXNUM_BIT-1) to return a fixnum instead of a bignum. * test-suite/tests/numbers.test (ash): Add tests. 2013-10-03 Andy Wingo Add source location test * test-suite/tests/dwarf.test: New test, testing that source location information survives the round-trip through the compiler, back out to the (system vm debug) interfaces. Add (system vm debug) interface to source location information * module/system/vm/debug.scm (, source-pre-pc) (source-post-pc, source-file, source-line, source-column) (source-line-for-user): New data type for source location information. (find-source-for-addr, find-program-sources): New procedures to get source location information for a particular address. Add interface to read .debug_line data * module/system/vm/dwarf.scm (die-line-prog): (line-prog-advance, line-prog-scan-to-pc): New public interfaces, allowing clients to interpret the "statement programs" from .debug_line DWARF sections. (, elf->dwarf-context): Record the bounds of the .debug_line section. Serialize source positions into .debug_line * module/system/vm/assembler.scm (link-debug): Generate a correct DWARF2 line program. Tests come next. 2013-09-30 Andy Wingo Emit a placeholder .debug_line section. * module/system/vm/assembler.scm (link-debug): Emit a .debug_line section also. (link-objects): Expect .debug_line. 2013-09-30 Andy Wingo Add new "source" macro instruction; compile-rtl emits it. * module/system/vm/assembler.scm (): Add "sources" field. (make-assembler): Adapt to make-asm change. (source): New macro assembler. * module/language/cps/compile-rtl.scm (emit-rtl-sequence): (compile-fun): Emit source instructions as appropriate. 2013-09-30 Mark H Weaver Fix minor mistakes in documentation. Fixes . Reported by Josep Portella Florit . * doc/ref/api-i18n.texi (i18n Introduction, Text Collation, Internationalization, Internationalization): LC_MESSAGE --> LC_MESSAGES. * doc/ref/api-procedures.texi (Compiled Procedures): program-lambda-alist --> program-lambda-list. * THANKS: Fix alignment of Josep Portella Florit. 2013-09-28 Andy Wingo DWARF linker: encode strings using the correct form * module/system/vm/assembler.scm (link-debug): Encode strings using the strp form. Emit minimal DWARF information * module/system/vm/assembler.scm (link-debug): New function, creates the necessary DWARF debugging sections. (link-objects): Emit debugging sections. add DWARF parser * module/Makefile.am: * module/system/vm/dwarf.scm: New module, a DWARF parser. 2013-09-13 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: module/srfi/srfi-9.scm module/web/server.scm 2013-09-13 Mark H Weaver Fix truncated documentation for 'put-char'. Fixes . Reported by Josep Portella Florit . * doc/ref/api-io.texi (R6RS Textual Output): Fix truncated docs for 'put-char'. * THANKS: Add Josep Portella Florit to fixes section. 2013-09-13 Mark H Weaver Web: Use functional setters in extend-request and extend-response. * module/web/client.scm (extend-request): * module/web/server.scm (extend-response): Reimplement using functional setters. 2013-09-13 Mark H Weaver Web client+server: Add Content-Length header for empty bodies. * module/web/client.scm (sanitize-request): Add a Content-Length header if a body if given, even if the body is empty. * module/web/server.scm (sanitize-response): Add a Content-Length header if a body if given, even if the body is empty. 2013-09-13 Mark H Weaver Adapt srfi-9.test to error reporting improvements; update copyright dates. * module/srfi/srfi-9.scm: Add 2013 copyright date. * test-suite/tests/srfi-9.test: Adapt to recent error reporting improvements to procedures defined by 'define-tagged-inlinable'. 2013-09-13 Mark H Weaver Improve error reporting of procedures defined by define-inlinable. * module/ice-9/boot-9.scm (define-inlinable): Improve error reporting when procedures defined using 'define-inlinable' are applied to the wrong number of arguments. * module/srfi/srfi-9.scm (define-tagged-inlinable): Improve error reporting when procedures defined using 'define-tagged-inlinable' are applied to the wrong number of arguments. 2013-09-10 Mark H Weaver THANKS Alexandru Cojocaru * THANKS: Add Alexandru Cojocaru to fixes section. web client: HTTP methods are symbols, not strings. * module/web/client.scm (request, http-get, http-head, http-post, http-put, http-delete, http-trace, http-options): HTTP methods are symbols. 2013-09-10 Alexandru Cojocaru Fix extend-request to preserve method and meta. * module/web/client.scm (extend-request): Preserve method and meta. 2013-09-10 Mark H Weaver psyntax: cite the paper that psyntax is based on. * module/ice-9/psyntax.scm: cite the paper. Minor stylistic improvement to 'and-let*' macro. * module/ice-9/and-let-star.scm (%and-let*): Use 'and' instead of 'if'. Suggested by Chris K. Jester-Young . Rewrite SRFI-2 'and-let*' using syntax-case. * module/ice-9/and-let-star.scm (%and-let*): Helper macro. (and-let*): Reimplement using syntax-case. 2013-08-31 Andy Wingo Micro-optimize char_decimal_value. * libguile/numbers.c (char_decimal_value): A wee micro-optimization. Faster scm_from_port_stringn * libguile/strings.c (scm_from_port_stringn): Always inline to scm_from_utf8_string if the byte sequence is valid utf-8. unread-char: inline conversion from codepoint to bytes * libguile/ports.c (scm_ungetc_unlocked): Inline the conversion from codepoint to bytes for UTF-8 and latin-1 ports. Speeds up a numbers-reading test case by 100% (!). 2013-08-31 Andy Wingo Add contification pass * module/Makefile.am: * module/language/cps/contification.scm: New pass. * module/language/cps/compile-rtl.scm (optimize): Wire it into the compiler. 2013-08-31 Andy Wingo Add CPS -> RTL compiler * module/Makefile.am: * module/language/cps/compile-rtl.scm: * module/language/cps/dfg.scm: * module/language/cps/slot-allocation.scm: New modules. * module/language/cps/spec.scm: Register the compiler. * test-suite/Makefile.am: * test-suite/tests/rtl-compilation.test: Add tests. 2013-08-31 Andy Wingo Add pass to reify primcalls without corresponding VM ops * module/Makefile.am: * module/language/cps/reify-primitives.scm: New pass. Add arity-adapting module * module/Makefile.am: * module/language/cps/arities.scm: New module. Adapts call and return arities, especially for primcalls. Add CPS primitives info module * module/Makefile.am: * module/language/cps/primitives.scm: New file. RTL language * module/Makefile.am * module/language/rtl.scm: * module/language/rtl/spec.scm: Add a stub RTL language. Add closure conversion * module/Makefile.am * module/language/cps/closure-conversion.scm: New module, implementing a closure conversion pass. 2013-08-31 Andy Wingo (compile foo #:to 'cps) * module/language/tree-il/compile-cps.scm: New module implementing CPS conversion of Tree-IL. * module/Makefile.am: * module/language/tree-il/spec.scm: * module/language/cps/spec.scm: Integrate CPS in the build and language system. 2013-08-31 Andy Wingo Add CPS language * module/Makefile.am: * module/language/cps.scm: * module/language/cps/verify.scm: Add CPS language. * .dir-locals.el: Add indentation rules for some CPS forms. 2013-08-29 Andy Wingo ,xx for RTL images * module/scripts/disassemble.scm (disassemble): * module/system/vm/disassembler.scm (disassemble-file): Factor disassemble-file out. * module/system/repl/command.scm (disassemble-file): Map ,xx to disassemble RTL images. 2013-08-29 Andy Wingo add ability to disassemble ELF images * module/scripts/disassemble.scm (disassemble): Update to work with RTl (and only RTL, as that's the future). * module/system/vm/debug.scm (for-each-elf-symbol): New public interface. (debug-context-from-image): New helper. (find-debug-context): Use the helper. * module/system/vm/disassembler.scm (disassemble-image): New public interface. 2013-08-24 Andy Wingo Export the assembler procedures * module/system/vm/assembler.scm (define-assembler): (define-macro-assembler): Export the assemblers. rtl vm: box-set! binds no values * libguile/vm-engine.c (box-set!): Remove the OP_DST flag. RA == MVRA in disassembler * module/system/vm/disassembler.scm: Modify call disassembler to assume RA == MVRA. assembler: give proper permissions to .data section * module/system/vm/assembler.scm (link-data): Give stringbufs the "shared" flag already, so we don't attempt to set it at runtime. Give .data sections the SHF_WRITE flag. 2013-08-24 Andy Wingo compile-file adds #:to-disk? #t to opts * module/system/base/compile.scm (compile-file): Pass #:to-disk? as an option to indicate that the result will be being loaded from disk. Perhaps a linker might want to page-align in that case. * module/language/elisp/compile-tree-il.scm (process-options!): Accept and ignore the #:to-file compiler option. 2013-08-24 Mark H Weaver RTL: 'return-values' instruction assumes 'reset-frame' has been called. * libguile/vm-engine.c (return-values): Remove NVALUES operand. Don't reset the frame. * test-suite/tests/rtl.test ("cached-toplevel-set!"): Adapt to the fact that 'return-values' has no operand now, and that 'reset-frame' must be done first. 2013-08-24 Mark H Weaver RTL VM: Rename 'apply' instruction to 'tail-apply'. * libguile/vm-engine.c (apply, tail-apply): apply -> tail-apply. (RETURN_VALUE_LIST): goto op_apply -> goto op_tail_apply. * libguile/vm.c (rtl_apply_code): scm_rtl_op_apply -> scm_rtl_op_tail_apply. 2013-08-24 Mark H Weaver RTL VM: fix multiple value returns. * libguile/vm-engine.c (halt): Fix off-by-one error in retrieving multiple values from the frame. Convert branchable primitives into binary operations only. * module/language/tree-il/primitives.scm (maybe-simplify-to-eq): Wrap within another lambda, binding the primitive name. If there are less than two arguments, expand to constant #t. If there are more than two arguments, convert into a conjunction of binary applications. (expand-chained-comparisons): New procedure. (*primitive-expand-table*): Add entries for (< <= = >= > eq?). Merge remote-tracking branch 'origin/stable-2.0' 2013-08-23 Mark H Weaver Fix 'define-public' from (ice-9 curried-definitions). * module/ice-9/curried-definitions.scm (cdefine, cdefine*): Simplify, and improve error reporting by making the patterns more strict. (define-public): Fix bug in generated 'export' form. 2013-08-20 Mark H Weaver Improve error checking in 'define-public' and 'module-add!'. * module/ice-9/boot-9.scm (module-add!): Check that the symbol argument is actually a symbol. (define-public): Expand into 'define' in such a way that curried definitions will immediately fail. 2013-08-19 Ian Price doc: `get-string-all' takes only one argument. * doc/ref/api-io.texi (R6RS Textual Input): Remove `count' argument. `write-request-line' always prints a path component. * module/web/http.scm (write-request-line): Always write "/" when path is empty, regardless of query. * test-suite/tests/web-http.test ("write-request-line"): Add test. 2013-08-17 Mark H Weaver In bytevector->uint-list et al, check that SIZE divides the bv length. Fixes . Reported by Göran Weinholt . * libguile/bytevectors.c (INTEGERS_TO_LIST): Enforce the R6RS requirement that SIZE divides the bytevector length. * test-suite/tests/bytevectors.test: Add test. Remove tests that assumes that this "divides" check is not enforced. 2013-08-17 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2013-08-17 Mark H Weaver Improved error checking in bytevector->uint-list and bytevector->sint-list. Partially fixes . Reported by Göran Weinholt . * libguile/bytevectors.c (INTEGERS_TO_LIST): Make sure SIZE isn't 0. Allow SIZE to be greater than the bytevector length, for consistency with allowing extra bytes at the end when the bytevector length is non-zero. Use scm_from_size_t instead of scm_from_uint. * test-suite/tests/bytevectors.test: Add tests. Remove a test that checks for an exception when SIZE is greater than the bytevector length. 2013-08-15 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2013-08-15 Mark H Weaver Improve run-time error reporting in (ice-9 match). * module/Makefile.am: match.go depends on match.upstream.scm. * module/ice-9/match.scm (error): Accept any number of arguments. * module/ice-9/match.upstream.scm (match-next): Call 'error' in non-tail context, and include the value that failed to match in the call. 2013-08-14 Mark H Weaver Adapt peval.test to recent associativity fixes of numeric ops. * test-suite/tests/peval.test ("partial evaluation"): Adapt tests to the fact that arithmetic operators are now expanded into binary ops with left-to-right associativity. Manual: clarify that 'append!' and 'reverse!' might not mutate. * doc/ref/api-compound.texi (Append/Reverse): Clarify that 'append!' and 'reverse!' are not required to modify anything. Manual: don't promise that 'append!' will modify the existing lists. * doc/ref/api-compound.texi (Append/Reverse): Say that 'append!' *may* modify the given lists, but don't promise that it will. 2013-08-13 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Common numeric operations are left-to-right associative. * module/language/tree-il/primitives.scm (define-primitive-expander): Use 'match-lambda*' instead of 'case-lambda' for pattern matching. (*primitive-expand-table*): In primitive expanders for '+', '*', '-', '/', 'logior', and 'logand', assume conventional left-to-right associativity. Numerical comparisons are not negatable. * module/language/tree-il/primitives.scm (*negatable-primitives*): Remove (< <= > >=) from the list of negatable primitives. 2013-08-12 Mark H Weaver RTL VM: Fix SCM_PACK_RTL_* macros. * libguile/instructions.h (SCM_PACK_RTL_8_8_8): Fix typo. (SCM_PACK_RTL_16_8): Fix erroneous shift offset. Merge remote-tracking branch 'origin/stable-2.0' Broken Turkish UTF-8 locale still unresolved in FreeBSD 9.1. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Disable tests of Turkish UTF-8 locale in FreeBSD 9.1. 2013-08-11 Mark H Weaver Adapt ecmascript compiler to tree-il prompt changes, again. * module/language/ecmascript/compile-tree-il.scm (with-return-prompt): The body of an escape-only prompt is no longer a thunk. Adapt. 2013-08-11 Andy Wingo Various RTL VM and calling convention tweaks * libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): Allow for five-word instructions, and for new instruction word types. * libguile/vm-engine.c (RETURN_ONE_VALUE): Instead of returning the value in the fixed part of the call frame, return it in the same place multiple-value returns go: from slot 1. (BR_ARITHMETIC): Allow arithmetic tests to be negated. (rtl_vm_engine): Change calling convention to use the same location for single and multiple-value returns. Renumber all instructions. (halt, halt/values): Fold into a single instruction (halt). (call): Take the location of the procedure instead of the location of the call frame. Also take the number of args, and reset the sp before jumping to the procedure, so as to indicate the number of arguments. (call/values): Remove, as the new calling convention has RA == MVRA. (tail-call): Require the procedure to be shuffled down already, and take "nlocals" as an arg instead of "nargs". (receive, receive-values): New instructions, for receiving returned values from calls. (return-values): Rename from return/values. Remove "values". (alloc-frame): Rename from reserve-locals. (reset-frame): New instruction. (drop-locals): Remove. (br-if-=, br-if-<, br-if-<=): Allow these instructions to be negatable. (br-if->, br-if->=): Remove. Probably a bad idea, given NaN. (box-ref): Don't bother trying to do a reverse lookup -- the toplevel-box, module-box, and resolve instructions should handle that. (resolve): Add arg to check that the variable is bound. (toplevel-box, module-box): New instructions, replacing toplevel-ref, toplevel-set, module-ref, and module-set. * libguile/vm.c (rtl_boot_continuation_code, rtl_values_code): Adapt to instruction set changes. * module/Makefile.am: Make the assembler and disassembler dependent on vm-operations.h. * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm: Adapt to instruction changes and new instruction word kinds. * test-suite/tests/rtl.test: Adapt to instruction set changes. 2013-08-11 Andy Wingo Inline escape-only prompt bodies in the Tree-IL * module/language/scheme/decompile-tree-il.scm (do-decompile): * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/canonicalize.scm (canonicalize): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): * module/language/tree-il/cse.scm (cse): * module/language/tree-il/peval.scm (peval): * test-suite/tests/peval.test ("partial evaluation"): Partially revert 178a40928, so that escape-only prompts explicitly inline their bodies. remove peval abort-in-tail-position optimization * module/language/tree-il/peval.scm (peval): Remove abort optimization; the CPS compiler will do much better here, and it is complicating things in the meantime. 2013-08-10 Mark H Weaver Fix inappropriate uses of scm_syserror in numbers.c. * libguile/numbers.c (mem2ureal, left_shift_exact_integer, floor_right_shift_exact_integer, round_right_shift_exact_integer): Use 'assert' instead of 'scm_syserror' to indicate a case that should never happen. 2013-08-10 Mark H Weaver dereference-pointer: check for null pointer. * libguile/foreign.c (scm_dereference_pointer): Check for attempts to dereference a null pointer. * test-suite/tests/foreign.test ("null pointer"): Add test. 2013-08-09 Mark H Weaver Fix numerator and denominator handling of signed zeroes and infinities. * libguile/numbers.c (scm_numerator, scm_denominator): Handle signed zeroes and infinities in accordance with the corresponding R6RS flonum procedures. * module/rnrs/arithmetic/flonums.scm (flnumerator, fldenominator): Remove special handling of infinities. * test-suite/tests/numbers.test (numerator, denominator): Add tests. Convert existing tests to use 'pass-if-equal'. * test-suite/tests/r6rs-arithmetic-flonums.test (flnumerator): Fix broken test of (flnumerator -0.0). 2013-08-08 Mark H Weaver Eliminate use of deprecated 'SCM_WTA_DISPATCH_2' in numbers.c. * libguile/numbers.c (scm_gcd): Use 'scm_wta_dispatch_2' not 'SCM_WTA_DISPATCH_2'. 2013-08-08 Mark H Weaver Fix --without-threads and SCM_DEBUG_TYPING_STRICTNESS==2 builds. * libguile/hashtab.c (scm_hashv_ref, scm_hashv_set_x, scm_hashv_remove_x, scm_hash_ref, scm_hash_set_x, scm_hash_remove_x): * libguile/strports.c (scm_mkstrport): * libguile/weak-vector.c (weak_vector_ref): Add missing SCM_UNPACK. * libguile/ports.c (lock_port, unlock_port): Cast MUTEX to the expected type. 2013-08-07 Mark H Weaver Decompiler: fix handling of empty 'case-lambda' expressions. * module/language/scheme/decompile-tree-il.scm (choose-output-names): A with no decompiles into a 'case-lambda' primitive. Ensure that 'case-lambda' is not shadowed by a lexical. Adapt ecmascript compiler to recent tree-il changes for prompts. * module/language/ecmascript/compile-tree-il.scm (with-return-prompt): Adapt to the changes in 178a40928ab5221f6ce57c5af1067abe30a342b3. Prompt tree-il nodes now contain an explicit 'escape-only?' flag, and the body and handler are now both lambdas. 2013-08-07 Mark H Weaver String ports use UTF-8; ignore %default-port-encoding. * libguile/strports.c (scm_mkstrport): Use UTF-8; ignore %default-port-encoding. Rename 'str_len' and 'c_pos' to 'num_bytes' and 'c_byte_pos'. Interpret 'pos' argument as a character index instead of a byte index. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-6 to the list of core features. * module/srfi/srfi-6.scm (open-input-string, open-output-string): Simply re-export these, since the core versions are now compliant. * doc/ref/api-io.texi (String Ports): Remove text that describes non-compliant behavior of string ports with regard to encoding. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-6 to the list of core features. (SRFI-6): Remove text that mentions non-compliant behavior of core string ports. * module/ice-9/format.scm (format): * module/ice-9/pretty-print.scm (truncated-print): * module/rnrs/io/ports.scm (open-string-input-port, open-string-output-port): * test-suite/test-suite/lib.scm (format-test-name): * test-suite/tests/chars.test ("combining accent is pretty-printed", "combining X is pretty-printed"): * test-suite/tests/ecmascript.test (eread, eread/1): * test-suite/tests/rdelim.test: * test-suite/tests/reader.test (read-string): * test-suite/tests/regexp.test: * test-suite/tests/srfi-105.test (read-string): Don't set %default-port-encoding before creating string ports. * benchmark-suite/benchmarks/ports.bm (%latin1-port): Use 'set-port-encoding!' to set the string port encoding. (%utf8/ascii-port, %utf8/wide-port, "rdelim"): Don't set %default-port-encoding before creating string ports. * test-suite/tests/r6rs-ports.test ("lookahead-u8 non-ASCII"): Don't set %default-port-encoding before creating string ports. ("put-bytevector with UTF-16 string port", "put-bytevector with wrong-encoding string port"): Use 'set-port-encoding!' to set the string port encoding. * test-suite/tests/print.test (tprint): Use 'set-port-encoding!' to set the string port encoding. ("truncated-print"): Use 'pass-if-equal'. * test-suite/tests/ports.test ("encoding failure leads to exception", "%default-port-encoding is honored", "peek-char [latin-1]", "peek-char [utf-8]", "peek-char [utf-16]"): Remove tests. ("%default-port-encoding is ignored", "peek-char"): Add tests. ("suitable encoding [latin-1]", "suitable encoding [latin-3]", "wrong encoding, error", "wrong encoding, substitute", "wrong encoding, escape"): Use 'set-port-encoding!' to set the string port encoding. ("%default-port-encoding, wrong encoding"): Rewrite to use a file port instead of a string port. 2013-08-07 David Kastrup Fix display of symbols containing backslashes. Fixes . * libguile/print.c (print_extended_symbol): Double print backslashes. 2013-08-06 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/numbers.c libguile/vm-i-scheme.c Add files from 'copysign' and 'isfinite' Gnulib modules. * lib/copysign.c: * lib/isfinite.c: * lib/isnanf-nolibm.h: * lib/isnanl-nolibm.h: * lib/signbitd.c: * lib/signbitf.c: * lib/signbitl.c: * m4/copysign.m4: * m4/isfinite.m4: * m4/signbit.m4: New files. RTL VM: Avoid untagging inums in 'logand' and 'logior'. * libguile/vm-engine.c (logand, logior): Avoid untagging. RTL VM: Avoid signed overflows in 'add1' and 'sub1'. * libguile/vm-engine.c (INUM_MIN, INUM_MAX): Redefine without making assumptions about the representation. (INUM_STEP): New macro. (add1, sub1): Avoid signed overflows, and use INUM_STEP. RTL VM: ash: Use SCM_SRS and fix large right shifts in fast path. * libguile/vm-engine.c (ash): Use SCM_SRS, and handle large right shifts properly. VM: ash: Use SCM_SRS and handle large right shift in fast path. * libguile/vm-i-scheme.c (ash): Use SCM_SRS. Handle inum right shift by more than SCM_I_FIXNUM_BIT-1 bits in fast path. Use Gnulib's 'isfinite' in numbers.c. * libguile/numbers.c (DOUBLE_IS_FINITE, DOUBLE_IS_POSITIVE_INFINITY, DOUBLE_IS_NEGATIVE_INFINITY): Remove. (scm_odd_p, scm_even_p, scm_finite_p, icmplx2str, scm_rational_p, scm_inexact_to_exact): Use 'isfinite' instead of 'DOUBLE_IS_FINITE'. Use Gnulib's 'copysign' in numbers.c. * libguile/numbers.c (double_is_non_negative_zero): Remove. (idbl2str, scm_max, scm_min, scm_angle, log_of_shifted_double, scm_log10): Use 'copysign' to check signs of zeroes, instead of 'double_is_non_negative_zero'. Import 'copysign' and 'isfinite' modules from Gnulib. * lib/Makefile.am: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: Add 'copysign' and 'isfinite' Gnulib modules. 2013-08-05 Mark H Weaver VM: ASM_ADD and ASM_SUB for x86: clobber _CX not "rcx". * libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB): Clobber _CX not "rcx". VM: Define ASM_MUL on ARM only if SMULL instruction is supported. * libguile/vm-i-scheme.c (ASM_MUL): Define only if the target architecture is known to implement the SMULL instruction. 2013-08-04 Mark H Weaver VM: Implement ASM_ADD, ASM_SUB, and ASM_MUL for ARM processors. * libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB, ASM_MUL): Implement for ARM. 2013-08-03 Mark H Weaver VM: Avoid untagging inums in 'logand' and 'logior'. * libguile/vm-i-scheme.c (logand, logior): Avoid untagging. VM: Add ASM_MUL for x86. * libguile/vm-i-scheme.c (ASM_MUL): New macro. (mul): Use ASM_MUL if available. VM: Support 32-bit x86 in ASM_ADD and ASM_SUB. * libguile/vm-i-scheme.c (_CX): New macro. (ASM_ADD, ASM_SUB): Replace references to "rcx" with _CX. VM: Add "cc" to the clobber list of ASM_ADD and ASM_SUB. * libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB): Add "cc" to the clobber list. Suggested by Göran Weinholt . VM: Avoid overflow in ASM_ADD when the result is most-positive-fixnum. * libguile/vm-i-scheme.c (ASM_ADD): Remove the tag from one of the operands before adding, to avoid overflow when the result is the most positive fixnum. VM: Avoid signed overflows in 'add1' and 'sub1'. * libguile/vm-i-scheme.c (INUM_STEP): New macro. (add1, sub1): Avoid signed overflows, and use INUM_STEP. VM: Redefine INUM_MIN and INUM_MAX without assumptions. * libguile/vm-i-scheme.c (INUM_MIN, INUM_MAX): Redefine to avoid assumptions about the representation of inums. 2013-08-02 Mark H Weaver Add 'scm_i_from_double' and use it. * libguile/numbers.c (scm_i_from_double): New static function. (scm_from_double): Just call 'scm_i_from_double'. (scm_inf, scm_nan, scm_abs, scm_i_inexact_floor_quotient, scm_i_inexact_floor_remainder, scm_i_inexact_floor_divide, scm_i_inexact_ceiling_quotient, scm_i_inexact_ceiling_remainder, scm_i_inexact_ceiling_divide, scm_i_inexact_truncate_quotient, scm_i_inexact_truncate_remainder, scm_i_inexact_truncate_divide, scm_i_inexact_centered_quotient, scm_i_inexact_centered_remainder, scm_i_inexact_centered_divide, scm_i_inexact_round_quotient, scm_i_inexact_round_remainder, scm_i_inexact_round_divide, scm_max, scm_min, scm_sum, scm_difference, scm_product, scm_divide, scm_truncate_number, scm_round_number, scm_floor, scm_ceiling, scm_expt, scm_sin, scm_cos, scm_tan, scm_sinh, scm_cosh, scm_tanh, scm_asin, scm_acos, scm_atan, scm_sys_asinh, scm_sys_acosh, scm_sys_atanh, scm_real_part, scm_imag_part, scm_magnitude, scm_angle, scm_exact_to_inexact, log_of_shifted_double, log_of_fraction, scm_log10, scm_exp, scm_sqrt, scm_init_numbers): Use 'scm_i_from_double' instead of 'scm_from_double'. 2013-07-21 Andy Wingo RTL instructions have no rest args * libguile/instructions.c (FOR_EACH_INSTRUCTION_WORD_TYPE): * module/system/vm/assembler.scm (assembler): * module/system/vm/disassembler.scm (disassembler): Remove support for RTL instructions with rest args. 2013-07-21 Andy Wingo Use allocate-struct in define-record-type implementations * module/ice-9/boot-9.scm (iota): Move up. (make-record-type, define-record-type): Use allocate-struct and struct-set!. * module/srfi/srfi-9.scm (%%set-fields, %define-record-type): Use allocate-struct and struct-set!. Note that this makes the stack VM slower, but it will make RTL compilation faster. 2013-07-21 Andy Wingo add allocate-struct primitive and rtl opcode * libguile/struct.h: * libguile/struct.c (scm_allocate_struct): New interface: allocates a struct. * libguile/vm-engine.c (allocate_struct): Instead of make-struct with a rest arg, separate allocation from initialization. 2013-07-21 Andy Wingo abort is no longer an op with rest args * libguile/vm-engine.c (abort): No longer an op with rest args. 2013-07-21 Andy Wingo call is no longer a vararg instruction * libguile/vm-engine.c (push_frame, call): Separate out push_frame from call, and expect the caller to arrange the proc and arguments. * test-suite/tests/rtl.test ("call"): Update tests. 2013-07-21 Andy Wingo RTL: Local 0 is the procedure * libguile/vm-engine.c: Change the RTL VM to number the procedure as local 0, and other locals from 1. In the future we will want the FP to point to local 0 instead of local 1. In the future also we can elide the procedure for well-known closures (closures in which all references are known call sites). (make_closure, free_set): Instead of taking rest arguments, we add a new free-set! op that initializes closures. (free_ref): Take the closure as an argument. * libguile/vm.c (rtl_boot_continuation_code): Remove comments, which were out of date. (rtl_apply_code, rtl_values_code): Update comments. * module/system/vm/assembler.scm (intern-constant, emit-init-constants): Adapt to locals numbering change. (begin-kw-arity): For assert-nargs-ee purposes, nreq includes the procedure. * module/system/vm/disassembler.scm (code-annotation): Adapt annotation for assert-nargs-ee/locals. * test-suite/tests/rtl.test: Adapt tests. 2013-07-21 Andy Wingo rtl: propagate OP_DST to scheme * libguile/instructions.c (scm_rtl_instruction_list): Add an element to the list to indicate that an instruction outputs to its first argument. * module/system/vm/assembler.scm: * module/system/vm/disassembler.scm: Adapt. 2013-07-21 Andy Wingo free variable debugging access procedures for rtl * libguile/programs.c (scm_program_num_free_variables) (scm_program_free_variable_ref, scm_program_free_variable_set_x): Add support for RTL programs. 2013-07-21 Andy Wingo fix rtl program arity functions * libguile/programs.c (parse_arity): Lookup rtl-program-minimum-arity from (system vm debug). * module/system/vm/debug.scm (find-first-arity): Fix the linear search. Whoops! 2013-07-21 Mark H Weaver Optimize R6RS bitwise operators. * module/rnrs/arithmetic/bitwise.scm (bitwise-if, bitwise-length, bitwise-first-bit-set, bitwise-bit-field, bitwise-reverse-bit-field): Replace these with aliases to the identical SRFI-60 operators 'bitwise-if', 'integer-length', 'first-set-bit', 'bit-field', and 'reverse-bit-field'. (bitwise-copy-bit, bitwise-copy-bit-field, bitwise-rotate-bit-field): Reimplement these based upon the similar SRFI-60 operators 'copy-bit', 'copy-bit-field', and 'rotate-bit-field'. * test-suite/tests/r6rs-arithmetic-bitwise.test (bitwise-copy-bit): Fix test to conform to the specification, which requires the third argument to be either 0 or 1. * test-suite/tests/r6rs-arithmetic-fixnums.test (fxcopy-bit): Fix test to conform to the specification, which requires the third argument to be either 0 or 1. 2013-07-21 Mark H Weaver Fix incorrect rationalize tests. * test-suite/tests/fractions.test (fractions): Fix rationalize tests. Fix minor formatting error in 'rationalize'. * libguile/numbers.c (scm_rationalize): Fix formatting. 2013-07-21 Mark H Weaver Rewrite 'rationalize' to fix bugs and improve efficiency. Fixes . Reported by Göran Weinholt . * libguile/numbers.c (scm_rationalize): Rewrite. Previously an incorrect algorithm was used which failed in many cases. * test-suite/tests/numbers.test (rationalize): Add tests. 2013-07-18 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Modify SCM_UNPACK type check to avoid warnings in clang. * libguile/tags.h (SCM_UNPACK): Change (*(SCM*)0=(x)) to (*(volatile SCM *)0=(x)), to avoid null-dereference warnings from clang. Reported by Shane Celis . 2013-07-17 Ludovic Courtès Fix 'SCM_SYSCALL' to really swallow EINTR. * libguile/_scm.h (SCM_SYSCALL): Keep looping upon EINTR. Reported at . build: Add `gdbinit' to the distribution. * Makefile.am (EXTRA_DIST): Add gdbinit. 2013-07-17 Mark H Weaver Add support for HTTP proxies. * module/web/http.scm (http-proxy-port?, set-http-proxy-port?!): New exported procedures. (write-request-line): If we're using an http proxy, write an absolute-URI in the request line. * module/web/client.scm: Import (web http). (current-http-proxy): New exported parameter. (open-socket-for-uri): If 'current-http-proxy' is not false, connect to the proxy instead of the URI host, and use 'set-http-proxy-port?!' to make note of that fact. * doc/ref/web.texi (Web Client): Document 'current-http-proxy'. 2013-07-16 Mark H Weaver Fix R6RS 'fixnum-width'. Fixes . Reported by Göran Weinholt . * module/rnrs/arithmetic/fixnums.scm (fixnum-width): Rewrite to avoid inexact arithmetic, and correct the off-by-one error. * test-suite/tests/r6rs-arithmetic-fixnums.test (fixnum-width): Add tests. 2013-07-16 Mark H Weaver Update copyright dates of recently-changed R6RS bitwise/flonums files. * module/rnrs/arithmetic/bitwise.scm: module/rnrs/arithmetic/flonums.scm: test-suite/tests/r6rs-arithmetic-bitwise.test: test-suite/tests/r6rs-arithmetic-flonums.test: Add 2013 to the copyright dates. 2013-07-16 Mark H Weaver Fix 'fxbit-count' for negative arguments. Reported by Göran Weinholt . * module/rnrs/arithmetic/fixnums.scm (fxbit-count): If the argument is negative, return the 'bitwise-not' of the result of 'logcount', as per R6RS. Previously, 'fxbit-count' was identical to 'logcount'. * test-suite/tests/r6rs-arithmetic-fixnums.test (fxbit-count): Add test. 2013-07-16 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/numbers.c 2013-07-16 Mark H Weaver gcd and lcm support inexact integer arguments. Fixes . Reported by Göran Weinholt . * libguile/numbers.c (scm_gcd, scm_lcm): Support inexact integers. * test-suite/tests/numbers.test (gcd, lcm): Add tests. 2013-07-16 Mark H Weaver min and max: NaNs beat infinities, per R6RS errata. Fixes . Reported by Göran Weinholt . * libguile/numbers.c (scm_min, scm_max): NaNs beat infinities, as per the R6RS errata. * test-suite/tests/numbers.test (min, max): Update tests. 2013-07-16 Mark H Weaver Flonum operations always return flonums. Fixes . Reported by Göran Weinholt . * module/rnrs/arithmetic/flonums.scm (ensure-flonum): New procedure. (fllog): Rewrite using case-lambda. Handle negative zeroes. Use 'ensure-flonum'. (flatan): Rewrite using case-lambda. (flasin, flacos, flsqrt, flexpt): Use 'ensure-flonum'. * test-suite/tests/r6rs-arithmetic-flonums.test (fllog, flasin, flacos, flsqrt, flexpt): Add tests. 2013-07-16 Mark H Weaver flfinite? applied to a NaN returns false. Fixes . Reported by Göran Weinholt . * module/rnrs/arithmetic/flonums.scm (flfinite?): If the argument is a NaN, return false. * test-suite/tests/r6rs-arithmetic-flonums.test (flfinite?): Add test. 2013-07-16 Mark H Weaver flonum? returns false for complex number objects. Fixes . Reported by Göran Weinholt . * module/rnrs/arithmetic/flonums.scm (flonum?): Use 'real?' instead of 'number?'. * test-suite/tests/r6rs-arithmetic-flonums.test (flonum?): Add tests. 2013-07-16 Mark H Weaver Allow fl+ and fl* to accept zero arguments. Fixes . Reported by Göran Weinholt . * module/rnrs/arithmetic/flonums.scm (fl+, fl*): Accept zero arguments. * test-suite/tests/r6rs-arithmetic-flonums.test (fl+, fl*): Add tests. 2013-07-16 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' numbers.test: Fix inum/flonum comparison test on 32-bit machines. * test-suite/tests/numbers.test (<): Fix inum/flonum test. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/keywords.c libguile/vm.c 2013-07-16 Mark H Weaver Avoid lossy conversion from inum to double in numerical comparisons. * libguile/numbers.c (scm_less_p): Avoid converting inums to doubles. * test-suite/tests/numbers.test (<): Add tests. 2013-07-16 Mark H Weaver numbers.test: Avoid inexact arithmetic in computation of fixnum-bit. * test-suite/tests/numbers.test (fixnum-bit): Rewrite to avoid inexact arithmetic. 2013-07-16 Mark H Weaver Fix bugs in numerical equality predicate. * libguile/numbers.c (scm_num_eq_p): Fix bug comparing fractions to infinities (reported by Göran Weinholt ). Fix erroneous comment describing the logic behind inum/flonum comparison. Use similar logic for inum/complex comparison to avoid rounding errors. Make minor indentation fixes and simplifications. * test-suite/tests/numbers.test (=): Add tests. 2013-07-16 Mark H Weaver Fix rounding in scm_i_divide2double for negative arguments. * libguile/numbers.c (INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE): New macro. (scm_i_divide2double): Use INUM_LOSSLESSLY_CONVERTIBLE_TO_DOUBLE to determine if our fast path is safe. Previously, negative arguments were not checked properly. * test-suite/tests/numbers.test (exact->inexact): Add tests. 2013-07-14 Mark H Weaver Fix VM 'ash' for right shifts by large amounts. Fixes . Reported by Göran Weinholt . * libguile/vm-i-scheme.c (ash): Fallback to 'scm_ash' for right shifts with counts >= SCM_I_FIXNUM_BIT, since '>>' is not guaranteed to work correctly for large counts. 2013-07-14 Mark H Weaver Fix 'bitwise-bit-count' for negative arguments. Fixes . Reported by Göran Weinholt . * module/rnrs/arithmetic/bitwise.scm (bitwise-bit-count): If the argument is negative, return the 'bitwise-not' of the result of 'logcount', as per R6RS. Previously, 'bitwise-bit-count' was identical to 'logcount'. 2013-07-06 Andy Wingo body and handler are lambdas; add escape-only? field * module/language/tree-il.scm (): Change to have the body and handler be lambdas, and add an "escape-only?" field. This will make generic prompts work better in CPS or ANF with the RTL VM, as it doesn't make sense in that context to capture only part of a frame. Escape-only prompts can still be fully inlined. (parse-tree-il, unparse-tree-il): Add escape-only? to the serialization. (make-tree-il-folder, pre-post-order): Deal with escape-only?. * module/language/tree-il/analyze.scm (analyze-lexicals): Handle escape-only?, and the new expectations for the body and handler. * module/language/tree-il/canonicalize.scm (canonicalize): Ensure that the body of an escape-only continuation is a thunk, and that the handler is always a lambda. * module/language/tree-il/debug.scm (verify-tree-il): Assert that escape-only? is a boolean. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (*primitive-expand-table*): * test-suite/tests/peval.test ("partial evaluation"): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Adapt to change. 2013-06-28 Andy Wingo Simplify dynstack API to only wind one fluid at a time * libguile/dynstack.h (SCM_DYNSTACK_TYPE_WITH_FLUID): Rename from with-fluids. * libguile/dynstack.c (scm_dynstack_push_fluid): (scm_dynstack_unwind_fluid): Change API to only wind/unwind one fluid binding. (WITH_FLUID_WORDS): New define, always 2 words (fluid and value box). (WITH_FLUID_FLUID, WITH_FLUID_VALUE_BOX): New macros to get offsets of fluid and value box. (scm_dynstack_push_rewinder, scm_dynstack_push_unwinder): Use WINDER_WORDS. (scm_dynstack_push_dynwind): Use DYNWIND_WORDS. (scm_dynstack_wind_1): Update for scm_swap_fluid API change. * libguile/fluids.h: * libguile/fluids.c (scm_prepare_fluids): Remove; no longer needed. (scm_swap_fluid): Update to just swap one fluid binding. (scm_c_with_fluids, scm_c_with_fluid): Update to use scm_dynstack_push_fluid. * libguile/memoize.c (do_push_fluid, do_pop_fluid): Adapt to API change. * libguile/vm-engine.c (rtl_vm_engine): Change wind-fluids / unwind-fluids to push-fluid / pop-fluid, and actually enable. Woo! * libguile/vm-i-system.c (push-fluid, pop-fluid): Update to new API. 2013-06-28 Andy Wingo Remove with-fluids; replaced by with-fluid* and inlined push-fluid primops * libguile/vm-i-system.c (push-fluid, pop-fluid): * doc/ref/vm.texi (Dynamic Environment Instructions): Rename wind-fluids to push-fluid, and unwind-fluids to pop-fluid. They now only work on one fluid binding at a time. * module/ice-9/boot-9.scm (with-fluid*): Implement in Scheme in terms of primcalls to push-fluid and pop-fluid. (custom-throw-handler, catch, with-throw-handler): Use with-fluid* instead of with-fluids, as with-fluids is no longer available before psyntax is loaded. (with-fluids): Define in Scheme in terms of with-fluid*. * libguile/fluids.c (scm_with_fluid): Rename from scm_with_fluids, and don't expose to Scheme. * libguile/eval.c (eval): Remove SCM_M_WITH_FLUIDS case. * libguile/expand.c (expand_with_fluids): Remove with-fluids syntax. (DYNLET): Remove, no longer defining dynlet in the %expanded-vtables. * libguile/expand.h: Remove dynlet definitions. * module/ice-9/eval.scm (primitive-eval): Remove with-fluids case. * libguile/memoize.c (do_push_fluid, do_pop_fluid): New primitive helpers, like wind and unwind. (memoize): Memoize wind and unwind primcalls. Don't memoize dynlet to with-fluids. (scm_init_memoize): Initialize push_fluid and pop_fluid here. * libguile/memoize.h (SCM_M_WITH_FLUIDS): Remove definition. * module/ice-9/psyntax.scm (build-dynlet): Remove; this just supported with-fluids, which is now defined in boot-9. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/compiler.texi (Tree-IL): * module/language/tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/canonicalize.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/cse.scm: * module/language/tree-il/debug.scm: * module/language/tree-il/effects.scm: Remove . Add cases for primcalls to push-fluid and pop-fluid in compile-glil.scm and effects.scm. * module/language/tree-il/peval.scm (peval): Factor out with-temporaries; probably a bad idea, but works for now. Factor out make-begin0 (a better idea). Inline primcalls to with-fluid*, and remove dynlet cases. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add with-fluid*. 2013-06-27 Andy Wingo replace with primcalls to fluid-set! * doc/ref/compiler.texi (Tree-IL): Remove mention of . * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynset. * module/language/tree-il.scm (, parse-tree-il): (unparse-tree-il, make-tree-il-folder, pre-post-order): Remove . * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add fluid-set!. (flatten-lambda-case): Remove case. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): Remove cases. * module/language/tree-il/effects.scm (make-effects-analyzer): Remove case. Add a primcall fluid-set! case. * module/language/tree-il/peval.scm (peval): Remove dynset cases. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove fluid-set! -> dynset transformation. 2013-06-27 Andy Wingo replace with primcalls to fluid-ref * doc/ref/compiler.texi (Tree-IL): Remove mention of . * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynref. * module/language/tree-il.scm (, parse-tree-il): (unparse-tree-il, make-tree-il-folder, pre-post-order): Remove . * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add fluid-ref. (flatten-lambda-case): Remove case. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): Remove cases. * module/language/tree-il/effects.scm (make-effects-analyzer): Remove case. Add a primcall fluid-ref case. * module/language/tree-il/peval.scm (peval): Remove dynref cases. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove fluid-ref -> dynref transformation. 2013-06-27 Andy Wingo dynamic-wind in terms of wind and unwind; remove , @dynamic-wind * doc/ref/compiler.texi: Remove mention of . * libguile/eval.c (eval): Remove SCM_M_DYNWIND case. * libguile/expand.c: Remove scm_sym_at_dynamic_wind. * libguile/memoize.c (do_wind, do_unwind): A couple of hacky subrs. If we see a wind or unwind primcall, we expand to a call of a quoted subr value. It works and removes a kind of memoized value from the interpreter. For the compiler,primcalls to wind and unwind are handled specially. (MAKMEMO_DYNWIND): Remove. (scm_tc16_memoizer): Remove. Yay! (memoize): Remove speculative lookup for toplevels to see if they are memoizers: there are no more memoizers. Memoize calls to the wind and unwind primitives. (m_dynamic_wind): Remove. (unmemoize): Remove dynwind case. (scm_init_memoize): Add wind and unwind local definitions. * module/ice-9/boot-9.scm (dynamic-wind): Reimplement in terms of "wind" and "unwind" primitives. These primitives are not exposed to other modules. * module/ice-9/eval.scm (primitive-eval): Remove dynwind case. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynwind cases. * module/language/tree-il.scm: Remove . Yaaay! * module/language/tree-il/analyze.scm (analyze-lexicals): Remove dynwind cases. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add wind and unwind. (flatten-lambda-case): Remove dynwind case. Yay! * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (singly-valued-expression?, peval): Remove cases. Inline primcalls to dynamic-wind. Add constant folding for thunk?. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Remove @dynamic-wind, and add procedure? and thunk?. (*effect+exception-free-primitives*): Add procedure? and thunk?. (*multiply-valued-primitives*): Remove @dynamic-wind. Remove @dynamic-wind expander. * test-suite/tests/peval.test ("partial evaluation"): Update tests for dynwind desugaring. 2013-06-27 Andy Wingo remove @call-with-values memoizer * libguile/memoize.h: * libguile/expand.c (scm_sym_at_call_with_values): Remove. * libguile/memoize.c (memoize, m_call_values, unmemoize): Adapt to memoize call-with-values primcalls. * module/ice-9/boot-9.scm (call-with-values): Expand to a call-with-values primcall. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Expect call-with-values primcall, without the @, and fall back to a normal call. * module/language/tree-il/peval.scm (peval): Match bare call-with-values. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @call-with-values. 2013-06-27 Andy Wingo remove @call-with-current-continuation memoizer * module/ice-9/boot-9.scm (call-with-current-continuation): Change to primcall call-with-current-continuation. * libguile/memoize.h: * libguile/expand.c (scm_sym_atcall_cc): Remove. * libguile/memoize.c (memoize): Memoize call/cc primcalls to SCM_M_CONT. (m_call_cc): Remove. (unmemoize): Unmemoize to call-with-current-continuation. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update to call-with-current-continuation without @ prefix, and fix fallback case. * module/language/tree-il/primitives.scm (*multiply-valued-primitives*): (*interesting-primitive-names*): Remove @call-with-current-continuation. (call/cc): Expand to call-with-current-continuation. * test-suite/tests/tree-il.test ("call/cc"): Update to use and expect call-with-current-continuation primcalls / toplevel refs. 2013-06-27 Andy Wingo remove apply:nconc2last * libguile/eval.c (scm_nconc2last): Remove, now unused. * doc/ref/api-evaluation.texi (Fly Evaluation): Remove docs. 2013-06-27 Andy Wingo remove @apply memoizer * libguile/memoize.c (memoize): Recognize a primcall to 'apply as SCM_M_APPLY. (@apply): Remove @apply memoizer. (unmemoize): Unmemoize using "apply", not "@apply". * libguile/memoize.h: * libguile/expand.c (scm_sym_atapply): Remove. * module/ice-9/boot-9.scm (apply): Re-implement using apply primcall. Use case-lambda, so as to give an appropriate minimum arity. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Compile a primcall of "apply" specially, not "@apply". * module/language/tree-il/peval.scm (peval): Match primcalls to "apply", not "@apply". Residualize "apply" primcalls. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @apply, and apply primitive expander. * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Update tests to expect residualized "apply". * test-suite/tests/procprop.test ("procedure-arity"): Update test for better apply arity. * test-suite/tests/strings.test ("string"): Update expected error. 2013-06-27 Andy Wingo Remove @prompt memoizer * libguile/memoize.h: * libguile/memoize.c (MAKMEMO_CALL_WITH_PROMPT, memoize, unmemoize): Remove the @prompt memoizer in favor of recognizing call-with-prompt primcalls. Rename SCM_M_PROMPT to SCM_M_CALL_WITH_PROMPT, and pass a thunk instead of an expression so that it has normal applicative order. * libguile/expand.c (PRIMITIVE_REF, PRIMCALL, expand): Produce primcalls from forms whose car is a primitive. (expand_atat): Recognize (@@ primitive FOO) as being a primitive-ref. * module/ice-9/boot-9.scm (call-with-prompt): Instead of dispatching to the wonky @prompt memoizer, residualize a primcall to call-with-prompt. The memoizer will DTRT to allow call-with-prompt to be interpreted correctly without needing an additional binding. * module/ice-9/eval.scm (primitive-eval): Change the 'prompt clause to a call to call-with-prompt. * module/language/tree-il/primitives.scm: No more need to recognize @prompt. * libguile/eval.c (eval): Adapt to SCM_M_PROMPT renaming to SCM_M_CALL_WITH_PROMPT, and apply the thunk. * libguile/throw.c (pre_init_throw): Adapt to scm_abort_to_prompt_star rename. 2013-06-25 Andy Wingo abort-to-prompt* instead of @abort * libguile/control.h: * libguile/control.c (scm_abort_to_prompt_star): Rename from scm_at_abort. * module/ice-9/boot-9.scm (abort-to-prompt): Use abort-to-prompt*. * module/language/tree-il/primitives.scm: Handle abort-to-prompt* instead of @abort. 2013-06-23 Andy Wingo psyntax: ((@@ primitive NAME) ARG ...) in (guile) module is a primcall * ice-9/psyntax.scm (@@): Recognize new form, (@@ primitive NAME), which in operator position expands to a primcall. This expansion is only available for forms in the (guile) module. Added an argument to @@ and @ procedures, the module, for use by expanded syntax objects; adapted callers. (analyze-variable): Error when accessing a primitive for value. (get-global-definition-hook): Primitives are not macros. (syntax-type): A form with a primitive in the car is a primitive-call. (expand-expr): Residualize primitive calls as primcalls. (syntax-local-binding): Return 'primitive as the type for primitives. 2013-06-17 Mark H Weaver Fix bug in remqueue in threads.c when removing last element. Reported and debugged by Andrew Gaylard . * libguile/threads.c (remqueue): When removing the last element from a queue with more than one element, set (car q) to the previous element. * THANKS: Thank Andrew Gaylard. 2013-06-16 Ludovic Courtès Fix #ifdefery for `setegid'. * libguile/posix.c (scm_setegid): Change to #ifdef HAVE_SETEGID. tests: Don't rely on `scm_call_2' being visible. * test-suite/tests/coverage.test ("procedure-execution-count")["called from C"]: Throw 'unresolved when `scm_call_2' cannot be resolved. Reported by Eli Zaretskii . Augment `.dir-locals.el'. tests: Remove symlink only when it exists. * test-suite/tests/filesys.test: Delete (test-symlink) only if it exists---i.e., not on Windows. Reported by Eli Zaretskii . tests: Skip FFI tests that use `qsort' when it's not accessible. * test-suite/tests/foreign.test ("procedure->pointer")[qsort]: Wrap in `false-if-exception'. ["qsort", "qsort, wrong return type", "qsort, wrong arity"]: Throw 'unresolved when QSORT if #f. Reported by Eli Zaretskii . 2013-06-16 Andy Wingo no longer has "pre" or "post" fields * module/language/tree-il.scm (): Remove pre and post fields from . A dynwind now assumes that in normal entry and exit, that the code runs the winders and unwinders using and and such things. (parse-tree-il, unparse-tree-il, make-tree-il-folder, pre-post-order): Adapt users. * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): Adapt. * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (*primitive-expand-table*): Produce tree-il that calls the winder and unwinder. Recognize singly-valued dynamic-wind expressions. * test-suite/tests/peval.test ("partial evaluation"): Add tests. 2013-06-16 Ludovic Courtès tests: Don't rely on $TMPDIR and /tmp on Windows. * test-suite/standalone/test-unwind.c (check_ports)[__MINGW32__]: Use $TEMP, $TMP, or / as the value for TMPDIR. Patch by Eli Zaretskii . tests: Use double quotes around shell arguments, for Windows. * test-suite/standalone/test-system-cmds (test-system-cmd): Use double quotes around shell arguments. Reported by Eli Zaretskii . Define `AF_UNIX' only when Unix-domain sockets are supported. * libguile/socket.c (scm_init_socket): Defined `AF_UNIX' only when `HAVE_UNIX_DOMAIN_SOCKETS' is defined. Reported by Eli Zaretskii . 2013-06-16 Andy Wingo Reduce call-with-values to let for singly-valued producers * module/language/tree-il/peval.scm (singly-valued-expression?): Add support for conditionals. In the future we should add more expressions here. (peval): Don't inline values into the body of a dynwind, as that could cause the consumer to run in the wrong dynamic context. If the producer is singly-valued and the consumer just has a rest arg, reduce to "let" and cons up a list in the consumer. This may reduce further. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2013-06-10 Andy Wingo Rewrite make-tree-il-folder to use the Wright matcher. * module/language/tree-il.scm (make-tree-il-folder): Rewrite to use the Wright matcher instead of record-case. Rewrite unparse-tree-il to use the Wright matcher. * module/language/tree-il.scm (unparse-tree-il): Rewrite to use the Wright matcher. Rewrite parse-tree-il to use the Wright matcher. * module/language/tree-il.scm (parse-tree-il): Rewrite to use match instead of pmatch. Remove pmatch import. 2013-06-10 Andy Wingo Implement tree-il-fold in terms of make-tree-il-folder. * module/language/tree-il.scm (tree-il-fold): Implement using make-tree-il-folder. This is an incompatible change: there is no more "leaf" procedure, and tree-il-fold only works on tree-il and not lists. * module/language/tree-il/analyze.scm (, analyze-tree): Adapt to tree-il-fold change, losing the "leaf" handler. (unused-variable-analysis, unused-toplevel-analysis) (unbound-variable-analysis, arity-analysis): Adapt to tree-analysis change. * module/language/tree-il/canonicalize.scm (tree-il-any) * module/language/tree-il/cse.scm (build-assigned-var-table) * module/language/tree-il/peval.scm (tree-il-any, build-var-table) (peval): Adapt to tree-il-fold change. * test-suite/tests/tree-il.test ("tree-il-fold"): Adapt tests for new interface and expectations. 2013-06-10 Andy Wingo Rewrite tree-il pre-post-order in terms of (ice-9 match) * module/language/tree-il.scm (pre-post-order): Re-implement in terms of (ice-9 match), so that we standardize on one matcher (more or less). 2013-06-10 Andy Wingo Pre-order tree-il rewrites are now non-destructive * module/language/tree-il.scm (pre-order): Re-implement in terms of pre-post-order, and rename from pre-order!. * module/language/tree-il/primitives.scm (expand-primitives): Adapt to pre-order change, and rename from expand-primitives!. * module/language/tree-il/optimize.scm (optimize): Adapt to expand-primitives! change, and rename from optimize!. * module/language/tree-il/compile-glil.scm: * module/system/repl/common.scm: * test-suite/tests/cse.test: * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Adapt to expand-primitives and optimize changes. 2013-06-10 Andy Wingo Tree-il post-order rewriter no longer destructive * module/language/tree-il.scm (pre-post-order): New helper, like pre-order! and post-order! but not destructive. (post-order): Implement in terms of pre-post-order, and rename from post-order!. * module/ice-9/compile-psyntax.scm (squeeze-tree-il): * module/language/tree-il/canonicalize.scm (canonicalize): * module/language/tree-il/fix-letrec.scm (fix-letrec): * module/language/tree-il/primitives.scm (resolve-primitives): Use post-order, and rename from the destructive variants (squeeze-tree-il!, canonicalize!, etc). Adapt callers. * test-suite/tests/tree-il.test (strip-source): Adapt to post-order. * test-suite/tests/cse.test: * test-suite/tests/peval.test: * module/language/tree-il/optimize.scm: Adapt callers. 2013-06-10 Andy Wingo Simplify let-values to let if consumer binds only one variable * module/language/tree-il/peval.scm (peval): let-values with a consumer that has only one argument is the same as let. * test-suite/tests/peval.test ("partial evaluation"): Add test. 2013-06-10 Andy Wingo fix linker.test * test-suite/tests/linker.test (link-elf-with-one-main-section): Fix test after string table change. 2013-06-10 Mark H Weaver Allow #f as timeout argument to unlock-mutex and SRFI-18 mutex-unlock! Reported by Chaos Eternal Based on a patch by Nala Ginrut * libguile/threads.c (scm_unlock_mutex_timed): If 'timeout' argument is false, interpret that as no timeout. * doc/ref/api-scheduling.texi (Mutexes and Condition Variables): Update documentation. 2013-06-10 Mark H Weaver Fix tests for 'scm_c_bind_keyword_arguments'. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (error_handler): Remove function. (unrecognized_keyword_error_handler, invalid_keyword_error_handler, odd_length_error_handler): New functions. (test_scm_c_bind_keyword_arguments): Use new error handler functions. 2013-06-09 Andy Wingo procedure-properties for RTL functions * module/system/vm/assembler.scm (link-procprops, link-objects): Arrange to write procedure property links out to a separate section. * libguile/procprop.c (scm_procedure_properties): * libguile/programs.h: * libguile/programs.c (scm_i_rtl_program_properties): * module/system/vm/debug.scm (find-program-properties): Wire up procedure-properties for RTL procedures. Yeah! Fistpumps! :) * module/system/vm/debug.scm (find-program-debug-info): Return #f if the string is "", as it is if we don't have a name. Perhaps elf-symbol-name should return #f in that case... * test-suite/tests/rtl.test: Add some tests. 2013-06-09 Andy Wingo procedure-documentation works on RTL procedures * libguile/procprop.h: * libguile/procprop.c (scm_procedure_documentation): Move here from procs.c, and to make the logic more similar to that of procedure-name, which allows RTL programs to dispatch to rtl-program-documentation. * libguile/programs.c (scm_i_rtl_program_documentation): * libguile/programs.h: * module/system/vm/program.scm (rtl-program-documentation): New plumbing. * module/system/vm/debug.scm (find-program-docstring): New interface to grovel ELF for a docstring. 2013-06-09 Andy Wingo Write docstrings into RTL ELF images * module/system/vm/assembler.scm (link-docstrs): Write docstrings. (link-objects): Link docstrings into the ELF. 2013-06-09 Andy Wingo Wire up ability to print RTL program arities * libguile/procprop.c (scm_i_procedure_arity): Allow RTL programs to dispatch to scm_i_program_arity. * libguile/programs.c (scm_i_program_print): Refactor reference to write-program. (scm_i_rtl_program_minimum_arity): New procedure, dispatches to Scheme. (scm_i_program_arity): Dispatch to scm_i_rtl_program_minimum_arity if appropriate. * module/system/vm/debug.scm (program-minimum-arity): New export. * module/system/vm/program.scm (rtl-program-minimum-arity): New internal function. (program-arguments-alists): New helper, implemented also for RTL procedures. (write-program): Refactor a bit, and call program-arguments-alists. * test-suite/tests/rtl.test ("simply procedure arity"): Add tests that arities make it all the way to cold ELF and back to warm Guile. 2013-06-09 Andy Wingo (system vm debug) can read arity information * module/system/vm/debug.scm (): New object, for reading arities. Unlike in the assembler, this one only holds on to a couple of pointers, and doesn't even load in argument names. Unlike the arity lists in (system vm program), it can load in names. Very early days but it does seem to work. (find-program-arities, arity-arguments-alist): New higher-level interfaces. RTL assembler writes arities information into separate section. * module/system/vm/assembler.scm: Write arities into a .guile.arities section and associated .guile.arities.strtab. 2013-06-09 Andy Wingo Beginnings of tracking of procedure arities in assembler * module/system/vm/assembler.scm (, ): Assembler now tracks arities of a function. (begin-standard-arity, begin-opt-arity, begin-kw-arity, end-arity): New macro-assemblers. * test-suite/tests/rtl.test: Adapt all tests to use begin-standard-arity and end-arity. 2013-06-09 Andy Wingo add procedure prelude macro-instructions * module/system/vm/assembler.scm (pack-flags): New helper. (standard-prelude, opt-prelude, kw-prelude): New macro-instructions. * test-suite/tests/rtl.test: Update tests to use standard-prelude. 2013-06-09 Andy Wingo begin-program takes properties alist * module/system/vm/assembler.scm (assert-match): New helper macro to check argument types. (): Add properties field. Rename name field to "label" to indicate that it should be unique. (make-meta, meta-name): New helpers. (begin-program): Take additional properties argument. (emit-init-constants): Adapt to begin-program change. (link-symtab): Allow for anonymous procedures. * test-suite/tests/rtl.test: Adapt tests. 2013-06-09 Andy Wingo Add RTL disassembler * module/Makefile.am: * module/system/vm/disassembler.scm: New module. * module/system/repl/command.scm (disassemble): Work with RTL programs. 2013-06-09 Andy Wingo RTL programs print with their name * libguile/print.c (iprin1): Use scm_i_program_print for RTL programs too. * libguile/procprop.c (scm_procedure_name): For RTL programs, call scm_i_rtl_program_name if there is no override. * libguile/programs.h: * libguile/programs.c (scm_i_rtl_program_name): New helper, dispatches to (system vm program). (scm_i_program_print): For RTL programs, the fallback prints the code pointer too. * module/system/vm/program.scm (rtl-program-name): Use the debug info to get an RTL program name. (write-program): Work with RTL programs too. * test-suite/tests/rtl.test ("procedure name"): Add test. 2013-06-09 Andy Wingo move procedure-name and procedure-source to procprop.c * libguile/procprop.h: * libguile/procprop.c (scm_procedure_name, scm_procedure_source): Move these functions here, from debug.[ch]. 2013-06-09 Andy Wingo Add runtime support for reading debug information from ELF * module/Makefile.am: * module/system/vm/debug.scm: New module. * module/system/vm/elf.scm (elf-section-by-name): New helper. (elf-symbol-table-len): New helper. * test-suite/tests/rtl.test: Add test for finding debug info. 2013-06-09 Andy Wingo Add RTL assembler * module/Makefile.am: * module/system/vm/assembler.scm: New module, implementing an assembler for RTL. * test-suite/Makefile.am: * test-suite/tests/rtl.test: New test suite. * module/system/vm/elf.scm (make-elf-symbol*): Add constructor; export as make-elf-symbol. (elf-symbol-len): New export. (write-elf32-symbol, write-elf64-symbol): New helpers. (write-elf-symbol): New export. 2013-06-09 Andy Wingo linker string tables are stateful objects * module/system/vm/linker.scm (make-string-table): Rework to be a stateful object instead of a function object. Works better in this case. Adapt users. (string-table-intern!): Rename from string-table-intern, and just return the index of the string. (link-string-table!): Rename from link-string-table, and set a flag to prevent interning strings after linking, as that's not going to work well. * module/language/objcode/elf.scm (bytecode->elf): Adapt. 2013-06-08 Andy Wingo const cleanups in instructions.c * libguile/instructions.c (fetch_rtl_instruction_table) (fetch_instruction_table): Make the returned table const. Adapt callers. (scm_rtl_instruction_list): Fix comment about format of return value. 2013-06-05 Ludovic Courtès Report the faulty keyword in errors raised by `scm_c_bind_keyword_arguments'. Reported by Mark H. Weaver. * libguile/keywords.c (scm_c_bind_keyword_arguments): Use `scm_error_scm' instead of `scm_error'. Pass the faulty keyword enclosed in a list as the last argument. * test-suite/tests/optargs.test ("scm_c_bind_keyword_arguments"): New test prefix. 2013-06-04 Ludovic Courtès Print the faulty object upon invalid-keyword errors. * libguile/vm.c (vm_error_kwargs_invalid_keyword, vm_error_kwargs_unrecognized_keyword): Add parameter. Pass it enclosed in a list as the last argument to `scm_error_scm'. * libguile/vm-i-system.c (bind_kwargs): Adjust accordingly. * libguile/eval.c (error_invalid_keyword, error_unrecognized_keyword): Add parameter. (prepare_boot_closure_env_for_apply): Adjust accordingly. * module/ice-9/eval.scm (primitive-eval): Likewise. * libguile/error.c (scm_error_scm): Mention `keyword-argument-error' in docstring. * module/ice-9/boot-9.scm (keyword-error-printer): New procedure; use it. * test-suite/tests/optargs.test (c&e, with-test-prefix/c&e): Remove. ("define*")["unrecognized keyword"]: Test the value passed along the `keyword-argument-error' exception. ["invalid keyword"]: New test. * doc/ref/api-control.texi (Error Reporting): Update `scm-error' description. 2013-05-31 Andy Wingo add new rtl vm * libguile/vm-engine.c (rtl_vm_engine): Add new VM. (vm_engine): Add support for calling RTL programs. * libguile/tags.h (scm_tc7_rtl_program): New type for procedures that run on the new VM. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): * libguile/print.c (iprin1): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p): Add hooks for the new tc7. * libguile/programs.h: * libguile/programs.c (scm_make_rtl_program, scm_i_rtl_program_print) (scm_rtl_program_p, scm_rtl_program_code): * module/system/vm/program.scm: Add constructors and accessors for the new "RTL programs". * libguile/vm.c (rtl_boot_continuation): Define a boot program. (rtl_apply, rtl_values): New static RTL programs. * libguile/frames.c (scm_frame_num_locals): Adapt for frames of RTL programs. * libguile/frames.h: Add description of RTL frames. * libguile/Makefile.am: Add rules to generate vm-operations.h. * .gitignore: Ignore vm-operations.h. * module/system/vm/instruction.scm: * libguile/instructions.c: * libguile/instructions.h: Use vm-operations.h to define enumerated values for the new RTL opcodes. Define some helper macros to pack and unpack 32-bit instruction words. (rtl-instruction-list): New function, exported by (system vm instruction). * libguile/objcodes.c: Wire up the bits needed to detect the new RTL bytecode and load it, as appropriate. 2013-05-30 Ludovic Courtès Do not assume `pthread_t' is an integer type. Fixes . Reported by Panicz Maciej Godek . * libguile/finalizers.c (finalization_thread_is_running): New variable. (start_finalization_thread): Use it to determine whether FINALIZATION_THREAD is up and running. (stop_finalization_thread): Likewise. 2013-05-27 Andy Wingo refactor to resolve_variable * libguile/vm.c (resolve_variable): Slight refactor. cpp hygiene in the vm * libguile/vm-engine.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: CPP hygiene: the code that #defines, #undefs. Makes things cleaner given the multiple inclusion dance we do. 2013-05-27 Andy Wingo pop-continuation abort-continuation hooks pass return vals directly * doc/ref/api-debug.texi (VM Hooks): Update documentation. * libguile/vm.c (vm_dispatch_hook): * libguile/vm-engine.c: Rework the hook machinery so that they can receive an arbitrary number of arguments. The return and abort hooks will pass the values that they return to their continuations. (vm_engine): Adapt to ABORT_CONTINUATION_HOOK change. * libguile/vm-i-system.c (return, return/values): Adapt to POP_CONTINUATION_HOOK change. * module/system/vm/frame.scm (frame-return-values): Remove. The pop-continuation-hook will pass the values directly. * module/system/vm/trace.scm (print-return): (trace-calls-to-procedure): (trace-calls-in-procedure): Update to receive return values directly. * module/system/vm/traps.scm (trap-in-procedure) (trap-in-dynamic-extent): Ignore return values. (trap-frame-finish, trap-calls-in-dynamic-extent) (trap-calls-to-procedure): Pass return values to the handlers. 2013-05-27 Andy Wingo Allow vm_engine caller to pass arguments on the stack. * libguile/vm-engine.c (vm_engine): Allow the caller to pass arguments on the stack. vm-engine: remove register assignments * libguile/vm-engine.c: Remove the register assignments inherited from the 1990s. GCC does seem to allocate reasonably on systems with enough registers (e.g. x86-64), and on system with too few (ia32) we disabled manual allocation. Anyway this code was never tested, so it's better to leave the compiler to do its own thing, until proven otherwise. Also in the RTL VM we don't need to allocate a register to the SP, because it isn't accessed as much. 2013-05-23 Andy Wingo remove some configurability in vm-engine * libguile/vm-engine.c: Remove the ability for the VM to check object access, free variable access, and the ip. They were off by default. Since they will be different in the RTL VM, their presence is just making things confusing. * libguile/vm.c: Remove corresponding error helpers. 2013-05-23 Andy Wingo minor vm-engine cleanups * libguile/vm-engine.c: Some very minor cleanups: indenting, use of VM_ASSERT, commenting. 2013-05-23 Andy Wingo remove CONS macro in VM; use scm_cons instead * libguile/vm-engine.c (CONS): Remove. Callers should use scm_cons instead, syncing registers beforehand. (POP_LIST): Adapt, only synchronizing once. (POP_LIST_MARK, POP_CONS_MARK): Remove unused macros. * libguile/vm-i-scheme.c (cons): * libguile/vm-i-system.c (push-rest, bind-rest): Adapt. 2013-05-23 Andy Wingo inline vm-engine.h into vm-engine.c * libguile/vm-engine.h: * libguile/vm-engine.c: Fold vm-engine.h into vm-engine.c. * libguile/Makefile.am: Adapt. 2013-05-23 Andy Wingo add (find-mapped-elf-image) procedure to (system vm objcode) module * libguile/objcodes.c (register_elf, scm_find_mapped_elf_image): New interfaces that keep a list of all ELF mappings. Exported from the (system vm objcode) module. * module/system/vm/objcode.scm: Export find-mapped-elf-image. 2013-05-23 Andy Wingo refactor and simplify ELF loader in objcodes.c * libguile/objcodes.c (sniff_elf_alignment, alloc_aligned) (copy_and_align_elf_data): New helpers for portably re-aligning ELF data from read(2) or from a bytevector. (load_thunk_from_memory): Simplify! Now there is only one procedure that loads ELF, and it does less: it simply receives the whole image in one array, hopefully from mmap. (scm_load_thunk_from_file): Use new map_file_contents helper, and go through load_thunk_from_memory. (scm_load_thunk_from_memory): Pass load_thunk_from_memory a piece of memory that it owns, and that is appropriately aligned. 2013-05-23 Andy Wingo add scm_{to,from}_{u,}intptr_t * libguile/numbers.h (scm_to_intptr_t, scm_from_intptr_t) (scm_to_uintptr_t, scm_from_uintptr_t): New defines. * libguile/foreign.c: Remove definitions here; adapt callers to use new names with _t suffixes. 2013-05-23 Andy Wingo refactor linker to lay out ELF files and memory in the same way * module/system/vm/linker.scm (make-linker-object): (linker-object-section-symbol): (linker-object-symbols*): Create a symbol to the start of a linker object. Hide it from the external linker-object-symbols* accessor. (segment-kind, count-segments): Sections without SHF_ALLOC don't get segments. (collate-objects-into-segments): Allow for #f segment types. If two sections have the same type and flags, leave them in the same order. (align): Allow for 0 alignment. (add-elf-objects): New helper: puts the ELF data structures (header, segment table, and section table) in sections of their own. This lends a nice clarity and conceptual unity to the linker. (relocate-section-header, allocate-segment): Lay out segments with congruent, contiguous addresses, so that we can just mmap the file and if debugging sections that are not in segments are present, they can be lazily paged in if needed by the kernel's VM system. (link-elf): Refactor to use the new interfaces. * test-suite/tests/linker.test: Update to expect the additional sections for the header and section table. 2013-05-23 Andy Wingo elf: add accessors for header members that might need relocation * module/system/vm/elf.scm (elf-header-shoff-offset) (elf-section-header-addr-offset, elf-section-header-offset-offset): New accessors. 2013-05-23 Andy Wingo ELF refactor and consequent linker simplifications * module/system/vm/elf.scm: Add commentary. (make-elf): Add a constructor similar to make-elf-segment and make-elf-section. (write-elf32-header, write-elf64-header, write-elf-header): Take an instead of all the fields separately. (, ): Add "index" property. Adapt constructors accordingly. * module/language/objcode/elf.scm (bytecode->elf): Arrange to set the section indexes when creating ELF sections. * module/system/vm/linker.scm (fold-values): New helper. (alloc-segment, relocate-section-header): Arrange to set segment and section indexes. (find-shstrndx): New helper, replaces compute-sections-by-name. Now that sections know their indexes, this is easier. (allocate-elf, write-elf): New helpers, factored out of link-elf. Easier now that sections have indexes. (link-elf): Simplify. Check that the incoming objects have sensible numbers. * test-suite/tests/linker.test: Update to set #:index on the linker objects. 2013-05-23 Andy Wingo split linker out of elf module * module/Makefile.am: * module/system/vm/linker.scm: New file, split out of (system vm elf). (make-string-table, string-table-intern): Export under their bare names, instead of make-elf-string-table and elf-string-table-intern. * module/system/vm/elf.scm: Remove linking capabilities. (string-table-ref): Export. * module/language/objcode/elf.scm (bytecode->elf): Adapt to use (system vm linker). * test-suite/tests/linker.test: New test. 2013-05-02 Aleix Conchillo Flaque web: uri-encode hexadecimal percent-encoding is now uppercase * module/web/uri.scm (uri-encode): the hexadecimal percent-encoding %HH is now uppercased as suggested by RFC3986: "For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings." * test-suite/tests/web-uri.test ("encode"): update tests. 2013-04-14 Mark H Weaver Manual: fix 'my-or' examples to use let-bound variable. Fixes reported by Nikita Karetnikov. * doc/ref/api-macros.texi (Defining Macros, Syntax Rules): Fix definition of 'my-or' example macro to use the let-bound variable. 2013-04-14 Ludovic Courtès tests: Use shell constructs that /bin/sh on Solaris 10 can understand. Partly fixes . Reported by Marc Girod * test-suite/standalone/test-language: Use a shell construct that /bin/sh on Solaris 10 can understand. 2013-04-14 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION libguile/array-map.c libguile/fports.h libguile/gc.h libguile/inline.h libguile/ports.c libguile/ports.h libguile/print.c libguile/r6rs-ports.c libguile/read.c test-suite/tests/00-socket.test Using 'pass-if-equal' in coding.test. * test-suite/tests/coding.test ("block comments", "line comments"): Use 'pass-if-equal'. Adjust BOM tests to reflect the fact that big endian is used by default. * test-suite/tests/ports.test ("BOM not discarded unless at start of UTF-16 stream", "BOM not discarded unless at start of UTF-32 stream"): Adjust tests to reflect the fact that, in the absence of a BOM, big endian will be used by default for the "UTF-16" and "UTF-32" encodings. 2013-04-11 Mark H Weaver Add 2012 and 2013 to copyright notice on numbers.test. * test-suite/tests/numbers.test: Add 2012 and 2013 to copyright notice. It was modified both of those years. 2013-04-10 Mark H Weaver Do not add $(EXEEXT) to guild or guile-tools. * meta/Makefile.am (install-exec-hook): Do not add $(EXEEXT) to guild or guile-tools. 2013-04-10 Ludovic Courtès Mention `open-file' in NEWS. doc: Require libunistring 0.9.3 in `README'. * README: Require libunistring 0.9.3. The header in 0.9.1 lacks the _UC_ATTRIBUTE_CONST definition, leading to build failures. build: Tell `gen-scmconfig' whether the system has `struct timespec'. * configure.ac: Reinstate `struct timespec' check removed in commit 7e7c6f6a937005b08fffd5aeccdf992459b07137, but define `HAVE_SYSTEM_STRUCT_TIMESPEC' instead of `HAVE_STRUCT_TIMESPEC'. * libguile/gen-scmconfig.c (main): Change `HAVE_STRUCT_TIMESPEC' to `HAVE_SYSTEM_STRUCT_TIMESPEC'. Bump version number for 2.0.9. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. doc: Update `release.org'. * doc/release.org: Recommend "distcheck". Add `makeinfo' to the bootstrap tool list. stime: Remove #ifdef HAVE_*_H for headers provided by Gnulib. * libguile/stime.c: Remove #ifdef HAVE_SYS_TIMES_H, HAVE_SYS_TYPES_H, and HAVE_STRING_H since those headers are always provided by Gnulib when the corresponding macro is undefined. Fixes a regression on MinGW introduced by commit 40e2a31. Make `build-aux/gendocs.sh' executable. 2013-04-09 Ludovic Courtès Bump version number for 2.0.8. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C functions `scm_c_bind_keyword_arguments' et al. (LIBGUILE_INTERFACE_AGE): Increment. tests: Skip FFI tests involving `scm_is_pair' when `dynamic-func' fails. * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Wrap `dynamic-func' in `false-if-exception' (static builds on NetBSD 5.1 raise "Symbol not found" here.) doc: Cosmetic change for `release.org'. * doc/release.org: Add #+STARTUP. Update `THANKS'. 2013-04-09 Andy Wingo update NEWS * NEWS: Updates. fix stime patch for HAVE_TIMES removal * libguile/stime.c (scm_init_stime): Fix previous patch. At this point in the source, we definitely have a run-time function, but don't necessarily have a real-time function. 2013-04-09 Andy Wingo simplify configure checks for functionality provided by gnulib * configure.ac: Remove checks for pipe, stftime, times, and select, as our Gnulib modules already ensure they are provided. * libguile/stime.c: Rely on gnulib providing `times'. 2013-04-09 Mark H Weaver Minor 'THANKS' fix. Fix alignment in 'THANKS'. Update bug report section of 'THANKS'. Update 'THANKS'. 2013-04-09 Mark H Weaver Manual: Don't promise to signal an error for an illegal 'letrec'. Reported by Nikita Karetnikov . * doc/ref/api-binding.texi (Local Bindings): Remove the incorrect claim that improperly accessing a letrec-bound variable during evaluation of its initializers will necessarily cause an error to be signalled. 2013-04-09 Ludovic Courtès tests: Skip IPv6 socket tests when OS support is missing. Reported by Samuel Thibault and Peter Simons . * test-suite/tests/00-socket.test ("AF_INET6/SOCK_STREAM"): Throw `unresolved' when `bind' throws EADDRNOTAVAIL. 2013-04-08 Mark H Weaver Update 'NEWS'. Update 'NEWS'. Consume a peeked EOF at the REPL. * module/system/repl/repl.scm (meta-reader): Consume peeked EOF. 2013-04-08 Mark H Weaver Miscellaneous 'sendfile' fixes and improved tests. * libguile/filesys.c (scm_sendfile): In Linux-style sendfile(2) code, if EINTR or EAGAIN occurs, set result to 1 (not 0) so that we actually keep going. In non-sendfile(2) code, deal gracefully with short reads due to EOF. * test-suite/tests/filesys.test ("sendfile"): Use 'let*' to guarantee the needed order of operations: write (test-file) and then read it. Add code to check the written data (not just the returned length) in all tests, including the cases that hit EOF prematurely. 2013-04-07 Mark H Weaver Update 'NEWS'. 2013-04-07 Ludovic Courtès Change `sendfile' to loop until everything has been sent. * libguile/filesys.c (scm_sendfile)[HAVE_SYS_SENDFILE_H && HAVE_SENDFILE]: Compare RESULT with C_COUNT. Loop until C_COUNT bytes have been sent. * doc/ref/posix.texi (File System): Update the description. Explain the new semantics. * test-suite/tests/filesys.test ("sendfile"): Rewrite using `pass-if-equal'. Check the return value for all the tests. ["file with offset past the end", "file with offset near the end"]: New tests. 2013-04-07 Mark H Weaver Remove outdated and misplaced "Included Guile Modules" node from manual. * doc/ref/api-modules.texi (Included Guile Modules): Remove. (Using Guile Modules): Fix cross reference. Clarify 'file-encoding' docs: heuristics may be improved later. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Mention UTF-8 as another common encoding used for Scheme source files, and that it is used by default. Change the description to leave open the possibility of adding additional heuristics in the future. Mention that if the coding declaration is in a #!-style block comment, it must be the first such comment in the file. Mention the '#:guess-encoding' keyword argument. 2013-04-07 Mark H Weaver Add keyword arguments to file opening procedures. * libguile/fports.c (scm_open_file_with_encoding): New API function, containing the code previously found in 'scm_open_file', but modified to accept the new 'guess_encoding' and 'encoding' arguments. (scm_open_file): Now just a simple wrapper that calls 'scm_open_file_with_encoding'. (scm_i_open_file): New implementation of 'open-file' that accepts keyword arguments '#:guess-encoding' and '#:encoding', and calls 'scm_open_file_with_encoding'. (scm_init_fports_keywords): New initialization function that gets called after keywords are initialized. * libguile/fports.h (scm_open_file_with_encoding, scm_init_fports_keywords): Add prototypes. * libguile/init.c (scm_i_init_guile): Call 'scm_init_fports_keywords'. * module/ice-9/boot-9.scm: Add enhanced versions of 'open-input-file', 'open-output-file', 'call-with-input-file', 'call-with-output-file', 'with-input-from-file', 'with-output-to-file', and 'with-error-to-file', that accept keyword arguments '#:binary', '#:encoding', and (for input port constructors) '#:guess-encoding'. * doc/ref/api-io.texi (File Ports): Update documentation. * test-suite/tests/ports.test ("keyword arguments for file openers"): Add tests. 2013-04-07 Chris K. Jester-Young Add record type printer for srfi-41. * module/srfi/srfi-41.scm: Add record type printer for streams. (stream-promise-visit): New helper for visiting stream promises. Add record type printer for srfi-45. * module/srfi/srfi-45.scm: Add record type printer for promises. (promise-visit): New helper for visiting lazy promises. 2013-04-07 Mark H Weaver Implement efficient 'scm_unget_bytes' and 'unget-bytevector'. * libguile/ports.c (scm_i_unget_bytes): New static function. (scm_unget_bytes): New API function. (scm_unget_byte): Rewrite to simply call 'scm_i_unget_bytes'. (scm_ungetc, scm_peek_char, looking_at_bytes): Use 'scm_i_unget_bytes'. * libguile/ports.h: Add prototype for 'scm_unget_bytes'. * libguile/fports.c (scm_setvbuf): Use 'scm_unget_bytes'. * libguile/r6rs-ports.c (scm_unget_bytevector): New procedure. * module/ice-9/binary-ports.scm (unget-bytevector): New export. * doc/ref/api-io.texi (R6RS Binary Input): Add documentation. (R6RS I/O Ports): Update brief description of (ice-9 binary-ports) to reflect the new reality: it is no longer a subset of (rnrs io ports). * test-suite/tests/ports.test ("unget-bytevector"): Add test. 2013-04-07 Mark H Weaver Remove byte-order mark check from 'scm_i_scan_for_encoding'. * libguile/read.c (scm_i_scan_for_encoding): Remove byte-order mark check. 2013-04-07 Mark H Weaver Do not scan for coding declarations in open-file. * libguile/fports.c (scm_open_file): Do not scan for coding declarations. Replace 'use_encoding' local variable with 'binary'. Update documentation string. * module/ice-9/psyntax.scm (include): Add the same file-encoding logic that's used in compile-file and scm_primitive_load. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-io.texi (File Ports): Update docs. * test-suite/tests/ports.test: Change "open-file HONORS file coding declarations" test to "open-file IGNORES file coding declaration". * test-suite/tests/coding.test (scan-coding): Use 'file-encoding' to scan for the encoding, since 'open-input-file' no longer does so. 2013-04-07 Ludovic Courtès doc: Link exceptions and escape continuations. * doc/ref/api-control.texi (Prompt Primitives): Mention exceptions. (Exception Terminology): Link to `call/ec'. doc: Warn against misuses of `file-name-separator-string'. * doc/ref/posix.texi (File System): Warn against misuses of `file-name-separator-string'. 2013-04-07 Daniel Llorens Don't use scm_generalized_vector_get_handle() in array-map.c * libguile/array-map.c: (rafill, racp, ramap, rafe): use scm_array_get_handle() instead of scm_generalized_get_vector_handle(). 2013-04-07 Mark H Weaver Fix the recommendations for conversion of C string constants. * doc/ref/api-data.texi (Conversion to/from C, Symbol Primitives, Keyword Procedures): Fix the recommendations for conversion of C string constants. The encoding of the source code is irrelevant in modern compilers. What is relevant is the execution character set. Both GCC and clang use UTF-8 by default, so recommend the 'scm_from_utf8_*' functions when the argument is a C string constant. Also fix the broken texinfo markup for 'scm_from_*_symbol' that prevented them from being listed in the index. 2013-04-07 Mark H Weaver Fix indentation in test-scm-c-bind-keyword-arguments.c. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_invalid_keyword): Fix indentation. 2013-04-07 Mark H Weaver Implement 'scm_c_bind_keyword_arguments'. * libguile/keywords.c (scm_keyword_argument_error): New variable. (scm_c_bind_keyword_arguments): New API function. * libguile/keywords.h (enum scm_keyword_arguments_flags): New enum. (scm_t_keyword_arguments_flags): New typedef. (scm_c_bind_keyword_arguments): New prototype. * doc/ref/api-data.texi (Coding With Keywords, Keyword Procedures): Add documentation. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c: New file. * test-suite/standalone/Makefile.am: Add test-scm-c-bind-keyword-arguments test. 2013-04-06 Andy Wingo NEWS tweaks * NEWS: Correct some errors. 2013-04-06 Mark H Weaver Bump 'copyright-year' to 2013. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2013. 2013-04-06 Ian Price Remove duplicate definitions of `call/ec' and `let/ec'. * module/language/tree-il/peval.scm (let/ec): Remove. Import (ice-9 control). * module/sxml/match.scm (%call/ec-prompt, call/ec, let/ec): Remove. Import (ice-9 control). 2013-04-06 Ludovic Courtès Update `NEWS'. doc: Document `--language'. * doc/ref/guile-invoke.texi (Command-line Options): Document `--language'. doc: Document file name separator procedures. * doc/ref/posix.texi (File System): Document `system-file-name-convention', `file-name-separator?', `absolute-file-name?', and `file-name-separator-string'. 2013-04-06 Chris K. Jester-Young Use a fresh cons for %stream-null. * module/srfi/srfi-41.scm (%stream-null): Use a fresh cons rather than a literal cons. You never know what peval constant-folding could do with the latter, either now or in the future. 2013-04-05 Ludovic Courtès Update `NEWS'. 2013-04-05 Daniel Llorens Deprecate scm_array_fill_int() * libguile/array-map.h, libgule/array-map.c: move scm_array_fill_int to the deprecated section. Remove double indirection in array-fill! * libguile/array-map.c: new function rafill, like scm_array_fill_int, but factors GVSET out of the loop. Use it in scm_array_fill_x instead of scm_array_fill_int. * test-suite/tests/arrays.test: add test for array-fill! with stride != 1. Tests for array-copy! * test-suite/tests/arrays.test: tests for arguments of rank 0, 1 and 2. 2013-04-05 Ludovic Courtès Add `call/ec' and `let/ec'. Based on a patch by Nala Ginrut , with suggestions from Mark H. Weaver. * module/ice-9/control.scm (call-with-escape-continuation, call/ec): New procedures. (let-escape-continuation, let/ec): New macros. * module/ice-9/futures.scm (let/ec): Remove. * test-suite/tests/control.test ("escape-only continuations")["call/ec", "let/ec"]: New tests. * doc/ref/api-control.texi (Prompt Primitives): Document `call/ec', `let/ec', and their long names. 2013-04-05 Ludovic Courtès tests: Add `pass-if-equal' support in `c&e'. * test-suite/test-suite/lib.scm (c&e): Add case for `pass-if-equal'. 2013-04-05 Mark H Weaver Use 'c_strcasecmp' instead of 'strcasecmp'. * libguile/ports.c (scm_new_port_table_entry, get_codepoint, scm_i_set_default_port_encoding, scm_i_port_iconv_descriptors, scm_i_set_port_encoding_x): * libguile/print.c (display_string_using_iconv): * libguile/read.c (scm_i_scan_for_encoding): Use 'c_strcasecmp'. Import 'c-strcase' from Gnulib. * lib/Makefile.am: * m4/gnulib-cache.m4: Add 'c-strcase' Gnulib module. 2013-04-05 Chris K. Jester-Young Revert "Add record type printers for srfi-41 and srfi-45." This reverts commit 4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9, which was prematurely pushed. Add record type printers for srfi-41 and srfi-45. * module/srfi/srfi-41.scm: Add record type printer for streams. * module/srfi/srfi-45.scm: Add record type printer for promises. 2013-04-05 Mark H Weaver Improve handling of Unicode byte-order marks (BOMs). * libguile/ports-internal.h (struct scm_port_internal): Add new members 'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'. (SCM_UNICODE_BOM): New macro. (scm_i_port_iconv_descriptors): Add 'mode' parameter to prototype. * libguile/ports.c (scm_new_port_table_entry): Initialize 'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'. (get_iconv_codepoint): Pass new 'mode' parameter to 'scm_i_port_iconv_descriptors'. (get_codepoint): After reading a codepoint at stream start, record that we're no longer at stream start, and consume a BOM where appropriate. (scm_seek): Set the stream start flags according to the new position. (looking_at_bytes): New static function. (scm_utf8_bom, scm_utf16be_bom, scm_utf16le_bom, scm_utf32be_bom, scm_utf32le_bom): New static const arrays. (decide_utf16_encoding, decide_utf32_encoding): New static functions. (scm_i_port_iconv_descriptors): Add new 'mode' parameter. If the specified encoding is UTF-16 or UTF-32, make that precise by deciding what byte order to use, and construct iconv descriptors based on the precise encoding. (scm_i_set_port_encoding_x): Record that we are now at stream start. Do not open the new iconv descriptors immediately; let them be initialized lazily. * libguile/print.c (display_string_using_iconv): Record that we're no longer at stream start. Write a BOM if appropriate. * doc/ref/api-io.texi (BOM Handling): New node. * test-suite/tests/ports.test ("set-port-encoding!, wrong encoding"): Adapt test to cope with the fact that 'set-port-encoding!' does not immediately open the iconv descriptors. (bv-read-test): New procedure. ("unicode byte-order marks (BOMs)"): New test prefix. 2013-04-04 Mark H Weaver Peeks do not consume EOFs. Fixes . * libguile/ports-internal.h (struct scm_port_internal): Add 'pending_eof' flag. * libguile/ports.c (scm_i_set_pending_eof, scm_i_clear_pending_eof): New static functions. (scm_new_port_table_entry): Initialize 'pending_eof'. (scm_i_fill_input): Check for 'pending_eof'. (scm_i_peek_byte_or_eof): Set 'pending_eof' flag before returning EOF. (scm_end_input, scm_unget_byte, scm_seek, scm_truncate): Clear 'pending_eof'. (scm_peek_char): Set 'pending_eof' flag before returning EOF. * test-suite/tests/ports.test ("pending EOF behavior"): Add tests. 2013-04-04 Mark H Weaver Nicer docstring syntax for case-lambda. * module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow a docstring to be placed immediately after the 'case-lambda' or 'case-lambda*'. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-procedures.texi (Case-lambda): Update docs. * test-suite/tests/optargs.test ("case-lambda", "case-lambda*"): Add tests. 2013-04-04 Mark H Weaver Cross reference 'SRFI-9 Records' directly instead of 'SRFI-9'. * doc/ref/api-compound.texi (Record Overview, Records): doc/ref/api-modules.texi (Included Guile Modules): doc/ref/r6rs.texi (R6RS Records): Cross reference 'SRFI-9 Records' directly instead of 'SRFI-9'. 2013-04-03 Mark H Weaver Preserve the case of the user-specified port encoding string. * libguile/ports.c (scm_i_set_port_encoding_x): Always copy the user-provided port encoding string, so that its case will be preserved and returned exactly by subsequent calls to 'port-encoding'. 2013-04-03 Daniel Llorens Remove double indirection for 1st arg of array-for-each * libguile/array-map.c: (rafe): factor GVREF out of rank-1 loop for ra0. 2013-04-03 Ludovic Courtès tests: Add `array-for-each' tests for one-dimensional traversals. * test-suite/tests/ramap.test ("array-for-each")["1 source"]: New test prefix. tests: Use `pass-if-equal' in ramap.test. * test-suite/tests/ramap.test ("array-for-each"): Use `pass-if-equal' instead of `(pass-if ... (equal? ...))'. 2013-04-03 Daniel Llorens Remove double indirection in array-map! with <2 args * libguile/array-map.c: (ramap): factor GVSET/GVREF out of rank-1 loop for ra0 and the first element of ras. Avoid per-element cons for 1-arg case of array-map! * libguile/array-map.c: (ramap): special case when ras is a 1-element list. Deprecate dead code in array-map.c * libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp, scm_ra_lessp, scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum, scm_ra_product, scm_ra_difference, scm_ra_divide, scm_array_identity. 2013-04-03 Mark H Weaver Use 'strcasecmp' to compare encoding names. Reported by Ludovic Courtès . * libguile/ports.c (scm_new_port_table_entry, scm_i_set_default_port_encoding, scm_i_set_port_encoding_x): libguile/read.c (scm_i_scan_for_encoding): Use 'strcasecmp' to compare encoding names. 2013-04-03 Daniel Llorens Remove double indirection in element access in array-copy! * libguile/array-map.c: (racp): factor scm_generalized_vector_ref, scm_generalized_vector_set_x out of the rank-1 loop. 2013-04-03 Mark H Weaver Remove BOM tests that depend on GNU iconv behavior. * test-suite/tests/ports.test ("unicode byte-order marks (BOMs)"): Remove tests that depend on GNU iconv behavior. We will add them back when we have portable BOM support. 2013-04-03 Mark H Weaver Rename 'scm_i_get_byte_or_eof' et al; mark them as SCM_API. * libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof', respectively. * libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof', respectively, and mark them as SCM_API. * libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Adjust to use the new names. 2013-04-03 Mark H Weaver Remove uses of GC_PTR in 'finalize_iconv_descriptors'. * libguile/ports.c (finalize_iconv_descriptors): Change GC_PTR to (void *) in parameter types. 2013-04-02 Mark H Weaver Rewrite get_iconv_codepoint to fix a bug involving byte-order marks. * libguile/ports.c (get_iconv_codepoint): Rewrite to fix a bug and improve efficiency and clarity. Previously, it incorrectly assumed that iconv would never consume input without producing output, which led to a buffer overrun and subsequent assertion failure. This happens when a byte-order mark is consumed by iconv at the beginning of the stream when using the UTF-16 or UTF-32 encodings. * test-suite/tests/ports.test (unicode byte-order marks (BOMs)): Add tests. 2013-04-02 Mark H Weaver Move slow path out of 'scm_get_byte_or_eof' et al. Suggested by Andy Wingo. * libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Keep only the fast path here, with fallback to 'scm_i_get_byte_or_eof' and 'scm_i_peek_byte_or_eof'. * libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): New internal functions. * libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Add prototypes. 2013-04-02 Mark H Weaver Add a static version of 'scm_fill_input' to ports.c. * libguile/ports.c (scm_i_fill_input): New static function, containing the code that was previously in 'scm_fill_input'. (scm_fill_input): Simply call 'scm_i_fill_input'. (scm_c_read): Use 'scm_i_fill_input'. 2013-04-01 Mark H Weaver Move the port alist from the hash table to the internal port structure. * libguile/ports-internal.h (struct scm_port_internal): Add 'alist' member. * libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): New internal functions. (scm_i_port_weak_hash): Update comment: the hash table is no longer used to store the port's alist. (scm_new_port_table_entry): Initialize 'alist'. Store SCM_BOOL_F in the port weak hash, not SCM_EOL. * libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Add protoypes. * libguile/read.c (set_port_read_option, init_read_options): Access the port's alist via 'scm_i_port_alist' and 'scm_i_set_port_alist_x'. 2013-04-01 Mark H Weaver Optimize 'get-bytevector-some'; it may now read less than possible. * libguile/r6rs-ports.c (scm_get_bytevector_some): Rewrite to efficiently take the contents of the read/putback buffers. In the docstring, clarify that it might not return all available bytes. * doc/ref/api-io.texi (R6RS Binary Input): Clarify that 'get-bytevector-some' might not return all available bytes. * test-suite/tests/r6rs-ports.test ("get-bytevector-some [only-some]"): Remove bogus test, which requires more than the R6RS requires. 2013-04-01 Mark H Weaver Refactor port encoding modes: utf-8 and iconv Based on 6c98257f2ead0855f218369ea7f9a823cdb9727e by Andy Wingo. * libguile/ports-internal.h (struct scm_port_internal): Add a flag for the port encoding mode: UTF8 or iconv. The iconv descriptors are now in a separate structure so that we can avoid attaching finalizers to the ports themselves in the future. (enum scm_port_encoding_mode): New enum. (struct scm_iconv_descriptors): New struct. (scm_i_port_iconv_descriptors): Add prototype. * libguile/ports.c (finalize_port): Don't close iconv descriptors here. (scm_new_port_table_entry): Adapt to the iconv descriptors being moved. Initialize 'encoding_mode'. (scm_i_remove_port): Adapt to call 'close_iconv_descriptors'. (close_iconv_descriptors): New static function. (get_iconv_codepoint): Use 'scm_i_port_iconv_descriptors'. (get_codepoint): Check the port 'encoding_mode'. (finalize_iconv_descriptors, open_iconv_descriptors, close_iconv_descriptors, scm_i_port_iconv_descriptors): New static functions. (scm_i_set_port_encoding_x): Adapt to iconv descriptors being moved to separate structure, to set the 'encoding_mode' flag, and to use 'open_iconv_descriptors' and 'close_iconv_descriptors'. * libguile/print.c (display_string_using_iconv): Use 'scm_i_port_iconv_descriptors'. (display_string): Use 'encoding_mode' flag. 2013-04-01 Mark H Weaver Add internal-only port structure and move iconv descriptors there. * libguile/ports-internal.h: New file. * libguile/Makefile.am (noinst_HEADERS): Add ports-internal.h. * libguile/ports.h (scm_t_port): Add a comment mentioning that the 'input_cd' and 'output_cd' fields of the public structure are no longer what they seem to be. * libguile/ports.c: Include ports-internal.h. (finalize_port, scm_i_remove_port, get_iconv_codepoint, get_codepoint, scm_i_set_port_encoding_x): Access 'input_cd' and 'output_cd' via the new internal port structure. (scm_new_port_table_entry): Allocate and initialize the internal port structure. * libguile/print.c: Include ports-internal.h. (display_string_using_iconv, display_string): Access 'input_cd' and 'output_cd' via 'internal' pointer. 2013-04-01 Mark H Weaver Add 'scm_gc_typed_calloc' macro. * libguile/gc.h (scm_gc_typed_calloc): New macro. Fix broken texinfo markup in (ice-9 iconv) docs. * doc/ref/api-data.texi (Representing Strings as Bytes): Fix broken @deffn syntax. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/r6rs-ports.c scm_string_join: properly sequence operations in ADD_TO_APPEND_LIST * libguile/srfi-13.c (scm_string_join): Properly sequence operations in ADD_TO_APPEND_LIST macro. Optimize 'string-join'. * libguile/srfi-13.c (string-join): Rewrite to call 'scm_string_append' only once. Make 'string-append' more efficient and robust. * libguile/strings.c (scm_string_append): Check for numerical overflow while computing the length of the result. Double-check that we don't overflow the result string, and that it is the correct length in the end (in case another thread changed the list). When copying a narrow string to a wide result, avoid calling 'scm_i_string_length' and 'scm_i_string_chars' on each character. 2013-04-01 Mark H Weaver Fix typos in 'string-join' docs: 'string-infix' -> 'strict-infix'. * doc/ref/api-data.texi (String Constructors): In definition of 'string-join', change 'string-infix' -> 'strict-infix'. * libguile/srfi-13.c (scm_string_join): In docstring, change 'string-infix' -> 'strict-infix'. 2013-04-01 Mark H Weaver Avoid unnecessary peeks for EOF in r6rs-ports. * libguile/r6rs-ports.c (scm_get_bytevector_n, scm_get_bytevector_n_x, scm_get_bytevector_some, scm_get_bytevector_all): Avoid peeking for EOF when we already know. 2013-03-31 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2013-03-31 Mark H Weaver Add -C command-line option to adjust %load-compiled-path. * module/ice-9/command-line.scm (compile-shell-switches): Implement -C option. (*usage*): Add -C option. * doc/ref/guile-invoke.texi (Command-line Options): Add docs. 2013-03-29 Ludovic Courtès Augment `.gitignore'. 2013-03-29 Ludovic Courtès build: Build and check (ice-9 popen) only when --enable-posix and HAVE_FORK. Fixes . Reported by Jan Schukat . * configure.ac: Rename `HAVE_FORK' conditional to `BUILD_ICE_9_POPEN'. Set it when both $enable_posix and $ac_cv_func_fork are true. * libguile/posix.c (scm_init_posix): Add the `fork' feature. * doc/ref/api-options.texi (Common Feature Symbols): Add `fork'. * doc/ref/posix.texi (Pipes): Add footnote mentioning the `fork' feature. * module/Makefile.am (SCRIPTS_SOURCES): Make `scripts/autofrisk.scm' and `scripts/scan-api.scm' conditional on `BUILD_ICE_9_POPEN'. * test-suite/tests/popen.test (if-supported): New macro. Wrap body in `if-supported'. 2013-03-29 Ludovic Courtès build: Remove redundant check for `struct timespec'. * m4/gnulib-cache.m4: Add `time'. * lib/Makefile.am: Update, still from v0.0-7865-ga828bb2. * configure.ac: Remove check for `struct timespec', which was redundant with Gnulib, and conflicted with pthread-win32's : . 2013-03-29 Mark H Weaver doc: Use '@defvr' to introduce 'stream-null'. * doc/ref/srfi-modules.texi (SRFI-41): Use @defvr to introduce 'stream-null'. Revert "doc: Consider `stream-null' as a variable." This reverts commit 4a0821a8d5cfff50fef8c119a0d76355b6126009. Merge remote-tracking branch 'origin/stable-2.0' 2013-03-28 Ludovic Courtès tests: Skip `test-pthread-create-secondary' except on Linux-based systems. * test-suite/standalone/test-pthread-create-secondary.c: Skip on non-Linux-based systems. build: Require GMP >= 4.2. * NEWS, README: Update. tests: Fix file name canonicalization tests for when $srcdir contains symlinks. * test-suite/tests/ports.test ("%file-port-name-canonicalization"): Use `pass-if-equal' instead of `pass-if'. ["relative canonicalization from ice-9"]: Throw to `unresolved' when %LOAD-PATH is not canonical. ["absolute canonicalization from ice-9"]: Canonicalize the result. Add Gnulib commit ID in `NEWS'. Allow compilation with GMP < 5.0.0. * libguile/numbers.c (VARARG_MPZ_ITERATOR)[!HAVE_DECL_MPZ_INITS]: New macro. (mpz_inits, mpz_clears)[!HAVE_DECL_MPZ_INITS]: New functions. * configure.ac: Check for the declaration of `mpz_inits'. Fix erroneous `FUNC_NAME' for `scm_array_length'. * libguile/generalized-arrays.c (scm_array_length): Fix `FUNC_NAME'. doc: Consider `stream-null' as a variable. * doc/ref/srfi-modules.texi (SRFI-41): Use @var{stream-null}, not @code{stream-null}. Use @defvr to introduce `stream-null'. 2013-03-28 Ian Price Document (system repl server) * doc/ref/api-evaluation.texi (REPL Servers): New Subsection. 2013-03-28 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test 2013-03-28 Mark H Weaver SRFI-41 stream-null is a Scheme Variable, not a Constant. Suggested by Ludovic Courtès . * doc/ref/srfi-modules.texi (SRFI-41 Stream Primitives): Label 'stream-null' as a Scheme Variable, not a Constant. 2013-03-27 Chris K. Jester-Young Use BT Templeton's preferred name. * THANKS: Use BT Templeton's preferred name. 2013-03-27 Mark H Weaver Thanks Chris K. Jester-Young. * THANKS: Add Chris K Jester-Young to the list of contributors. 2013-03-27 Mark H Weaver Add full documentation for SRFI-41. * doc/ref/misc-modules.texi (Streams): Add cross-reference to SRFI-41. * doc/ref/srfi-modules.texi (SRFI-41): Replace stub with full documentation. (SRFI-41 Stream Fundamentals, SRFI-41 Stream Primitives, SRFI-41 Stream Library): New subsubsections. 2013-03-27 Chris K. Jester-Young Add SRFI-41. Incorporates suggestions from Mark H Weaver and Ian Price . * module/srfi/srfi-41.scm: New file. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-41.scm. * test-suite/tests/srfi-41.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-41.test. * doc/ref/srfi-modules.texi (SRFI Support): Add SRFI-41. (SRFI-41): New node which refers the reader to . 2013-03-27 Ludovic Courtès Update `NEWS'. 2013-03-27 Ludovic Courtès futures: Limit the number of nested futures on the same stack. Fixes . Reported by Nala Ginrut . * module/ice-9/futures.scm (%nesting-level): Rename to... (%nesting-level): ... this. Default to 0 instead of #f. Update users. (%max-nesting-level): New variable. (touch): When FUTURE is queued and (%nesting-level) is above %MAX-NESTING-LEVEL, abort to %FUTURE-PROMPT. * test-suite/tests/future.test ("nested futures")["loop"]: Remove `compile' call. * test-suite/tests/threads.test ("par-map")["long list"]: New test. * doc/ref/api-scheduling.texi (Futures): Add a paragraph about stack consumption. 2013-03-27 Ludovic Courtès Document `and=>'. * module/ice-9/boot-9.scm (and=>): Add docstring. * doc/ref/api-procedures.texi (Higher-Order Functions): Add `and=>'. 2013-03-27 Daniel Hartwig web http: parse numeric time zones in headers * module/web/http.scm (parse-zone-offset, normalize-date): New procedures. (parse-rfc-822-date, parse-rfc-850-date, parse-date): Update. * test-suite/tests/web-http.test ("general headers"): Add test. 2013-03-27 Ludovic Courtès doc: Use a preferred naming convention in SRFI-9 examples. * doc/ref/api-compound.texi (SRFI-9 Records): Use "Scheme Syntax" instead of "library syntax". Remove `get-' from getter names, and add an exclamation mark in setter names. Change `employee-type' to `'. 2013-03-27 Mark H Weaver Manual: xref SRFI-45 from core Delayed Evaluation section. * doc/ref/api-evaluation.texi (Delayed Evaluation): Add cross-reference to SRFI-45. 2013-03-27 Mark H Weaver SRFI-45: add promise? predicate. * module/srfi/srfi-45.scm (promise?): Export. * doc/ref/srfi-modules.texi (SRFI-45): Update docs. * test-suite/tests/srfi-45.test: Add test. Add FSF copyright for 2010 and 2013. Add missing year to André van Tonder's copyright notice. 2013-03-27 Mark H Weaver Revert "SRFI-45: Support multiple values; add promise? predicate." This reverts commit 1d64b4edb9da4011ad06c0fab1c6225ec20b0876. 2013-03-25 Ludovic Courtès SRFI-37: Fix infinite loop when processing short option with no required arg. Fixes . * module/srfi/srfi-37.scm (args-fold)[short-option-argument]: When ARGS is a pair, always set it to its cdr. * test-suite/tests/srfi-37.test ("SRFI-37")["short option with optional argument omitted", "short option with optional argument provided"]: New tests. 2013-03-25 Ludovic Courtès getaddrinfo: Document the missing errno value for EAI_SYSTEM. In response to . Reported by Lluís Batlle i Rossell . * doc/ref/posix.texi (Network Databases): Document the missing errno value for EAI_SYSTEM. * libguile/net_db.c (scm_getaddrinfo): Likewise. 2013-03-25 Ludovic Courtès build: Use portable sed constructs. Partly fixes . Reported by Marc Girod . * meta/Makefile.am (guile-config): Use separate "s" expressions to accommodate Solaris sed. 2013-03-25 Ludovic Courtès sendfile: Make sure we have a Linux-style `sendfile'. * libguile/filesys.c (scm_sendfile): Change conditional to HAVE_SYS_SENDFILE_H && HAVE_SENDFILE. sendfile: Check return value of `lseek'. * libguile/filesys.c (scm_sendfile): Check return value of `lseek_or_lseek64', and use `SCM_SYSERROR' upon error. Skip relevant `sendfile' tests when thread support is lacking. * test-suite/tests/filesys.test ("sendfile")["pipe", "pipe with offset"]: Throw to `unresolved' when not (provided? 'threads). 2013-03-22 Ludovic Courtès tests: Add more `maybe-gc-flakiness'. Fixes . Reported by Dennis Clarke . * test-suite/tests/gc.test ("gc")["Lexical vars are collectable"]: Wrap in `maybe-gc-flakiness'. 2013-03-22 Ludovic Courtès Add bindings for `sendfile'. * configure.ac: Check for and `sendfile'. * libguile/filesys.c (scm_sendfile): New function. * libguile/filesys.h (scm_sendfile): New declaration. * test-suite/tests/filesys.test ("sendfile"): New test prefix. * doc/ref/posix.texi (File System): Document `sendfile'. texinfo plain-text: Use `match' for `stexi->plain-text'. * module/texinfo/plain-text.scm (def)[list/spaces]: Remove. (stexi->plain-text): Use `match' instead of `cond'. texinfo: Add whitespace after periods. * module/texinfo/string-utils.scm (end-of-sentence?): New procedure. (make-text-wrapper): Append an extra space after LINE when it matches `end-of-sentence?' and COLLAPSE-WHITESPACE? is false. * test-suite/tests/texinfo.serialize.test ("test-serialize"): Adjust accordingly. * test-suite/tests/texinfo.string-utils.test ("text wrapping")["two spaces after end of sentence"]: New test prefix. build: Adjust makefiles for `guile-procedures.txt'. * libguile/Makefile.am (all-local): New target. * Makefile.am (libguile/guile-procedures.txt): Output to $@.tmp first. (CLEANFILES): New variable. 2013-03-21 Ludovic Courtès Build `guile-procedures.txt' using (texinfo) instead of `makeinfo'. * Makefile.am (schemelibdir, schemelib_DATA): New variables. (libguile/guile-procedures.txt): New target. (EXTRA_DIST): Add libguile/texi-fragments-to-docstrings. * libguile/Makefile.am (guile-procedures.txt): Remove target. (schemelibdir, schemelib_DATA): Remove. * libguile/texi-fragments-to-docstrings: New file. texinfo plain-text: Properly render @dots{}. * module/texinfo/plain-text.scm (tag-handlers): Add `dot' handler. test suite: Fix typo in `texinfo.test'. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add missing quote. texinfo: Recognize `@:'. * module/texinfo.scm (read-command-token): Recognize @:. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add test. texinfo: Allow markup in the arguments of `@pxref'. * module/texinfo.scm (texi-command-specs)[pxref]: Change to `INLINE-TEXT-ARGS'. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@pxref{Locales, @code{setlocale}}"]: New test. test suite: Use `pass-if-equal' in texinfo.test. * test-suite/tests/texinfo.test: Replace occurrences of `(pass-if (equal? ...))' by `pass-if-equal'. 2013-03-21 Mike Gran Document quit and exit * doc/ref/posix.texi (Processes): document `quit' and `exit' * doc/ref/r6rs.texi (rnrs programs): xref exit 2013-03-21 Mark H Weaver Add missing 'cond-expand' feature identifiers; remove srfi-6 from core list. * module/ice-9/boot-9.scm (%cond-expand-features): Remove redundant list of feature identifiers in the comment. Explain more clearly what belongs in this list. Remove srfi-6. * module/srfi/srfi-4.scm, module/srfi/srfi-27.scm, module/srfi/srfi-31.scm, module/srfi/srfi-38.scm, module/srfi/srfi-39.scm, module/srfi/srfi-42.scm, module/srfi/srfi-45.scm, module/srfi/srfi-67.scm: Add missing 'cond-expand-provide'. * module/srfi/srfi-69.scm: Fix erroneous 'cond-expand-provide'. * doc/ref/srfi-modules.texi (SRFI-0): Update the list of features in Guile core. 2013-03-21 Mark H Weaver Mention the non-conformance of the core SRFI-6 procedures in the manual. * doc/ref/srfi-modules.texi (About SRFI Usage): Use SRFI-13 as an example of a module which is included in core Guile, instead of SRFI-6. (SRFI-6): Mention the non-conformance of the core 'open-input-string' and 'open-output-string' procedures. Remove the claim that importing this module does nothing. Recommend that users import the module. 2013-03-20 Mark H Weaver Improve sqrt handling of large integers and large and small rationals. * libguile/numbers.c (exact_integer_is_perfect_square, exact_integer_floor_square_root): New static functions. (scm_sqrt): Use SCM_LIKELY. Add 'scm_t_inum' variable in inum case to reduce the number of uses of SCM_I_INUM. Rename 'mpz_t' variable. Remove unneeded sign check. Handle bignums too large to fit in a double. Handle fractions too large or too small to fit in a normalized double. * test-suite/tests/numbers.test ("sqrt"): Add tests. 2013-03-20 Mark H Weaver Optimize inum case of exact-integer-sqrt. * libguile/numbers.c (scm_exact_integer_sqrt): Use GMP for inum case. It is faster than what we had before. 2013-03-20 Mark H Weaver Sqrt returns exact results when possible. * libguile/numbers.c (scm_sqrt): Handle exact integers and rationals in such a way that exact results are returned whenever possible. * test-suite/tests/numbers.test ("sqrt"): Add tests. 2013-03-20 Mark H Weaver Optimize scm_i_divide2double for integers less than 2^DBL_MANT_DIG. * libguile/numbers.c (scm_i_divide2double): Optimize for common case when both operands are less than 2^DBL_MANT_DIG (normally 2^53). 2013-03-19 Mark H Weaver SRFI-45: Support multiple values; add promise? predicate. * module/srfi/srfi-45.scm (eager): Accept any number of arguments. Store the list of arguments in the value record. Previously, only one argument was accepted, and that value was stored in the value record. (delay): Support expressions that return any number of arguments. (force): Return the list of values stored in the value record. (promise?): Export. * doc/ref/srfi-modules.texi (SRFI-45): Update docs. Remove typing for simplicity in discussing multiple values. * test-suite/tests/srfi-45.test: Add tests. Add FSF copyright for 2010 and 2013. Add missing year to André van Tonder's copyright notice. 2013-03-19 Mark H Weaver Use scientific notation only if there are enough trailing zeroes. * libguile/numbers.c (idbl2str): Print large numbers in scientific notation only if the exponent is >= 7 and the least significant non-zero digit has value >= radix^4. * test-suite/tests/numbers.test ("number->string"): Add tests. 2013-03-18 Ludovic Courtès Avoid rebuild of `guile.info' at the user's site. * configure.ac: Remove `doc/ref/effective-version.texi' from the `AC_CONFIG_FILES'. * doc/ref/Makefile.am ($(srcdir)/effective-version.texi): New target. Use byte-oriented functions in `get-bytevector*'. * libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_n, scm_get_bytevector_n_x, scm_get_bytevector_all): Use `scm_get_byte_or_eof' and `scm_peek_byte_or_eof' instead of their `char' counterparts. Reported by Chris K. Jester-Young. Define the new Linux-specific `SO_REUSEPORT'. * libguile/socket.c (scm_init_socket)[SO_REUSEPORT]: Define `SO_REUSEPORT'. (scm_setsockopt, scm_getsockopt): Update docstring. * doc/ref/posix.texi (Network Sockets and Communication): List `SO_REUSEPORT'. 2013-03-17 Mark H Weaver Reimplement idbl2str number printer. Fixes . * libguile/numbers.c (idbl2str): Reimplement. (mem2decimal_from_point): Accept negative exponents larger than SCM_MAXEXP that produce subnormals. (SCM_MAX_DBL_PREC): Removed preprocessor macro. (scm_dblprec, fx_per_radix): Removed static variables. (init_dblprec, init_fx_radix): Removed static functions. (scm_init_numbers): Remove initialization code for 'scm_dblprec' and 'fx_per_radix'. * test-suite/tests/numbers.test ("number->string"): Restore tests that previously failed. Remove comments about problems in the number printer that are now fixed. 2013-03-17 Mark H Weaver Improve inexact division of exact integers. * libguile/numbers.c (scm_i_divide2double): New function. (scm_i_divide2double_lo2b): New variable. (scm_i_fraction2double, log_of_fraction): Use 'scm_i_divide2double'. (do_divide): Removed. Its code is now in 'scm_divide'. (scm_divide2real): Removed. Superceded by 'scm_i_divide2double'. (scm_divide): Inherit code from 'do_divide', but without support for forcing a 'double' result (that functionality is now implemented by 'scm_i_divide2double'). Add FIXME comments in cases where divisions might not be as precise as they should be. (scm_init_numbers): Initialize 'scm_i_divide2double_lo2b'. * test-suite/tests/numbers.test (dbl-epsilon-exact, dbl-max-exp): New variables. ("exact->inexact"): Add tests. ("inexact->exact"): Add test for largest finite inexact. 2013-03-16 Daniel Hartwig http: support IP-literal (IPv6 address) in Host header * module/web/http.scm ("Host"): Parse and write IP-literals treating escapes as uri module does: remove brackets on parse, replace them on write. * test-suite/tests/web-http.test ("request headers"): Add tests. add tests for read-request-line, etc. * test-suite/web/web-http.test ("read-request-line"): ("write-request-line", "read-response-line", "write-response-line"): Add. 2013-03-16 Daniel Hartwig minor tweaks to web documentation * doc/ref/web.texi: Say `World Wide Web'; the hyphenated form is almost never used (c.f. w3.org). General predicate arguments are named `obj'. Fill in arguments omitted from some procedure definitions (e.g. `request-method'). Minor tweaks, such as using en-dash and missing markup as appropriate. Wrap very long deffn lines. * module/web/*.scm: Expand texinfo markup in doc strings. Synchronize with changes in web.texi. 2013-03-15 Andy Wingo more NEWS * NEWS: Update. incremental NEWS work * NEWS: Checkpoint. fix doc build * doc/ref/api-data.texi (Bitwise Operations): Don't use @-commands in @math. Fixes doc build. * doc/ref/api-macros.texi (Syntax Rules): Fix example result. 2013-03-13 Andy Wingo very beginnings of NEWS * NEWS: A very very very rough start at 2.0.8 news 2013-03-13 Andy Wingo add #:resolve-syntax-parameters? kwarg to syntax-local-binding * doc/ref/api-macros.texi (Syntax Transformer Helpers): Document. * module/ice-9/psyntax.scm (syntax-local-binding): Add #:resolve-syntax-parameters? kwarg. Fixes bug 10991. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syncase.test ("syntax-local-binding"): Add test. 2013-03-13 Andy Wingo allow for spurious wakeups from pthread_cond_wait * libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow for spurious wakeups while waiting on cond variables. Should fix bug 10641. 2013-03-13 Andy Wingo failing to load module in psyntax indicates an identifier is not macro * module/ice-9/boot-9.scm (false-if-exception): Add optional #:warning TEMPLATE ARG... tail, which indicates that we should print a warning on failure. (load-in-vicinity): Use the new #:warning. (make-autoload-interface): Surround the bits that load modules with a false-if-exception with #:warning. Fixes http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12202. * test-suite/tests/syncase.test ("missing autoloads do not foil psyntax"): Add a test. 2013-03-12 Mark H Weaver Reimplement 'inexact->exact' to avoid mpq functions. * libguile/numbers.c (scm_inexact_to_exact): Implement conversion of a double to an exact rational without using the mpq functions. * test-suite/tests/numbers.test (dbl-mant-dig): Simplify initializer. (dbl-epsilon, dbl-min-exp): New variables. ("inexact->exact"): Add tests. Fix broken "2.0**i to exact and back" test, and change it to "2.0**i to exact", to avoid use of 'exact->inexact'. 2013-03-12 Mark H Weaver Optimize logarithms using scm_i_big2dbl_2exp * libguile/numbers.c (log_of_exact_integer_with_size): Removed. (log_of_exact_integer): Handle bignums too large to fit in a double using 'scm_i_big2dbl_2exp' instead of 'scm_integer_length' and 'scm_ash'. (log_of_fraction): Use 'log_of_exact_integer' instead of 'log_of_exact_integer_with_size'. 2013-03-12 Mark H Weaver Simplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp * libguile/numbers.c (scm_i_big2dbl_2exp): New static function. (scm_i_big2dbl): Reimplement in terms of 'scm_i_big2dbl_2exp', with proper rounding. * test-suite/tests/numbers.test ("exact->inexact"): Add tests. 2013-03-12 Mark H Weaver Add 'round-ash', a rounding arithmetic shift operator * libguile/numbers.c (left_shift_exact_integer, floor_right_shift_exact_integer, round_right_shift_exact_integer): New static functions. (scm_round_ash): New procedure. (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and 'floor_right_shift_exact_integer'. * libguile/numbers.h: Add prototype for scm_round_ash. Rename the second argument of 'scm_ash' from 'cnt' to 'count'. * test-suite/tests/numbers.test (round-ash, ash): Add new unified testing framework for 'ash' and 'round-ash'. Previously, the tests for 'ash' were not very comprehensive; for example, they did not include a single test where the number to be shifted was a bignum. * doc/ref/api-data.texi (Bitwise Operations): Add documentation for 'round-ash'. Improve documentation for `ash'. 2013-03-12 Mark H Weaver Optimize and simplify fractions code. * libguile/numbers.c (scm_exact_integer_quotient, scm_i_make_ratio_already_reduced): New static functions. (scm_i_make_ratio): Rewrite in terms of 'scm_i_make_ratio_already_reduced'. (scm_integer_expt): Optimize fraction case. (scm_abs, scm_magnitude, scm_difference, do_divide): Use 'scm_i_make_ratio_already_reduced'. * test-suite/tests/numbers.test (expt, integer-expt): Add tests. 2013-03-11 Mike Gran Add standalone test for smob marking * test-suite/standalone/Makefile.am (TESTS, check_PROGRAMS): add test-smob-mark (test_smob_mark_SOURCES, test_smob_mark_CFLAGS, test_smob_mark_LDADD): new variables * test-suite/standalone/test-smob-mark.c: new file 2013-03-10 Jason Earl rely on gnulib for `poll' * configure.ac: * libguile/fports.c (fport_input_waiting): * libguile/poll.c (scm_primitive_poll): Rely on gnulib to provide poll for us. import `poll' from gnulib * lib/Makefile.am: * lib/poll.c: * lib/poll.in.h: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: * m4/poll.m4: * m4/poll_h.m4: Add poll gnulib module. 2013-03-10 Andy Wingo guile.m4 allows selection of guile 2.0, 1.8, etc. * meta/guile.m4 (GUILE_PKG): New macro, chooses a version of Guile against which to compile. (GUILE_FLAGS, GUILE_PROGS): Rewrite to call GUILE_PKG as necessary, to respect any previous call to GUILE_PKG, and to not require guile-tools. 2013-03-10 Jason Earl add %site-ccache-dir * libguile/load.h: * libguile/load.c (scm_sys_site_ccache_dir): New procedure. * doc/ref/scheme-using.texi (Installing Site Packages): * doc/ref/api-options.texi (Build Config): Add docs. Fixes bug 10326. 2013-03-10 Jason Earl excise use of "iff" in the manual * doc/ref/api-compound.texi: * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-macros.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/api-undocumented.texi: * doc/ref/api-utility.texi: * doc/ref/compiler.texi: * doc/ref/intro.texi: * doc/ref/scheme-using.texi: * doc/ref/sxml.texi: * doc/ref/web.texi: Change uses of "iff" to "if, otherwise". Fixes bug 10302. fix AC_CHECK_DECLS for `alarm' * configure.ac: Fix decl check for `alarm'. use chmod portably in (system base compile) * module/system/base/compile.scm (call-with-output-file/atomic): Call chmod with the file name instead of the port. fix response-body-port for responses without content-length * module/web/response.scm (response-body-port): Correctly handle cases in which EOF terminates the body. 2013-03-09 Andy Wingo provide getlogin declaration if needed. * configure.ac: Check for getlogin decl. * libguile/posix.c: Declare getlogin if needed. fix mingw issues with posix.c * libguile/posix.c (scm_execl, scm_execlp, scm_execle) (scm_open_process): Remove casts for ancient mingw. (scm_utime): If we fall back to utime, assert that flags is 0. (scm_getlogin): Rely on gnulib. add getlogin from gnulib * lib/Makefile.am: * lib/getlogin.c: * m4/getlogin.m4: * m4/gnulib-cache.m4: Add getlogin module. 2013-03-09 Andy Wingo don't provide scm_std_select on mingw and similar platforms * libguile/iselect.h: If we do not have sys/select.h, don't provide scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR. Guile should not be setting these macros in public API. This is an incompatible change on mingw, but oh well. * libguile/threads.c: Rely on gnulib's select, and use that to implement scm_std_select. * libguile/deprecated.h: * libguile/deprecated.c: Only provide scm_internal_select if we have sys/select.h. 2013-03-09 Andy Wingo simplify posix.c * libguile/posix.c: Reorder includes to fix mingw include-order problem. Remove ttyname shims; gnulib is the place to fix that. Remove winsock2 include, as gnulib seems to handle that OK. Rely on the new pipe-posix gnulib module. Don't bother shimming getlogin, etc on mingw; gnulib is the place for shims. simplify readline.c * guile-readline/readline.c: Remove all mingw special-casing, relying instead on mingw / gnulib doing the right thing. simplify stime back-compat shims for tzname * libguile/stime.c: Remove tzname declarations for ancient mingw and SGI RS6000. mingw include order for socket.c * libguile/socket.c: Reorder includes to fix include order on mingw. fix include-order problem in net_db.c for mingw * libguile/net_db.c: Reorder includes to avoid include-order problem on mingw. silence mingw32 warning in i18n.c * libguile/i18n.c (scm_make_locale): Silence a warning. fports uses gnulib's select * libguile/fports.c: Reorder includes to put system includes first; fixes windows/winsock2 include error problem. Rely on Gnulib's select module. (fport_input_waiting): Use select instead of scm_std_select. simplify filesys.c via gnulib's select and fstat modules * libguile/filesys.c: Instead of using scm_std_select, just use select, relying on gnulib to provide it to us. Likewise, rely on fstat. if we have threads on windows, we have pthreads; inform bdw-gc of that * libguile/bdw-gc.h: If we have threads enabled on mingw32, explicitly mark GC_WIN32_PTHREADS. See http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/5564 for more info. remove init.c iselect include * libguile/init.c: Remove iselect include. portability simplification with scmsigs.c and alarm * configure.ac (alarm): Check for decl. * libguile/scmsigs.c: Reorder includes to put system includes first. Fixes include order on mingw. Remove #define for alarm, as we will use HAVE_DECL_ALARM. Remove #defines for sleep and usleep, as they are not used. (scm_alarm): Only define if HAVE_DECL_ALARM. add gnulib fstat module explicitly * lib/Makefile.am: * m4/gnulib-cache.m4: Explicitly add fstat module. Import `pipe-posix' module from gnulib. * lib/Makefile.am: * lib/pipe.c: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: * m4/pipe.m4: Add pipe-posix module. 2013-03-09 Andy Wingo squish remove some mingw-specific code that is covered by gnulib * libguile/socket.c (scm_init_socket): Remove mingw-specific code. * libguile/fports.c: Remove ftruncate redefine; mingw is fine. (scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat. The right place for an F_GETFL replacement would be in gnulib. (fport_input_waiting): Remove an outdated comment. * libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses with strerror and errno. * libguile/win32-socket.c: * libguile/win32-socket.h: Remove. Mingw has suitable replacements. * configure.ac: * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (noinst_HEADERS): Update for win32-socket removal. 2013-03-09 Andy Wingo remove mingw32 implementations of {get,end,set}{serv,proto}ent * libguile/win32-socket.h: * libguile/win32-socket.c (getservent, endservent, setservent) (getprotoent, endprotoent, setprotoent): Remove mingw32 wrappers. Their place is in gnulib, if anywhere. 2013-03-09 Andy Wingo add check for struct pollfd * configure.ac: Add check for struct pollfd. * libguile/fports.c (fport_input_waiting): * libguile/poll.c (scm_primitive_poll): Require struct pollfd. Fixes bug 13903. 2013-03-09 Andy Wingo allow case-lambda expressions with no clauses * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow 0 clauses. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): * module/language/tree-il.scm (unparse-tree-il): (tree-il-fold, post-order!, pre-order!): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/peval.scm (peval): Allow for lambda-body to be #f. * libguile/memoize.c (memoize): * module/language/tree-il/canonicalize.scm (canonicalize!): Give a body to empty case-lambda before evaluating it or compiling it, respectively. * test-suite/tests/optargs.test ("case-lambda", "case-lambda*"): Add tests. 2013-03-09 Andy Wingo fix in-tree guile reference * meta/guile.in (GUILE): Add @EXEEXT@ for libguile/guile reference, for MinGW compiles. 2013-03-07 Mark H Weaver Improve standards conformance of string->number. Fixes . * libguile/numbers.c (mem2ureal): New argument 'allow_inf_or_nan'. Accept infinities and NaNs only if 'allow_inf_or_nan' is true and "#e" is not present. Check for "inf.0" or "nan." case-insensitively. Do not accept rationals with zero divisors. (mem2complex): Pass new 'allow_inf_or_nan' argument to 'mem2ureal', which is set if and only if a explicit sign was present. * test-suite/tests/numbers.test ("string->number"): Add tests. 2013-03-07 Stefan Israelsson Tampe add GUILE_STACK_SIZE environment variable * libguile/vm.c (initialize_default_stack_size): New helper. (scm_bootstrap_vm): Call initialize_default_stack_size. * doc/ref/guile-invoke.texi (Environment Variables): Add docs. Based on a patch by Stefan Israelsson Tampe. 2013-03-07 Andy Wingo support calls and tail-calls with more than 255 formals * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Support calls and tail-calls with more than 255 formals. * test-suite/tests/tree-il.test ("many args"): Add a test. 2013-03-07 Andy Wingo ,option evaluates its right-hand-side * doc/ref/scheme-using.texi (System Commands): Better documentation for ,option. * module/system/repl/command.scm (option): Evaluate the RHS when setting an option. Fixes bug 13076. 2013-03-07 Andy Wingo GUILE_INSTALL_LOCALE=1 during build * doc/ref/Makefile.am (autoconf-macros.texi): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.scm.gen, ice-9/psyntax-pp.go): * test-suite/Makefile.am (GUILE_AUTO_COMPILE): * test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE): * test-suite/vm/Makefile.am (TESTS_ENVIRONMENT): * am/guilec (.scm.go): Set GUILE_INSTALL_LOCALE to 1 during the build. Fixes bug 12887. 2013-03-07 Ludovic Courtès Install the current locale if GUILE_INSTALL_LOCALE is nonzero. * libguile/guile.c (get_integer_from_environment) (should_install_locale): New functions. (main): Add `setlocale' call. * doc/ref/guile-invoke.texi (Environment Variables): Add documentation. 2013-03-07 Andy Wingo structs with tail arrays are not simple * libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE, SCM_VTABLE_FLAG_SIMPLE_RW): * libguile/struct.c (set_vtable_layout_flags): Vtable whose layouts include a tail array are not simple. Fixes bug 12808. fix compilation under mingw * libguile/load.c (is_absolute_file_name, search_path): Fix compilation under mingw. 2013-03-07 Ludovic Courtès Make `SCM_LONG_BIT' usable in preprocessor conditionals. Reported by Jan Schukat . Partly fixes . * libguile/__scm.h (SCM_LONG_BIT)[!defined LONG_BIT]: Use SCM_SIZEOF_LONG since `sizeof' cannot be used in #if directives as found in numbers.c. 2013-03-07 Ludovic Courtès Use `scm_is_eq' in load.c. * libguile/load.c (is_file_name_separator): Use `scm_is_eq' instead of `=='. doc: Allow compilation of r5rs.texi with Texinfo 5.0. * doc/r5rs/r5rs.texi: Remove extraneous @author. Change @unnumbered to @majorheading within @titlepage. 2013-03-06 Mark H Weaver Verify that FLT_RADIX is 2. * libguile/numbers.c: Trigger a compilation error if FLT_RADIX is not 2. This has long been assumed by code in numbers.c. Improve code in scm_gcd for inum/inum case * libguile/numbers.c (scm_gcd): Improve implementation of inum/inum case to be more clear and efficient. 2013-03-05 Mark H Weaver Fix thread-unsafe lazy initializations. * libguile/debug.c (scm_local_eval): libguile/ports.c (scm_current_warning_port): libguile/strports.c (scm_eval_string_in_module): Perform lazy-initialization while holding a mutex. Use SCM_UNDEFINED as the uninitialized value. Use 'scm_c_*_variable'. * doc/ref/api-modules.texi (Accessing Modules from C): Fix 'my_eval_string' example to be thread-safe. 2013-03-04 Ludovic Courtès doc: Rename "Texinfo" node to "Texinfo Processing". * doc/ref/texinfo.texi (Texinfo): Rename to... (Texinfo Processing): ... this. * doc/ref/guile.texi (Guile Modules): Update menu. Use `scm_is_eq' in filesys.c. * libguile/filesys.c (is_file_name_separator): Use `scm_is_eq' instead of `=='. Fixes . 2013-03-02 Bake Timmons Improve keyword notation of Texinfo function definitions. * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-modules.texi: * doc/ref/compiler.texi: * doc/ref/web.texi: Make Texinfo function headers more consistent. Change lesser used keyword notation to the predominant form. * doc/ref/api-procedures.texi: Fix an argument name in a header that should use repeated argument notation. * doc/ref/srfi-modules.texi: Update references in Texinfo function definition body to match previously updated variable notation in definition header. 2013-03-01 Ludovic Courtès doc: Fix build with Texinfo 5.0. * doc/ref/api-control.texi (Handling Errors): Move misplaced description for `scm_memory_error' & co. * doc/ref/r6rs.texi (rnrs base): Change `deffnx' of `let-syntax' and `letrec-syntax' to fit on one line. 2013-03-01 Ludovic Courtès Allow the SMOB mark procedures to be called when libgc uses parallel markers. Fixes . Reported by Mike Gran . * libguile/smob.c (current_mark_stack_pointer, current_mark_stack_limit): New variables. (smob_mark): Use CURRENT_MARK_STACK_POINTER and CURRENT_MARK_STACK_LIMIT instead of the same-named fields of `SCM_I_CURRENT_THREAD'. (scm_gc_mark): Likewise. (scm_smob_prehistory): Initialize CURRENT_MARK_STACK_LIMIT and CURRENT_MARK_STACK_POINTER. * libguile/threads.h (scm_i_thread): Add comment that `current_mark_stack_ptr' and `current_mark_stack_limit' are no longer used. 2013-03-01 Ludovic Courtès Use accessors instead of symbols deprecated in libgc 7.3. * configure.ac: Check for `GC_set_all_interior_pointers', `GC_get_gc_no', and `GC_set_java_finalization'. * libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'. (scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use `GC_set_all_interior_pointers'. * libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]: Use `GC_set_java_finalization'. 2013-03-01 Daniel Hartwig test-suite: eq-ness of numbers, characters is unspecified * test-suite/tests/00-socket.test: * test-suite/tests/alist.test: * test-suite/tests/elisp.test: * test-suite/tests/encoding-iso88591.test: * test-suite/tests/encoding-iso88597.test: * test-suite/tests/encoding-utf8.test: * test-suite/tests/hash.test: * test-suite/tests/i18n.test: * test-suite/tests/modules.test: * test-suite/tests/ports.test: * test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when comparing numbers, characters. Checked also for similar uses of assq[-ref]. * test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test to use eqv-ness, not eq-ness, which should not impact its purpose as these two are equivalent for strings. 2013-03-01 Mark H Weaver Fix later-bindings-win logic in with-fluids. Based on a patch by David Kastrup . Fixes . * libguile/fluids.c (scm_i_make_with_fluids): Reverse direction of inner loop that checks for duplicates, to properly handle more than two bindings to the same fluid. 2013-02-28 Mark H Weaver Fix duplicate removal of with-fluids. Based on a patch by David Kastrup . Fixes . * libguile/fluids.c (scm_i_make_with_fluids): Remove the duplicate binding instead of the last binding. * test-suite/tests/fluids.test: Add test, and fix existing duplicate tests. * THANKS: Thanks David Kastrup. 2013-02-28 Mark H Weaver Support calling foreign functions of 10 arguments or more. * libguile/foreign.c (OBJCODE_HEADER, META_HEADER, META): Change these into higher-order macros. (GEN_CODE): New higher-order macro based on 'CODE'. (M_STATIC, M_DYNAMIC): New macros. (CODE): Reimplement using 'GEN_CODE' and 'M_STATIC'. (make_objcode_trampoline): New static function. (large_objcode_trampolines, large_objcode_trampolines_mutex): New static variables. (get_objcode_trampoline): New static function. (cif_to_procedure): Use 'get_objcode_trampoline'. * test-suite/standalone/test-ffi-lib.c (test_ffi_sum_many): New function. * test-suite/standalone/test-ffi: Add test. 2013-02-28 Ludovic Courtès Fix handling of the *-gnux32 target. * module/system/base/target.scm (triplet-pointer-size): Fix typo in the x32 triplet name. * test-suite/tests/asm-to-bytecode.test (native-os): New procedure. (test-target): Use (native-word-size) only when both the CPU and OS match. 2013-02-28 David Kastrup Let reverse! accept arbitrary types as second argument (new_tail) * libguile/list.c (scm_reverse_x): remove typecheck for 2nd arg. 2013-02-27 Ludovic Courtès Recognize the `x86_64.*-gnux32' triplet. * module/system/base/target.scm (triplet-pointer-size): Add case for "^x64_64-.*-gnux32". * test-suite/tests/asm-to-bytecode.test ("cross-compilation"): ["x86_64-unknown-linux-gnux32"]: New test. Check whether a triplet's OS part specifies an ABI. * module/system/base/target.scm (cpu-word-size): Rename to... (triplet-pointer-size): ... this. Update caller. Take a triplet as the argument. Check the `triplet-os' part when checking for equality with the host. Add support "mips64.*-gnuabi64". * test-suite/tests/asm-to-bytecode.test ("cross-compilation") [ "mips64el-unknown-linux-gnuabi64"]: New test. Recognize mips64* as having 32-bit pointers by default. * module/system/base/target.scm (cpu-word-size): Consider MIPS64 to default to n32 or o32. * test-suite/tests/asm-to-bytecode.test ("cross-compilation") ["mips64el-unknown-linux-gnu"]: New test. tests: Avoid missing missing-prototype warning with on glibc 2.17. * test-suite/standalone/test-round.c: Avoid missing-prototype warning with on glibc 2.17. Fix cross-compilation of `c-tokenize.o'. * libguile/Makefile.am (c-tokenize.$(OBJEXT)): Pass -I$(top_builddir) when cross-compiling. 2013-02-26 Mark H Weaver Update copyright dates on random.c * libguile/random.c: Add 2012 and 2013 to the copyright notice. 2013-02-25 Mark H Weaver random_state_of_last_resort: use getpid directly, instead of scm_getpid * libguile/random.c: Include and (if present). (random_state_of_last_resort): Use getpid directly. Revert "random_state_of_last_resort doesn't rely on HAVE_POSIX" This reverts commit eaf21539d4afb8df5d1b549215fd397b23004947. Revert "random-state-from-platform: simplify pid conditional, and clarify docs." This reverts commit 08904661a2b1c6d461b2f5abfe3226a4023453fb. 2013-02-25 Mark H Weaver random-state-from-platform: simplify pid conditional, and clarify docs. * libguile/random.c (random_state_of_last_resort): Simplify optional inclusion of PID in the random state. Clarify in the comments that the PID is only included where scm_getpid is present. * doc/ref/api-data.texi (Random): Clarify that 'random-state-from-platform' includes the PID in the random state only if scm_getpid is present. 2013-02-24 Andy Wingo remove language/glil/decompile-assembly.scm * module/language/glil/decompile-assembly.scm: Remove. This module never worked, and even failed to compile. * module/language/glil/spec.scm: * module/Makefile.am: Remove references to (language glil decompile-assembly). 2013-02-24 Andy Wingo deprecate (ice-9 mapping) * module/ice-9/mapping.scm: Add deprecation warning. 2013-02-24 Daniel Hartwig fix and update (ice-9 mapping) * module/ice-9/mapping.scm (mapping-create-handle!): INIT is required. (mapping-ref): Rewrite. Fix problem with DFLT. (hash-table-mapping-hooks): Drop DELETE-PROC, hash-table accessors only use ASSOC-PROC. Add INIT to create-handle hook. Use correct hash-table accessors. (make-hash-table-mapping): Drop DELETE-PROC. (hash-table-mapping): Rewrite. Drop DELETE-PROC. 2013-02-24 Andy Wingo cleanup to filesys.c's handling of file name separators * libguile/filesys.c (is_file_name_separator): New helper, as in load.c. (scm_dirname, scm_basename, scm_i_relativize_path): Use is_file_name_separator. simplify scm_stat on mingw * libguile/filesys.c (scm_stat): Don't munge the filename on MinGW; gnulib does that for us. load.c uses same logic as boot-9 for file names * libguile/load.c (is_file_name_separator, is_drive_letter): (is_absolute_file_name): New helpers, like the ones in boot-9. Perhaps we should just define them in C. (search_path, scm_try_auto_compile, canonical_suffix): Rewrite using the new helpers. allow '/' in the prefix of UNC file names on windows * module/ice-9/boot-9.scm (absolute-file-name?) [WINDOWS]: Allow '/' as well as '\' when detecting UNC names. (load-in-vicinity): Add a comment about the purpose of canonical->suffix. random_state_of_last_resort doesn't rely on HAVE_POSIX * libguile/random.c (random_state_of_last_resort): Add the PID as a seed only if we have scm_getpid(). 2013-02-21 Mike Gran Update predefined character sets to Unicode 6.2 * libguile/srfi-14.i.c (cs_graphic_ranges, cs_printing_ranges, cs_symbol_ranges) (cs_designated_ranges): modified 2013-02-20 Andy Wingo net_db.c doesn't import winsock2.h * libguile/net_db.c: Don't include winsock2.h; gnulib handles this for us as necessary. mkstemp uses O_BINARY * libguile/mkstemp.c (mkstemp): Add O_BINARY. Since temp files are empty at the beginning, we're not changing the behavior for reading files. For writing files `newline' and ~% can add \r elements as needed. So this is a reasonable thing to do, and it prevents mangling of temp files for the compiler. fix compilation of functions with more than 255 local variables. * module/language/glil/compile-assembly.scm (glil->assembly): Fix case where there are more than 255 local variables. Whoops! 2013-02-19 Andy Wingo fix an error message loading invalid bytecode * libguile/objcodes.c (make_objcode_from_file): Add correct error message if full_read failed without an errno. copy-file and load-objcode use O_BINARY * libguile/filesys.c (scm_copy_file): * libguile/objcodes.c (scm_load_objcode): Use O_BINARY. Thanks to Eli Zaretskii for the patch. 2013-02-19 Eli Zaretskii Fix startup of guile.exe on MS-Windows. * module/system/base/compile.scm (call-with-output-file/atomic): Call close-port before deleting the temporary file name, otherwise deletion fails on MS-Windows (cannot delete a file that is still open). 2013-02-19 Andy Wingo add link to doc about UNC names * module/ice-9/boot-9.scm (compile-time-case): Add link to docs about UNC names. 2013-02-19 Andy Wingo better handling of windows file name conventions * libguile/filesys.c (scm_system_file_name_convention): New function. Exported to Scheme only. * module/ice-9/boot-9.scm (file-name-separator?, absolute-file-name?): New predicates. (file-name-separator-string): New global variable. (in-vicinity): Use the new procedures. (load-user-init, try-module-autoload): Use file-name-separator-string. (load-in-vicinity): Update canonical->suffix. Consistently use the term "file name" throughout. * module/ice-9/psyntax.scm (include): Use global `absolute-file-name?'. * module/ice-9/psyntax-pp.scm: Regenerate. 2013-02-19 Mark H Weaver Remove flawed test that assumed (eq? 1/2 2/4) would return false. * test-suite/tests/hash.test ("hash-count"): Remove flawed test. 2013-02-18 Ludovic Courtès build: Fix compilation of `c-tokenize.c' with latest Gnulib. * libguile/c-tokenize.lex: Include , to pull in Gnulib macro definitions now required. 2013-02-18 Andy Wingo add gnulib `times' module * lib: Add `times' module. Should fix socket.c on MinGW. Thanks to Eli Zaretskii for the report. Add gnulib `select' module. Should fix fport_input_waiting when neither poll nor select nor FIONREAD are available, which is the case on MinGW. Thanks to Eli Zaretskii for the report. Update to gnulib 0.0.7865-a828. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/array-handle.c libguile/deprecated.h libguile/inline.c libguile/inline.h module/ice-9/deprecated.scm module/language/tree-il/peval.scm 2013-02-18 Daniel Llorens Array documentation fixes * libguile/generalized-arrays.c: Fix wording of docstring for array-length. * doc/ref/api-compund.texi: - Document scm_array_type(), scm_array_ref(), array-length, scm_array_length(), scm_c_array_length(). - Fix wording of documentation for array-in-bounds? 2013-02-18 Andy Wingo deprecate generalized vectors in favor of arrays * libguile/generalized-arrays.h: * libguile/generalized-arrays.c (scm_c_array_length): (scm_array_length): New functions. * module/ice-9/deprecated.scm: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_generalized_vector_p) (scm_generalized_vector_length, scm_generalized_vector_ref) (scm_generalized_vector_set_x, scm_generalized_vector_to_list): Deprecate. * libguile/uniform.c (scm_uniform_vector_to_list): Use scm_array_to_list. * module/ice-9/boot-9.scm (case): Arrays are generalized vectors. * module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array functions instead of the generalized-vector functions. * test-suite/tests/arrays.test: Remove generalized-vector->list test; covered by array->list test. * test-suite/tests/bitvectors.test: * test-suite/tests/bytevectors.test: * test-suite/tests/srfi-4.test: Adapt to test using array interfaces instead of generalized-vector interfaces. * doc/ref/api-compound.texi: Remove generalized vector docs. * doc/ref/api-data.texi: * doc/ref/srfi-modules.texi: Adapt. 2013-02-18 Andy Wingo optimize access to arrays of rank 1 or 2 * libguile/array-handle.c (scm_array_handle_pos_1): (scm_array_handle_pos_2): New functions. * libguile/generalized-arrays.c (scm_c_array_ref_1, scm_c_array_ref_2): (scm_c_array_set_1_x, scm_c_array_set_2_x): New functions. (scm_i_array_ref, scm_i_array_set_x): New subr bindings for array-ref and array-set! that avoid consing for arrays of rank 1 or 2. * test-suite/tests/arrays.test ("array-set!"): Fix expected exception for wrong number of indices. 2013-02-18 Andy Wingo array handle inline functions defined in array-handle.h. * libguile/inline.h: * libguile/array-handle.h (scm_array_handle_ref): (scm_array_handle_set): Move definitions here from inline.h. * libguile/inline.c: Include array-handle.h. 2013-02-18 Daniel Hartwig add hash-count for native tables * libguile/hashtab.c (scm_hash_count): New function. Count the number of elements in a hash table. * doc/ref/api-compound.texi (Hash Tables): Update examples and reference. * test-suite/tests/hash.test (hash-count): New test. 2013-02-16 Ludovic Courtès Fix `getgroups' for when zero supplementary group IDs exist. * libguile/posix.c (scm_getgroups): Return the empty vector when NGROUPS is zero. Reported by Mike Gran . 2013-02-15 Andy Wingo local rewrite for apply to a let-bound rest list * module/language/tree-il/peval.scm (peval): Add a special-case inlining pattern for apply to a let-bound rest arg that preserves effect ordering. * test-suite/tests/peval.test ("partial evaluation"): Add a test, and update an older test with a better result. 2013-02-15 Andy Wingo inline call-with-values consumers with optional and/or rest args * module/language/tree-il/peval.scm (peval): Inline call-with-values whose consumers have optional and rest arguments. * test-suite/tests/peval.test ("partial evaluation"): Add test. 2013-02-15 Andy Wingo more rest argument inlining improvements * module/language/tree-il/peval.scm (peval): Correct comment on find-definition, and allow a find-definition to fall back on a source expression. Avoid copying non-constant expressions. * test-suite/tests/peval.test ("partial evaluation"): Add a test that inlining rest arguments works with complicated argument expressions, and a test that order of effects in rest args is preserved. 2013-02-15 Andy Wingo better inlining of `apply' with rest arguments * module/language/tree-il/peval.scm (peval): Move up the find-definition helper. Use it to speculatively destructure conses and lists into the tail position of an `apply' form. * test-suite/tests/peval.test ("partial evaluation"): Add tests. 2013-02-15 Andy Wingo procedures with rest arguments can get inlined * module/language/tree-il/peval.scm (peval): Allow inlining of procedures with rest arguments. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2013-02-14 Andy Wingo peval can inline let-bound lambdas * module/language/tree-il/peval.scm (peval): Better inlining of complicated operators. * test-suite/tests/peval.test ("partial evaluation"): Add a couple tests. 2013-02-14 Daniel Hartwig update old references in FFI doc * doc/ref/api-foreign.texi (Foreign Types): Replace references to the old foreign->bytevector and bytevector->foreign with the new procedure names using pointer. 2013-02-12 Andy Wingo allow (define-macro name (lambda ...)) * module/ice-9/boot-9.scm (define-macro): Allow define-macro NAME LAMBDA. A bugfix. Thanks to Akop Pogosian. 2013-02-09 Andy Wingo (texinfo): add a command-spec for @math{}. * module/texinfo.scm (texi-command-specs): Add `math' as inline-text. (texinfo docbook): informaltable is a block element. * module/texinfo/docbook.scm (*sdocbook-block-commands*): informaltable is a block element. (texinfo plain-text): Pass @math{} through as-is. * module/texinfo/plain-text.scm (tag-handlers): Pass `math' through as-is. (texinfo serialize): don't break words when wrapping * module/texinfo/serialize.scm (wrap): Don't break long words by default; that could break @-commands. 2013-02-02 Mark H Weaver Add copyright notice to gen-scmconfig.c. * libguile/gen-scmconfig.c: Add copyright notice. 2013-02-02 Mark H Weaver Add foreign types: ssize_t and ptrdiff_t. * libguile/foreign.c (sym_ssize_t, sym_ptrdiff_t): New symbols. (scm_init_foreign): Add bindings for ssize_t and ptrdiff_t. * module/system/foreign.scm: Export ssize_t and ptrdiff_t. * doc/ref/api-foreign.texi (Foreign Types): Add docs. 2013-02-02 Mark H Weaver Add scm_from_ptrdiff_t and scm_to_ptrdiff_t. * libguile/numbers.h (scm_from_ptrdiff_t, scm_to_ptrdiff_t): New macros (function aliases). * doc/ref/api-data.texi: Add docs. 2013-02-02 Mark H Weaver Fix typo in comment generated by gen-scmconfig.c. * libguile/gen-scmconfig.c (main): Fix typo in generated comment. 2013-02-01 Ludovic Courtès guild: Gracefully handle failures to install the locale. * meta/guild.in (main): Catch `system-error' when calling `setlocale', and gracefully handle any error. Skip FFI tests that rely on `-export-dynamic' behavior when not available. * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Skip when `scm_is_pair' cannot be found, as is the case on Cygwin. Reported by "objc" . 2013-01-31 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm module/language/bytecode/spec.scm module/language/tree-il/spec.scm 2013-01-31 Mark H Weaver Do not defer expansion of internal define-syntax forms. * module/ice-9/psyntax.scm (expand-body): As required by R6RS, evaluate the right-hand-sides of internal 'define-syntax' forms and add their transformers to the compile-time environment immediately, so that the newly-defined keywords may be used in definition context within the same lexical contour. Fixes #13509. Bump copyright year to 2013 in REPL greeting. * module/system/repl/common.scm: Add not only 2013, but also 2012 to the copyright notice at the top of the file, since the file was changed in 2012. (*version*): Bump copyright year to 2013 in REPL greeting. 2013-01-30 Andy Wingo Revert "detect and consume byte-order marks for textual ports" This reverts commit b2cb557d75e4daf8c7c8cd43313f4cc51d9a3f1b, which was pushed accidentally. 2013-01-30 Andy Wingo add #:doctype-handler to xml->sxml * module/sxml/simple.scm (read-internal-doctype-as-string): New helper. (xml->sxml): Add #:doctype-handler argument. * doc/ref/sxml.texi (Reading and Writing XML): Document #:doctype-handler. Fix some other examples, and fix the default value of #:declare-namespaces?. * test-suite/tests/sxml.simple.test: Add all tests from the manual here. 2013-01-30 Andy Wingo quick fix to ssax.scm * module/sxml/ssax.scm: Fix previous commit. fix ssax:warn to work as intended * module/sxml/ssax.scm (ssax:warn): Fix to make more sense. 2013-01-30 Andy Wingo detect and consume byte-order marks for textual ports * libguile/ports.h: * libguile/ports.c (scm_consume_byte_order_mark): New procedure. * libguile/fports.c (scm_open_file): Call consume-byte-order-mark if we are opening a file in "r" mode. * libguile/read.c (scm_i_scan_for_encoding): Don't do anything about byte-order marks. * libguile/load.c (scm_primitive_load): Add a note about the duplicate encoding scan. * test-suite/tests/filesys.test: Add tests for UTF-8, UTF-16BE, and UTF-16LE BOM handling. 2013-01-30 Andy Wingo require automake 1.12 for `serial-tests'. * configure.ac: Require automake 1.12 for `serial-tests'. 2013-01-28 Ludovic Courtès build: Allow use of Automake 1.13. Fixes . Reported by DNS . * configure.ac: Use the `serial-tests' Automake option to cope with Automake 1.13, which uses `parallel-tests' by default. 2013-01-28 Ludovic Courtès Remove unneeded SMOB mark procedure in `memoize.c'. * libguile/memoize.c (scm_init_memoize): Remove unnecessary call to `scm_set_smob_mark'. 2013-01-28 Ian Price Fix argument count for various format string escape sequences. * module/language/tree-il/analyze.scm (format-string-argument-count): Handle ~t and ~k options case-insensitively. ~! ~| ~/ ~q and ~Q should not update the min-count or max-count. ~^ returns the min-count and 'any + - # and ' should not increase the argument count. * test-suite/tests/tree-il.test (*): Tests for new parameters. 2013-01-28 Andy Wingo xml->sxml argument can be a port or a string * module/sxml/simple.scm (xml->sxml): Allow the optional arg to be a port or a string. * doc/ref/sxml.texi (Reading and Writing XML): Update docs. 2013-01-28 Andy Wingo make (sxml simple)'s xml->sxml more capable * module/sxml/simple.scm (xml->sxml): Add #:namespaces, #:declare-namespaces?, #:entities, #:default-entity-handler, and #:trim-whitespace? arguments. * doc/ref/sxml.texi (Reading and Writing XML): Document the new options. 2013-01-28 Andy Wingo ssax: treat *DEFAULT* as a fallback handler in entity alist * module/sxml/upstream/SSAX.scm (ssax:handle-parsed-entity): Interpret *DEFAULT* as being a default handler procedure for parsed entities. Includes test. 2013-01-28 Andy Wingo begin rewriting SXML docs * doc/ref/sxml.texi (SXML): Reorder and begin rewriting. Fix formatting throughout, provide a new introduction, and the beginning of proper SSAX documentation. * doc/ref/sxml-match.texi: * doc/ref/texinfo.texi: * doc/ref/web.texi: Update references to new node names. 2013-01-27 Andy Wingo current-ssax-error-port is a parameter * module/sxml/ssax.scm (current-ssax-error-port): Change to be a parameter. 2013-01-27 Mark H Weaver Fix source annotation bug in psyntax 'expand-body'. * module/ice-9/psyntax.scm (expand-body): Apply source-annotation to an expression, not to the expression's compile-time environment. * module/ice-9/psyntax-pp.scm: Regenerate. 2013-01-27 Mark H Weaver Add 'for-humans?' flag to specifications. * module/system/base/language.scm (): Add 'for-humans?' field, and export new 'language-for-humans?' predicate. * doc/ref/compiler.texi (Compiler Tower): Document. * module/language/assembly/spec.scm, module/language/bytecode/spec.scm, module/language/glil/spec.scm, module/language/objcode/spec.scm, module/language/tree-il/spec.scm, module/language/value/spec.scm: Mark these languages as 'for-humans?'. 2013-01-26 Ludovic Courtès Add tests for `--language'. * test-suite/standalone/Makefile.am (top_srcdir): Add `top_srcdir'. (check_SCRIPTS, TESTS): Add `test-language'. (EXTRA_DIST): Add `test-language.el' and `test-language.js'. * test-suite/standalone/test-language, test-suite/standalone/test-language.el, test-suite/standalone/test-language.js: New files. ecmascript: Fix conversion to boolean for non-numbers. * module/language/ecmascript/base.scm (->boolean): Call `zero?' and `nan?' only when X is a number. * test-suite/tests/ecmascript.test ("compiler"): Add test case. Clarify the copyright status of GOOPS. * module/oop/goops.scm, module/oop/goops/active-slot.scm, module/oop/goops/composite-slot.scm, module/oop/goops/describe.scm: Add a copyright line for Érick Gallesio. Mention the STk version GOOPS was derived from. Remove mentions of the ‘COPYRIGHTS’ file. Thanks to Karl Berry for pointing it out, and to Michael Djurfeldt . 2013-01-23 Mark H Weaver Regenerate psyntax-pp.scm. * module/ice-9/psyntax-pp.scm: Regenerate. This should have been done in commit 84f5a8251710c7d2a01590aa083d9dd409a56279 (`include' relative paths relative to including file). 2013-01-23 Andy Wingo oop goops save: fix compile-time availability of write-component * module/oop/goops/save.scm (write-component) (write-component-procedure): Move definitions up so that syntax definition is available when compiling the rest of the file. Merge remote-tracking branch 'origin/stable-2.0' Merge remote-tracking branch 'origin/stable-2.0' merge stable-2.0 There are some bugs with command-line handling that will be sorted out with the next commit. fix regression in -l * module/ice-9/command-line.scm (compile-shell-switches): Fix regression with -l argument, which was loading arg0 instead. load files from the command line relative to the cwd * module/ice-9/command-line.scm (load/lang): Load files from the command line relative to the current working directory (fixes regression). Merge branch 'wip-peg-ownership' This merged branch has the correct author information for commit eee0877c3e6ade8f2fa243cfa696918451c67aff. 2013-01-23 Michael Lucy add PEG parser generator * module/ice-9/peg.scm: New file. * module/Makefile.am: Add to build. * doc/ref/Makefile.am: * doc/ref/api-peg.texi: * doc/ref/guile.texi: Add documentation for PEG parser. * test-suite/Makefile.am: * test-suite/tests/peg.bench: * test-suite/tests/peg.test: Add tests, and a benchmark. 2013-01-23 Andy Wingo add --language argument * module/ice-9/command-line.scm (*usage*): Make usage of capitalization and sentences consistent (lower-case and semicolons, as in ls --help). Be less specific about languages (Scheme is the default but not the only language). Document --language. (load/lang, eval-string/lang): New helpers. (compile-shell-switches): Parse a --language argument, and use it to set (current-language). fix dynamic-call doc * doc/ref/api-foreign.texi (Foreign Functions): Fix doc: interrupts are not deferred in a dynamic-call. 2013-01-22 Andy Wingo paameterize in read-and-compile * module/system/base/compile.scm (read-and-compile): Use current-language parameter. docstring in rdelim * module/ice-9/rdelim.scm: Update docstring. 2013-01-22 Andy Wingo current-language is a parameter in boot-9 * module/ice-9/boot-9.scm (current-language): New parameter. * module/system/base/language.scm (*current-language*): Pull fluid from parameter. (current-language): Now a re-exported parameter. * doc/ref/compiler.texi: Update reference from *current-language* fluid to current-language parameter. * module/system/base/compile.scm (compile-and-load): * module/ice-9/top-repl.scm (top-repl): Default to the current language, not to Scheme. * module/ice-9/eval-string.scm: * module/system/base/language.scm: * module/system/repl/command.scm: * module/system/repl/repl.scm: Update to use current-language parameter and parameterize. 2013-01-22 Andy Wingo add fluid->parameter * module/ice-9/boot-9.scm (make-parameter): Add a docstring. (fluid->parameter): New interface. Use it when turning port fluids into parameters. * doc/ref/api-scheduling.texi (Parameters): Deffn instead of defun for make-parameter documentation. Add docs for fluid->parameter. 2013-01-22 Andy Wingo add read-string and read-string! to (ice-9 rdelim) * module/ice-9/rdelim.scm (read-string!, read-string): New functions. * test-suite/tests/rdelim.test: Add tests. * doc/ref/api-io.texi: Add docs. * module/ice-9/iconv.scm: * module/rnrs/io/ports.scm: * module/web/uri.scm: Use the new functions. 2013-01-22 Andy Wingo `include' relative paths relative to including file * module/ice-9/psyntax.scm (include): Like `load', interpret relative paths as being relative to the file that does the `include'. * doc/ref/api-evaluation.texi: Update docs. 2013-01-22 Andy Wingo libguile examples use scm_c_vector functions instead of SCM_SIMPLE_VECTOR_* * doc/ref/libguile-concepts.texi (Multi-Threading): Use functions in the example instead of macros. Performance is really not a concern with this interface, especially now that scm_car and scm_cdr are inline functions. 2013-01-22 Andy Wingo documentation recommends scm_new_smob instead of SCM_NEWSMOB * doc/ref/api-smobs.texi (Smobs): Document scm_new_smob and scm_new_double_smob instead of the SCM_NEWSMOB / SCM_RETURN_NEWSMOB family of macros. * doc/ref/libguile-smobs.texi (Creating Smob Instances): Use scm_new_smob. 2013-01-22 Andy Wingo fix compilation of glil to assembly * libguile/vm-i-scheme.c (VM_VALIDATE_STRUCT): Fix the error message if the value was not a struct. * module/system/base/compile.scm (find-language-joint): Default to joining at the target language. (default-language-joiner): Allow sequences of one compiled expression to pass through. Otherwise error as before. (read-and-parse): New helper; actually parses. (read-and-compile): Use read-and-parse, and fall back to default-language-joiner. Thanks to Nala Ginrut for the report. 2013-01-21 Andy Wingo Fix http-get* deprecation note * module/web/client.scm (http-get*): Fix deprecation warning. Thanks to Daniel Hartwig for the report. add dynl.x dep on libpath.h * libguile/Makefile.am (dynl.x): Add dep on libpath.h. Thanks to Bogdan Marinescu for the report. read-and-compile closes input file after seeing EOF * module/system/base/compile.scm (read-and-compile): Close the input port after we read all of its data. Perhaps this cleans up some NFS ghosts that David Pirotte was seeing. 2013-01-21 Andy Wingo fix try-module-autoload, which did not detect failure to find the file * libguile/load.c (scm_primitive_load_path): If the second argument is a procedure, call it like a thunk. * doc/ref/api-evaluation.texi (Load Paths): Update docs. * module/ice-9/boot-9.scm (resolve-interface): Use `unless'. (try-module-autoload): Use the new primitive-load-path to detect failure to find an appropriate file. Fixes a bug reported by Diogo F. S. Ramos. Thanks to Noah Lavine for tracking it down. 2013-01-20 Andy Wingo Fix attempt to get handle of weak table in (oop goops save) * module/oop/goops/save.scm (readable?): Fix. Thanks to Andrew Gaylard for the report. weak-table consolidation around scm_i_register_weak_gc_callback * libguile/weak-table.c (GC_move_disappearing_link) (move_disappearing_links): Factor out stub, as in previous weak-set commit. (resize_table): As in weak-set commit, finalizers do not run within allocators. (do_vacuum_weak_table): Add comment about need for trylock. (scm_c_make_weak_table): Use the new scm_i_register_weak_gc_callback. Previously this was the case because of a mistyped check for a "HAVE_GC_TABLE_START_CALLBACK" symbol, whereas the symbol was actually HAVE_GC_SET_START_CALLBACK. Anyway, it's better to call this after GC anyway, as vacuuming might need to allocate weak links (on pre-7.3 libgc without GC_move_disappearing_link) or reallocate the backing vector. 2013-01-20 Andy Wingo consolidate scm_i_register_weak_gc_callback, update weak-set to fit * libguile/finalizers.h: * libguile/finalizers.c (scm_i_register_weak_gc_callback): New internal helper, from weak-set.c. Relative to the previous weak-set.c version, prefer the finalizer-based implementation. Fix bug regarding confusion between scm_before_gc_c_hook and scm_after_gc_hook. Fix bug regarding referencing weak values outside of the alloc lock. * libguile/weak-set.c (GC_move_disappearing_link): New stub. GC_move_disappearing_link is only available in libgc 7.3. (move_weak_entry): Use the new stub instead of ifdeffery. (resize_set): Now that we run finalizers from a separate thread or async, we can keep the lock while reallocating the set vector. (do_vacuum_weak_set): For the same reason, always lock the set. Remove implementation of scm_c_register_weak_gc_callback in preference of the new copy in finalizers.c. (scm_c_make_weak_set): Use the new scm_i_register_weak_gc_callback. 2013-01-20 Andy Wingo gc.c: assume gc 7.2 features are present * libguile/gc.c: Remove shims for GC_get_heap_usage_safe, GC_get_free_space_divisor, and GC_set_finalize_on_demand. Remove code in the case in which we did not have GC_set_start_callback. 2013-01-17 Andy Wingo guile 2.2 will require libgc 7.2 or greater * configure.ac: Bump required libgc version to 7.2, released March 2012. 2013-01-17 Andy Wingo warn on multithreaded fork * libguile/posix.c (scm_fork): Issue a warning on a multithreaded fork. * doc/ref/posix.texi (Processes): Add note about multithreaded fork. * test-suite/tests/00-socket.test: Moved here, from socket.test, so as to run before any threads are created. * test-suite/Makefile.am: Adapt. 2013-01-17 Andy Wingo warning instead of error on multithreaded fork * libguile/posix.c (scm_fork): Issue a warning instead of an error on a multithreaded fork. * doc/ref/posix.texi (Processes): Add note about multithreaded fork. 2013-01-16 Andy Wingo trace: limit length of "| | | "... prefix * module/system/vm/trace.scm (build-prefix): New helper. (print-application, print-return): Use the helper. (trace-calls-to-procedure, trace-calls-in-procedure): (trace-instructions-in-procedure, call-with-trace): Add #:max-indent argument, defaulting to the terminal width less 40 characters. * doc/ref/scheme-using.texi: Update `trace' docs. Based on a patch by Nala Ginrut. 2013-01-16 Andy Wingo peval-introduced gensyms infix " " * module/language/tree-il/peval.scm (peval): Gensyms use whitespace as an infix, not a dash. Helps gensym?-like procedures like those in the unused lexical analysis. 2013-01-16 Noah Lavine Remove 'define-grammar-f' * module/ice-9/peg.scm: don't re-export 'define-grammar-f' * module/ice-9/peg/string-peg.scm: don't export 'define-grammar-f' PEG Renames * module/ice-9/peg.scm: rename 'peg-sexp-compile' to 'compile-peg-pattern' * module/ice-9/peg/codegen.scm: same * module/ice-9/peg/string-peg.scm: same * module/ice-9/peg/using-parsers.scm: same * doc/ref/api-peg.texi: same PEG Renames * module/ice-9/peg.scm: rename 'define-grammar' to 'define-peg-string-patterns' * module/ice-9/peg/string-peg.scm: same * doc/ref/api-peg.texi: same * test-suite/tests/peg.bench: same * test-suite/tests/peg.test: same PEG Renames * module/ice-9/peg.scm: rename 'define-nonterm' to 'define-peg-pattern' * module/ice-9/peg/using-parsers.scm: same * module/ice-9/peg/string-peg.scm: same * test-suite/tests/peg.test: same * doc/ref/api-peg.texi: same PEG Renames * module/ice-9/peg.scm: rename 'peg-parse' to 'match-pattern' * module/ice-9/peg/string-peg.scm: same * module/ice-9/peg/using-parsers.scm: same * doc/ref/api-peg.texi: same * test-suite/tests/peg.test: same * test-suite/tests/peg.bench: same PEG Renames * doc/ref/api-peg.texi: rename 'peg-match' to 'search-for-pattern' * module/ice-9/peg.scm: same * module/ice-9/peg/using-parsers.scm: same * test-suite/tests/peg.test: same 2013-01-16 Noah Lavine Document PEGs at Runtime doc/ref/api-peg.texi: suggest a cleaner method of generating PEG parsers at runtime. Update PEG Documentation Change the PEG documentation to use the new style of s-expression PEGs. Comments in PEG module/ice-9/peg/string-peg.scm: add comments explaining the format of some of the parsed PEG forms. Remove 'body' PEG module/ice-9/peg/string-peg.scm: update S-expression generators to use the new *, +, ?, followed-by, and not-followed-by forms. module/ice-9/peg/codegen.scm: remove the 'body' form in the PEG s-expression representation. Add 'not-followed-by' PEG The PEG s-expression syntax now uses '(not-followed-by ...)' instead of '(body ! ... 1)'. Add 'followed-by' PEG The PEG s-expression syntax now uses '(followed-by ...)' instead of '(body & ... 1)'. Add '?' PEG The PEG s-expression syntax now uses '(? ...)' instead of '(body lit ... ?)'. Add '+' PEG The PEG s-expression syntax now uses '(+ ...)' instead of '(body lit ... +)'. Add '*' PEG The s-expression representation of PEG grammars now uses a '(* ...)' form instead of '(body lit ... *)'. Clean Up PEG Codegen * module/ice-9/peg/codegen.scm: remove unnecessary literals in peg-sexp-compile. Make PEG Files * module/ice-9/peg/using-parsers.scm: remove unnecessary dependency * module/ice-9/peg.scm: add comment about string-peg dependency * module/Makefile.scm: add PEG files to makefile Rearrange PEG Modules * module/ice-9/peg.scm: move code out of here * module/ice-9/peg/match-records.scm: remove this file * module/ice-9/peg/using-parsers.scm: make a new module with utilities for using parsers. It contains the code from both peg.scm and match-records.scm * module/ice-9/peg/string-peg.scm: update to use new module PEG Cache Module * module/ice-9/peg/cache.scm: add module to hold cache logic for PEG parsers * module/ice-9/peg.scm: move cache logic out of here Update String PEGs * module/ice-9/peg/string-peg.scm: use new interface for extending PEG syntax * module/ice-9/peg.scm: remove peg-extended-compile Extensible PEG Syntax * module/ice-9/peg/codegen.scm: Make the PEG syntax extensible, and move most of the current code generators to the new interface * doc/ref/api-peg.texi: Document PEG extensions in the PEG Internals section of the manual Separate PEG Concerns * module/ice-9/peg/codegen.scm: peg-sexp-compile no longer knows about string PEGs * module/ice-9/peg.scm: add a new function peg-extended-compile that calls peg-sexp-compile or peg-string-compile on its argument as appropriate Move define-nonterm * module/ice-9/peg/string-peg.scm: remove define-nonterm and make a simpler macro called `define-sexp-parser' to make the PEG grammar * module/ice-9/peg.scm: move define-nonterm macro to this file * module/ice-9/peg/codegen.scm: move code to wrap a parser result nicely to this file, under name `wrap-parser-for-users' Document PEG Internals * doc/ref/api-peg.texi: add a manual section about the PEG internals. Remove eval-when * module/ice-9/peg.scm: remove the eval-when statement Factor PEG Structure * modules/ice-9/peg.scm: remove the part that defines a match structure * modules/ice-9/peg/match-record.scm: and put it here Factor PEG Functions * module/ice-9/peg.scm: take out the functions for simplifying trees * module/ice-9/peg/simplify-tree.scm: and put them here Separate PEG Strings * module/ice-9/peg.scm: remove functions dealing with PEGs as strings * module/ice-9/peg/string-peg.scm: and put them here Make Macros Hygienic * modules/ice-9/peg.scm: convert the unhygienic macros that generate code for string PEGs to use hygiene. Rename in peg.scm * module/ice-9/peg.scm: rename peg-parse-* functions to avoid confusion with what PEGs do. Split peg.scm * module/ice-9/peg.scm: move code generators to new module * module/ice-9/peg/codegen.scm: new module for PEG code generators 2013-01-16 Andy Wingo reformat and reflow api-peg.texi * doc/ref/api-peg.texi: Reformat and reflow. peg: remove error-val * module/ice-9/peg.scm (error-val): Remove needless definition. peg: refactor peg-sexp-compile to operate on syntax directly * module/ice-9/peg.scm (cg-generic-ret): Remove unused for-syntax argument. (peg-sexp-compile): Take the pattern as syntax directly, and use syntax-case to destructure it and dispatch to the code generators. (cg-and, cg-and-int, cg-or, cg-or-int): Refactor to operate on syntax instead of on s-expressions. (cg-body): Likewise; though this was a larger refactor. (define-nonterm, peg-match): Adapt to peg-sexp-compile calling convention change. (peg-string-compile): Likewise, and just take the grammar as a syntax object. peg: cg-string, cg-peg-any, cg-range: remove needless for-syntax arg * module/ice-9/peg.scm (cg-string, cg-peg-any, cg-range): Remove unnecessary for-syntax arg. (peg-sexp-compile): Adapt. peg: change some instances of "match" to "pat" * module/ice-9/peg.scm (cg-string): Rename "match" to "pat". (peg-sexp-compile, cg-body-test, cg-body, define-nonterm): Likewise. remove cggl, cg-generic-lambda * module/ice-9/peg.scm (cg-generic-lambda, cggl): Remove these helpers, they are no longer needed. (cg-generic-ret): Remove optimization for particular cg- routines, as it's no longer needed. peg: more cggl / cggr excisions * module/ice-9/peg.scm (cg-peg-any): Don't use cggr. (cg-range): Don't use cggl or cggr. peg: cg-string does not use cggr * module/ice-9/peg.scm (cg-string): Don't use cggr. Interesting to see what it actually generates. peg: cg-peg-any does not use cggl * module/ice-9/peg.scm (cg-peg-any): Don't use cggl. peg: cg-string without cggl * module/ice-9/peg.scm (cg-string): Refactor to not use cggl. peg: cg-string improvement * module/ice-9/peg.scm (cg-string): Use the more efficient string= with range args, rather than string=? and substring. peg: helper macro docstrings * module/ice-9/peg.scm: Convert the helper macro comments into docstrings. peg: module-ref cleanup * module/ice-9/peg.scm (cg-generic-ret, cg-and-int, cg-body-test): Remove a few needless @ or @@ forms. peg: remove get-code debugging foo * module/ice-9/peg.scm (define-nonterm): Don't stash the code in a symbol property. (get-code): Remove. peg: more syntax helper cleanup * module/ice-9/peg.scm (single-filter, push-not-null!): Use syntax-rules, and move outside the eval-when. peg: else for default cond clauses, not #t * module/ice-9/peg.scm: Change default cases of `cond' to use `else' instead of #t. peg; syntax helper cleanups * module/ice-9/peg.scm (until, single?, push!): Move outside the eval-when. Use syntax-rules, and single? is faster now. peg: cleanups * module/ice-9/peg.scm (until): Rename from until-works, and be functional (and faster). (peg-match): Adapt. peg: define-module cleanup * module/ice-9/peg.scm: Fix up define-module block. 2013-01-16 Noah Lavine peg: let cleanups * module/ice-9/peg.scm (cg-string, cg-peg-any, cg-range): Remove some unnecessary lets. peg: remove unhygienic safe-bind, safe-bind-f * module/ice-9/peg.scm (safe-bind, safe-bind-f): Remove. peg: remove unused nonhygienic expander helpers * module/ice-9/peg.scm (cggl, cggr): Remove, and rename the cggl-syn and cggr-syn to take their place. peg: more helpers returning syntax * module/ice-9/peg.scm (cg-body, cg-body-success, cg-body-more) (cg-body-ret): Return syntax instead of s-expressions. peg: cg-or, cg-or-int return syntax * module/ice-9/peg.scm (cg-or, cg-or-int): Return syntax instead of s-expressions. (peg-sexp-compile): Adapt. peg: hygiene in cg-and, cg-and-int * module/ice-9/peg.scm (cg-and, cg-and-int): Use cggr-syn instead of cggr, and also return syntax now instead of s-expressions. peg: hygiene in cg-range * module/ice-9/peg.scm (cg-range): Use cggl-syn and cggr-syn. peg: hygiene in cg-peg-any * module/ice-9/peg.scm (cg-peg-any): Use cggl-syn and cggr-syn. peg: more hygiene in cg-string * module/ice-9/peg.scm (cggl-syn, cggr-syn): New functions, equivalent to cggl and cggr except that they operate on syntax instead of s-expressions. (cg-string): Use them here. peg: lower datum->syntax in cg-range case * module/ice-9/peg.scm (cg-range): Datum->syntax here... (peg-sexp-compile): ...instead of here. peg: lower datum->syntax in cg-peg-any case * module/ice-9/peg.scm (cg-peg-any): Datum->syntax here... (peg-sexp-compile): ...instead of here. peg: lower datum->syntax in cg-string case * module/ice-9/peg.scm (cg-string): Return syntax instead of s-expressions. (peg-sexp-compile): No need for datum->string in cg-string case. peg: peg-sexp-compile datum->syntax refactor * module/ice-9/peg.scm (peg-sexp-compile): Push datum->syntax call through cond expression in peg-sexp-compile. This is a preliminary move so that I can convert the code-generating functions into syntax-generating functions one by one. peg: compilers return syntax instead of s-expressions * module/ice-9/peg.scm (peg-sexp-compile, peg-string-compile): Return syntax instead of s-expressions. peg: beginnings of hygiene * module/ice-9/peg.scm: Pass for-syntax argument to all of the code-generating functions. peg: more syntax-for-non-cache-case cleanups * module/ice-9/peg.scm (syntax-for-non-cache-case): More cleanups. peg: clean up syntax-for-non-cache-case * module/ice-9/peg.scm (syntax-for-non-cache-case): Cleanups. peg: use quasisyntax instead of safe-bind * module/ice-9/peg.scm (syntax-for-non-cache-case): Use quasisyntax instead of safe-bind. peg: define-nonterm returns syntax instead of s-expression * module/ice-9/peg.scm (define-nonterm, syntax-for-non-cache-case): Returns syntax instead of an s-expression. peg: split define-nonterm into two functions for better readability. * module/ice-9/peg.scm (define-nonterm): Split for readability. 2013-01-16 Andy Wingo peg: add copyright header * module/ice-9/peg.scm: Add copyright header. 2013-01-16 Andy Wingo add PEG parser generator * module/ice-9/peg.scm: New file. * module/Makefile.am: Add to build. * doc/ref/Makefile.am: * doc/ref/api-peg.texi: * doc/ref/guile.texi: Add documentation for PEG parser. * test-suite/Makefile.am: * test-suite/tests/peg.bench: * test-suite/tests/peg.test: Add tests, and a benchmark. 2013-01-16 Andy Wingo an end to the generated-documentation experiment * doc/ref/statprof.texi: * doc/ref/sxml.texi: * doc/ref/texinfo.texi: New files, containing the documentation that was previously generated from source and rendered into standard-library.texi. The documentation is still horrible, but at least now it is user-editable. update make-struct docstring * libguile/struct.c (scm_make_struct): Remove reference to deprecated make-vtable-vtable. 2013-01-15 Greg Benison doc/ref/hierarchy.png: conform to hierarchy.txt and manual hierarchy.png (and .pdf, .eps) were changed to add one node to the graph, getting them in sync with hierarchy.txt (and the GOOPS section of the manual). Also added hierarchy.dot, a file to generate said figure using graphviz. 2013-01-15 Andy Wingo fix string->bytevector for utf-8 and non-error conversion strategies * module/ice-9/iconv.scm (call-with-encoded-output-string): (string->bytevector, bytevector->string): Only call string->utf8 and utf8->string if the conversion strategy is `error'. ASCII is not ISO-8859-1 * libguile/ports.c (scm_i_set_default_port_encoding): An encoding of ASCII is not the same as ISO-8859-1, because it does not allow characters above 128. Fix this. fix string->bytevector for utf-8 and non-error conversion strategies * module/ice-9/iconv.scm (call-with-encoded-output-string): (string->bytevector, bytevector->string): Only call string->utf8 and utf8->string if the conversion strategy is `error'. string->utf8 implementation uses scm_from_utf8_stringn * libguile/bytevectors.c (UTF_TO_STRING): Use scm_from_utf8_stringn. scm_from_stringn and scm_to_stringn encoding args are never NULL * libguile/strings.c (scm_from_stringn, scm_to_stringn): Encoding argument cannot be NULL. Instead check that the encoding was ISO-8859-1. Port encodings cannot be NULL * libguile/ports.c (scm_c_read_unlocked, scm_ungetc_unlocked): * libguile/read.c (scm_read_character): * libguile/vports.c (sf_fill_input): Port encodings cannot be NULL any more, now that encodings are canonicalized, so simplify these. 2013-01-15 Andy Wingo All r6rs ports are both textual and binary * module/rnrs/io/ports.scm (binary-port?): All ports are binary _and_ textual. Bytevectors and strings may be written to or read from either. (port-transcoder): All textual ports (all ports) have transcoders of some sort. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports"): Remove test that binary ports don't have transcoders, because binary ports are also textual. 2013-01-15 Andy Wingo Port encodings are case-insensitive, but normalized to upper-case. * libguile/ports.c (ascii_toupper, encoding_matches) (canonicalize_encoding): New helpers. (scm_c_make_port_with_encoding): (scm_i_set_default_port_encoding): (scm_i_set_port_encoding_x): Use the new helpers to be case-insensitive and also to canonicalize the internal representation to upper-case ASCII names. (scm_i_default_port_encoding): Never return NULL. (scm_port_encoding): The encoding is always a string. * libguile/read.c (scm_i_scan_for_encoding): Use a locale-independent check instead of isalnum. Don't upcase the result: the port code will handle that. * test-suite/tests/web-response.test ("example-1"): Adapt test to expect normalized (upper-case) encoding for the response port. 2013-01-15 Andy Wingo add scm_from_port_string and friends * doc/ref/api-data.texi (Conversion to/from C): * libguile/strings.h: * libguile/strings.c (scm_from_port_string, scm_from_port_stringn): (scm_to_port_string, scm_to_port_stringn): New functions. * guile-readline/readline.c (internal_readline): * libguile/strports.c (scm_strport_to_string): * libguile/read.c (scm_read_number, scm_read_mixed_case_symbol): (scm_read_number_and_radix, scm_read_character): Use the new functions. 2013-01-15 Andy Wingo UTF-8 string ports in ecmascript test * test-suite/tests/ecmascript.test (eread, eread/1): Make sure we can render the temporary string ports by specifying UTF-8. 2013-01-15 Andy Wingo fix bug where scm_from_utf8_stringn would not detect bad utf-8 * libguile/strings.c (scm_from_utf8_stringn): * libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8" return from u8_mbtouc is a 0xfffd character, not a negative byte length. Fixes a bug in which invalid UTF-8 would not be caught. * libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn directly. Just a little cleanup. * test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for parsing bad utf-8 with substitution. 2013-01-15 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' There is a failing test due to a scm_from_utf8_stringn bug brought out by the iconv test that will be fixed in the next commit. Conflicts: libguile/deprecated.h module/ice-9/deprecated.scm 2013-01-14 Andy Wingo case-lambda* clauses fail to match if too many positionals * doc/ref/api-procedures.texi (Case-lambda): Expand case-lambda* documentation. * module/ice-9/eval.scm (primitive-eval): * libguile/eval.c (prepare_boot_closure_env_for_apply): Dispatch to the next case-lambda clause if there are too many positionals. * doc/ref/vm.texi (Function Prologue Instructions): * libguile/vm-i-system.c (bind-optionals/shuffle-or-br): New instruction, like bind-optionals/shuffle but can dispatch to the next clause if there are too many positionals. * module/language/assembly/disassemble.scm (code-annotation): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/compile-bytecode.scm (compile-bytecode): Add case for bind-optionals/shuffle-or-br. * module/language/glil/compile-assembly.scm (glil->assembly): If there is an alternate, use bind-optionals/shuffle-or-br instead of bind-optionals/shuffle. * test-suite/tests/optargs.test ("case-lambda*"): Add tests. 2013-01-11 Andy Wingo Docstrings in (ice-9 iconv) * module/ice-9/iconv.scm: Add docstrings. 2013-01-11 Andy Wingo Change iconv procedures to take optional instead of keyword arg * module/ice-9/iconv.scm (call-with-encoded-output-string): (string->bytevector, bytevector->string): Take an optional instead of a keyword argument. * doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to change, and fix a number of errors. Thanks to Ludovic Courtès for the pointers. * test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for the 'substitute path. 2013-01-11 Andy Wingo Add http-post, http-put, et cetera * module/web/client.scm (ensure-uri): New helper. (open-socket-for-uri): Accept a URI as a string or as a URI object. (extend-request, sanitize-request): New helpers, like the corresponding functions in (web server). (decode-response-body): Add a reference to the HTTP/1.1 spec, and use (ice-9 iconv). (request): New helper, factoring all aspects of sending an HTTP request and getting a response. (http-get): Redefine in terms of http-get. Deprecate the #:extra-headers argument in favor of #:headers. Allow a body. Add a #:streaming? argument, subsuming the functionality of http-get*. (http-get*): Deprecate. (http-head, http-post, http-put, http-delete, http-trace) (http-options): Define interfaces for all HTTP verbs. * test-suite/tests/web-client.test: Add tests. * doc/ref/web.texi: Update documentation. Thanks to Gregory Benison for the initial patch. 2013-01-11 Andy Wingo read-response-body always returns bytevector or #f * module/web/response.scm (read-response-body): Fix to always return either a bytevector or #f. Previously, reading a 0-length body could return the EOF object. remove (web http) TODO list * module/web/http.scm: Remove outdated TODO list. (web server) uses (ice-9 iconv) * module/web/server.scm (sanitize-response): Use the procedures from (ice-9 iconv) to encode the response. 2013-01-11 Andy Wingo add bytevector->string and string->bytevector in new (ice-9 iconv) module * module/Makefile.am: * module/ice-9/iconv.scm: New module implementing procedures to encode and decode representations of strings as bytes. * test-suite/Makefile.am: * test-suite/tests/iconv.test: Add tests. * doc/ref/api-data.texi: Add docs. 2013-01-10 Andy Wingo fix ice-9/slib * module/ice-9/slib.scm: Change to just load up slib.init directly. The recently submitted patch to slib-discuss and guile-user should make this work correctly. 2013-01-10 Andy Wingo deprecate SCM_CHAR_CODE_LIMIT and char-code-limit * libguile/__scm.h: * libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here from __scm.h. * libguile/feature.c: * module/ice-9/deprecated.scm (char-code-limit): Move definition here. * test-suite/tests/regexp.test: Update to not use char-code-limit. 2013-01-08 Andy Wingo slight open-pipe* / open-process refactor * libguile/posix.c (scm_open_process): Return the ports as values instead of calling out to Scheme again to make-rw-port. This function is private to (ice-9 popen). * module/ice-9/popen.scm (open-pipe*): Adapt to change. 2013-01-07 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION libguile/posix.c module/ice-9/eval.scm test-suite/tests/cse.test 2013-01-07 Andy Wingo http-get: don't shutdown write end of socket * module/web/http.scm ("Connection"): Write the "close" token in lower-case. * module/web/client.scm (http-get): Don't shutdown the writing side of the pipe if we are not doing a keepalive, as this may prevent the request from being sent at all. Prevented http://friendfeed.com/ from being correctly fetched. 2013-01-07 Andy Wingo Fix partial commit of documentation update * doc/ref/api-procedures.texi (Compiled Procedures): Fix partially-committed doc update. 2013-01-07 Andy Wingo More procedure-arguments-alist documentation and a bugfix * doc/ref/api-procedures.texi (Compiled Procedures): Expand program-arguments-alist and program-lambda-list documentation. * module/system/vm/program.scm (arity->arguments-alist): Fix the rest arg if there are also keyword args, a bug found while documenting! * test-suite/tests/session.test ("procedure-arguments"): Update. 2013-01-07 Cedric Cellier document program-arguments-alist and program-lambda-list 2013-01-07 Andy Wingo minor cleanup in values.c * libguile/values.c (scm_c_value_ref): Use scm_from_size_t to assimilate a size_t. 2012-12-19 Ludovic Courtès tests: Remove leftover `pk'. * test-suite/tests/posix.test ("system*"): Remove `pk'. 2012-12-19 Ludovic Courtès Change `system*' to not leave dangling processes behind. Fixes . * libguile/simpos.c (scm_system_star): In the child, call `_exit' instead of `SCM_SYSERROR' when `execvp' fails. * test-suite/tests/posix.test ("system*"): New test prefix. 2012-12-17 Ludovic Courtès web: Correctly detect "No route to host" conditions. * module/web/client.scm (open-socket-for-uri): Delete addrinfos with the same address. Always open SOCK_STREAM/IPPROTO_IP sockets. Fix the error handler's condition to determine what to do. Reported by Nikita Karetnikov at . 2012-12-10 Ludovic Courtès build: Require Automake 1.11.2 or later. * configure.ac: Require Automake 1.11.2 or later. Reported by Sjoerd van Leent Privé in . 2012-12-10 Daniel Hartwig repl: add repl-option for customized print Closes . * module/system/repl/common.scm (repl-default-options) (repl-print): Add option to use customized print procedure. * doc/ref/scheme-using.texi (REPL Commands): Update. 2012-12-10 Ludovic Courtès test-suite: Skip `EACCES' test of `file-system-fold' when run as root. * test-suite/tests/ftw.test ("file-system-fold")["EACCES"]: Use `pass-if-equal'. Throw `unresolved' when run as root. Reported by Andreas Enge at . Verify the value of `SHUT_RD' and related constants. * libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD', `SHUT_WR', and `SHUT_RDWR'. doc: Update `release.org'. * doc/release.org (Use porter boxes): Mention Snakebite. 2012-12-07 Mark H Weaver Thanks Jozef Chraplewski. * THANKS: Jozef Chraplewski. 2012-12-07 Mark H Weaver Avoid signed integer overflow in scm_product * libguile/numbers.c (scm_product): Avoid signed integer overflow, which modern C compilers are allowed to assume will never happen, thus allowing them to optimize out our overflow checks. * test-suite/tests/numbers.test (*): Add tests. 2012-11-30 Daniel Hartwig doc: remove more references to hash-tables-as-vectors * doc/ref/api-compound.texi (Hash Tables): Update. 2012-11-30 Ludovic Courtès doc: Update `release.org'. * doc/release.org: Fix typos, and update. NEWS: Add "R6RS SRFI support" text. * NEWS: Add proper text for "R6RS SRFI support", by Ian Price and Mark Weaver. Bump version number for 2.0.7. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C function `scm_make_vtable_vtable'. (LIBGUILE_INTERFACE_AGE): Increment. 2012-11-29 Mark H Weaver NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling. * NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling. NEWS: Mention par-for-each, alongside par-map, being fixed to use all cores * NEWS: Mention par-for-each, alongside par-map, being fixed to use all cores. Minor fixes in NEWS * NEWS: Minor fixes to the descriptions. 2012-11-29 Ludovic Courtès Update `NEWS'. * NEWS: Add news for 2.0.7. futures: Remove circular dependency with (ice-9 threads). * module/ice-9/futures.scm: Remove now-useless import of (ice-9 threads) introduced in commit be05b336. doc: Document nested futures. * doc/ref/api-scheduling.texi (Futures): Mention nested futures. Explain what happens upon `touch'. 2012-11-29 Ludovic Courtès doc: Remove example use of vectors as hash tables. Fixes . Reported by Daniel Hartwig . * doc/ref/api-compound.texi (Hash Table Examples): Remove example use of vectors as hash tables. 2012-11-29 Mark H Weaver Add parse-path-with-ellipsis, and use it for GUILE_LOAD_PATH et al. * libguile/load.c (scm_ellipsis): New Variable. (scm_parse_path_with_ellipsis): New procedure. (scm_init_load): Initialize 'scm_ellipsis'. (scm_init_load_path): Use 'scm_parse_path_with_ellipsis' to handle GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH. * libguile/load.h (scm_parse_path_with_ellipsis): Add prototype. * doc/ref/guile-invoke.texi (Environment Variables): doc/ref/api-evaluation.texi (Load Paths): Add documentation. Correct description of default load path to reflect reality. Remove 'GUILE_LOAD_PATH' from the concept index; it is already in the variable index. Add cross references between these two sections of the manual. 2012-11-28 Ludovic Courtès Remove definition of the `SHARED_LIBRARY_PATH_VARIABLE' C macro. This is a follow-up to fc32c44. * configure.ac: Remove definition of `SHARED_LIBRARY_PATH_VARIABLE', which was added in e66ff09a. 2012-11-28 Ludovic Courtès web: Add `http-get*'. * module/web/client.scm (http-get*): New procedure. * doc/ref/web.texi (Web Client): Document it. 2012-11-28 Ludovic Courtès web: Add `response-body-port'. * module/web/response.scm (make-delimited-input-port, response-body-port): New procedures. (read-response-body): Use `response-body-port'. * test-suite/tests/web-response.test ("example-1")["response-body-port"]: New test. ("example-2")["response-body-port"]: New test. 2012-11-28 Ludovic Courtès web: Export `text-content-type?'. * module/web/client.scm (text-type?): Remove. (decode-response-body): Use `text-content-type?'. * module/web/response.scm (text-content-type?): New procedure. * doc/ref/web.texi (Responses): Document it. tests: Use `pass-if-equal' in `web-response.test'. * test-suite/tests/web-response.test: Cleanup whitespace. Use `pass-if-equal' when appropriate. 2012-11-28 Ludovic Courtès eval: Store docstrings for lambdas. Fixes . Reported by Ian Price . * libguile/memoize.c (MAKMEMO_LAMBDA): New `docstring' parameter. Add it as the second argument of `SCM_M_LAMBDA'. Update caller. (memoize)[SCM_M_LAMBDA]: Extract docstring from EXP; when `memoize' returns, add the docstring to the lambda's arguments. (unmemoize)[SCM_M_LAMBDA]: Adjust to new argument layout of `SCM_M_LAMBDA'. * libguile/eval.c (BOOT_CLOSURE_NUM_REQUIRED_ARGS, BOOT_CLOSURE_HAS_REST_ARGS, BOOT_CLOSURE_IS_REST, BOOT_CLOSURE_PARSE_FULL): Adjust to new argument layout of `SCM_M_LAMBDA'. * module/ice-9/eval.scm (primitive-eval)[make-general-closure]: Likewise. [eval]: When EXP is a lambda, match its docstring; when the docstring is not #f, add it to the closures procedure properties. * test-suite/tests/eval.test ("docstrings"): New test prefix. * libguile/procs.c (sym_documentation): Rename to... (scm_sym_documentation): ... this. Make it global. * libguile/procs.h (scm_sym_documentation): New declaration. 2012-11-28 Mark H Weaver Fix library search order and don't change LD_LIBRARY_PATH * libguile/dynl.c (system_extensions_path): New static variable. (sysdep_dynl_link): If 'lt_dlopenext' fails, manually search in 'system_extensions_path'. (augment_env): Remove. (sysdep_dynl_init): Don't change LD_LIBRARY_PATH, and don't use lt_dladdsearchdir if GUILE_SYSTEM_EXTENSIONS_PATH is set. Instead, initialize 'system_extensions_path' from GUILE_SYSTEM_EXTENSIONS_PATH (or if it's unset: :), and rely on sysdep_dynl_link to search those directories manually. 2012-11-27 Ludovic Courtès vlist: Remove Texinfo markup from docstrings. * module/ice-9/vlist.scm: Remove Texinfo markup from docstrings with sed -e"s/@var{\([a-z0-9?!-]\+\)}/\U\1/g ; s/@code{\([^}]\+\)}/‘\1’/g". 2012-11-27 Daniel Hartwig web client: correctly handle uri-query, etc. in relative URI headers * module/web/uri.scm (uri-pat): Make scheme part optional. (string->uri*): New private procedure to also parse relative URIs. * module/web/http.scm (declare-relative-uri-header!): Use that. 2012-11-27 Ludovic Courtès web client: Support relative URIs in some headers. Fixes . * module/web/http.scm (declare-relative-uri-header!): New procedure. ("Content-Location", "Referer"): Use it. Based on discussions with Daniel Hartwig . 2012-11-27 Ludovic Courtès Have `load-in-vicinity' look for `.go' files in %LOAD-COMPILED-PATH. Fixes . * module/ice-9/boot-9.scm (load-in-vicinity)[fresh-compiled-file-name]: New `scmstat' parameter; use it. [sans-extension]: New procedure. [load-absolute]: Call (stat ABS-PATH) from here. Search a `.go' file from %LOAD-COMPILED-PATH before searching %COMPILE-FALLBACK-PATH. 2012-11-27 Ludovic Courtès Split `load-in-vicinity' into small procedures. * module/ice-9/boot-9.scm (load-in-vicinity)[compiled-extension]: New variable. [compiled-file-name]: Rename to... [fallback-file-name]: ... this; update caller. Use COMPILED-EXTENSION. [more-recent?, compile, warn-about-exception]: New procedures. [fresh-compiled-file-name]: Use them. 2012-11-26 Ian Price Update thanks * THANKS: Add Sjoerd Van Leent Fix docs for `hashtable-copy' * doc/ref/r6rs.texi (rnrs hashtables): a true mutable argument means a mutable copy. 2012-11-25 Ian Price R6RS srfi library names should ignore first identifier after the :n * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): (srfi :n name ids ...) -> (srfi srfi-n ids ...) * test-suite/tests/rnrs-libraries.test ("srfi"): Add test. 2012-11-24 Daniel Hartwig (web uri): document that uri-port is an integer * doc/ref/web.texi (URIs): * module/web/uri.scm (build-uri): Document that uri-port is an integer. 2012-11-24 Daniel Hartwig syncronize web module docstrings with manual * doc/ref/web.texi: Fix spacing. Update with a few missing function descriptions. * module/web/client.scm: * module/web/http.scm: * module/web/request.scm: * module/web/server.scm: * module/web/uri.scm: Update docstrings from manual (reworked by Ludovic Courtès). 2012-11-24 Ludovic Courtès Augment `.dir-locals.el'. * .dir-locals.el: Add more `scheme-indent-function' rules. Turn on the `case' warnings in auto-compilation. * module/ice-9/boot-9.scm (%auto-compilation-options): Add `duplicate-case-datum' and `bad-case-datum'. 2012-11-23 Ludovic Courtès Add tests for `-Wduplicate-case-datum' and `-Wbad-case-datum'. * test-suite/tests/tree-il.test (%opts-w-duplicate-case-datum, %opts-w-bad-case-datum): New variables. ("warnings")["duplicate-case-datum", "bad-case-datum"]: New tests. doc: Mention the `duplicate-case-datum' and `bad-case-datum' warnings. * doc/ref/api-evaluation.texi (Compilation): List the `duplicate-case-datum' and `bad-case-datum' warnings. 2012-11-23 Ludovic Courtès Remove reference to `scm_init_popen' when `fork' is unavailable. Fixes . Reported by lin ray . * configure.ac: Define the `HAVE_FORK' Automake conditional. * module/Makefile.am (ICE_9_SOURCES): Add `ice-9/popen.scm' only when HAVE_FORK. * libguile/posix.c (scm_init_posix): Register `scm_init_popen' only when HAVE_FORK. 2012-11-22 Ian Price R6RS `string-for-each' should accept multiple string arguments * module/rnrs/base.scm (string-for-each): Rewrite. * test-suite/tests/r6rs-base.test ("string-for-each"): Add tests. 2012-11-21 Ludovic Courtès cse: Fix out-of-bounds access to the database. Fixes . * module/language/tree-il/cse.scm (cse)[find-dominating-lexical]: Fix computation of the last argument passed to `unroll'. Patch by Stefan Israelsson Tampe . * test-suite/tests/cse.test ("cse")["http://bugs.gnu.org/12883"]: New test. 2012-11-21 Ludovic Courtès Update `par-map' to use nested futures. This allows it to actually use all CPU cores, instead of having the main thread stuck on a `wait-condition-variable'. * module/ice-9/threads.scm (par-mapper): Add a `cons' argument; update callers accordingly. Rewrite using nested futures. 2012-11-21 Ludovic Courtès futures: Allow nested futures; put the main thread to work. * module/ice-9/futures.scm (%futures-waiting, %within-future?, %future-prompt): New variables. (let/ec): New macro. (process-future!): Run FUTURE's thunk in a prompt; capture FUTURE's continuation when it aborts, and add it to %FUTURES-WAITING. Set %WITHIN-FUTURE? in the dynamic extent of the call FUTURE's thunk. (process-futures): Move loop body to... (process-one-future): ... here. New procedure. (notify-completion): New procedure. (touch)[work, loop]: New procedures. When %WITHIN-FUTURE? and FUTURE is started, abort; if not %WITHIN-FUTURE, call `work' while waiting. When FUTURE is queued, call `work' too. * test-suite/tests/future.test ("nested futures"): New tests. 2012-11-21 Ludovic Courtès futures: Add a record printer. * module/ice-9/futures.scm: Add a record printer for . futures: Keep futures unlocked while they are processing. * module/ice-9/futures.scm ()[completion]: New field. [done?]: Rename to... [state]: ... this. Change `set-future-done?!' to `set-future-state!', and `future-done?' to `future-state'. (make-future): Initialize the `completion' field to 'queued. (with-mutex): New macro. (process-future!): Remove `set-future-done?!' call. (process-futures): Check `future-state'. Unlock FUTURE's mutex before processing it. Broadcast FUTURE's `completion' cond. var. when done. (touch): Likewise. 2012-11-17 Ludovic Courtès Update Gnulib to v0.0-7695-g26c0590. * gnulib-local/m4/canonicalize.m4.diff: Remove. * Makefile.am (EXTRA_DIST): Adjust accordingly. doc: Strengthen the case for pattern matching. * doc/ref/api-compound.texi (Pairs): Warn against `cadr' & co., and add a link to "Pattern Matching". * doc/ref/match.texi (Pattern Matching): Add example with nested lists. Add paragraph comparing `match' expressions and hand-written code. doc: Fix typo in `set-record-type-printer!' doc. * module/srfi/srfi-9/gnu.scm (set-record-type-printer!): Change the parameter name to `proc'. * doc/ref/api-compound.texi (SRFI-9 Records): Update accordingly. 2012-11-15 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2012-11-12 Andreas Rottmann Add missing R6RS `open-file-input/output-port' procedure * module/rnrs/io/port.scm (r6rs-open): New internal helper procedure for opening files. (open-file-input-port, open-file-output-port): Make use of `r6rs-open'. (open-file-input/output-port): Implement in terms of `r6rs-open', add to exported identifiers list. * module/rnrs.scm (open-file-input/output-port): Add to exported identifiers. * test-suite/tests/r6rs-ports.test (test-input-file-opener): New procedure, collects several tests for opening file input ports. ("7.2.7 Input Ports"): Use `test-input-file-opener' for checking `open-file-input-port'. (test-output-file-opener): New procedure, collects several tests for opening file output ports. ("8.2.10 Output ports"): Use `test-output-file-opener' for checking `open-file-output-port'. ("8.2.13 Input/output ports"): New test prefix, making use of both `test-input-file-opener' and `test-output-file-opener' to check `open-file-input/output-port'. 2012-11-12 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2012-11-11 Ludovic Courtès doc: Update argument order of SRFI-9 `set-field'. * doc/ref/api-compound.texi (SRFI-9 Records): Change argument order for `set-field'. 2012-11-11 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' srfi-9.test: avoid symbols of the form ':bar' for more robust checking. * test-suite/tests/srfi-9.test ("incompatible field paths"): Rename ':bar' to 'bar' to avoid the possibility of the symbol name being printed with #{...}# notation. 2012-11-10 Ludovic Courtès doc: Document SRFI-9 functional setters. * doc/ref/api-compound.texi (Functional ``Setters''): New section. 2012-11-10 Ludovic Courtès doc: Move SRFI-9 records under "Compound Data Types". Suggested by Mark Weaver. * doc/ref/srfi-modules.texi (SRFI-9): Keep the node, but move contents to... * doc/ref/api-compound.texi (SRFI-9 Records): ...here. (Record Overview): New section. 2012-11-10 Mark H Weaver Change the argument order of 'set-fields' to match that of 'set-fields'. * module/srfi/srfi-9/gnu.scm (set-fields): Swap order of first two arguments. * test-suite/tests/srfi-9.test: Update tests. 2012-11-10 Mark H Weaver Add system/base/ck.scm to SYSTEM_BASE_SOURCES in module/Makefile.am. * module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/ck.scm. Futures: Avoid creating the worker pool more than once. * module/ice-9/futures.scm (%create-workers!): Use 'with-mutex' in case an exception is thrown. Within the critical section, check to make sure the worker pool hasn't already been created by another thread. 2012-11-10 Mark H Weaver Improve error for set-fields paths leading to different types. * module/system/base/ck.scm: New module. * module/srfi/srfi-9.scm: Import (system base ck). (getter-type, getter-index, getter-copier): Convert incoming argument convention to CK form. (define-tagged-inlinable): Convert return value convention for key lookup to CK form. * module/srfi/srfi-9/gnu.scm: Import (system base ck). Rename '%set-fields-unknown-getter' to 'unknown-getter'. (c-list, c-same-type-check): New macros. (%set-fields): Using the CK abstract machine, arrange to check (at macro expansion time) that all of the getters in head position correspond to the same record type. * test-suite/tests/srfi-9.test: Add test. 2012-11-10 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2012-11-10 Mark H Weaver Improve error messages for invalid record definitions. * module/srfi/srfi-9.scm (%define-record-type): Accept additional 'form' parameter which contains the original form of 'define-record-type' or 'define-immutable-record-type'. Add elaborate pattern guard which raises descriptive syntax errors for specific errors, and a fallback pattern to catch anything else. (define-record-type): Pass 'form' parameter to %define-record-type. * module/srfi/srfi-9/gnu.scm (define-immutable-record-type): Pass 'form' parameter to %define-record-type. * test-suite/tests/srfi-9.test: Add tests. 2012-11-10 Mark H Weaver Fix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel. * test-suite/tests/srfi-9.test: Move non-toplevel record definitions to be within the expression passed to 'compile'. Use 'pass-if-equal' to check syntax-error exceptions in srfi-9.test. * test-suite/tests/srfi-9.test: Convert detailed syntax-error exception tests to use 'pass-if-equal'. 2012-11-09 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Fix record constructor in getopt-long. * module/ice-9/getopt-long.scm (%make-option-spec): Fix the formal argument list to match the actual fields present. (make-option-spec): Update to match the fixed %make-option-spec. Merge remote-tracking branch 'origin/stable-2.0' 2012-11-09 Mark H Weaver Implement functional record setters. Written in collaboration with Ludovic Courtès * module/srfi/srfi-9.scm: Internally, rename 'accessor' to 'getter' and 'modifier' to 'setter'. (define-tagged-inlinable, getter-type, getter-index, getter-copier, %%on-error, %%set-fields): New macros. (%define-record-type): New macro for creating both mutable and immutable records, and containing a substantially rewritten version of the code formerly in 'define-record-type'. (define-record-type): Now just a wrapper for '%define-record-type'. (throw-bad-struct, make-copier-id): New procedures. * module/srfi/srfi-9/gnu.scm (define-immutable-record-type, set-field, and set-fields): New exported macros. (collate-set-field-specs): New procedure. (%set-fields-unknown-getter, %set-fields): New macros. * test-suite/tests/srfi-9.test: Add tests. Rename getters and setters in existing tests to make the functional setters look better. 2012-11-05 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/validate.h 2012-11-05 Ludovic Courtès Fix invalid assertion about mutex ownership in threads.c. * libguile/threads.c (do_thread_exit): Don't assert m->owner == t->handle since that is not the case when MUTEX was abandoned by T. Reported by Mark Weaver and others. Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'. * libguile/validate.h (SCM_NUM2FLOAT, SCM_NUM2DOUBLE): Use `scm_to_double' instead of the deprecated functions. Reported by Aleix Conchillo Flaqué . Fix copyright years in `futures.scm'. * module/ice-9/futures.scm: Update copyright years. 2012-11-05 Mark H Weaver Preserve additional R6RS library name components after srfi :n * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): (srfi :n ...) -> (srfi srfi-n ...) instead of (srfi srfi-n). 2012-11-03 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' 2012-11-03 Ludovic Courtès futures: Have workers work when futures are available. Reported by David Pirotte. * module/ice-9/futures.scm (process-futures): Wait on %FUTURES-AVAILABLE only when %FUTURES is empty. The problem was obvious when running (begin (use-modules (ice-9 threads)) (par-map 1+ (iota 400000))) : eventually, only the main thread would do the work, while the others would remain idle, waiting on %FUTURES-AVAILABLE. 2012-11-03 Ludovic Courtès Fix `generalized-vector->list' indexing bug with shared arrays. Fixes . Reported by Daniel Llorens . * libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix initial value of POS; pass the `h.base + pos', not just `pos' as the `vref' argument. * test-suite/tests/arrays.test ("array->list")["http://bugs.gnu.org/12465 - ok", "http://bugs.gnu.org/12465 - bad]: New tests. ("generalized-vector->list"): New test prefix. 2012-11-02 Ludovic Courtès test-suite: Add a nameless form of `pass-if-equal'. * test-suite/test-suite/lib.scm (pass-if-equal): Add a nameless pattern. * test-suite/tests/arrays.test ("array->list"): Use `pass-if-equal'. 2012-11-01 Ludovic Courtès scandir: Use `lstat' instead of `stat'. * module/ice-9/ftw.scm (scandir): Use `lstat', not `stat'. * test-suite/tests/ftw.test ("scandir")["symlink to directory"]: New test. 2012-11-01 Ludovic Courtès test-suite: Use `pass-if-equal' in `ftw.test'. * test-suite/tests/ftw.test ("file-system-fold")["test-suite (never enter)", "test-suite/lib.scm (flat file)"]: Use `pass-if-equal' instead of `pass-if'. test-suite: Add `pass-if-equal'. * test-suite/test-suite/lib.scm (pass-if-equal): New macro. (run-test): Upon `fail', pass ARGS to REPORT. 2012-10-31 Mark H Weaver Merge remote-tracking branch 'origin/stable-2.0' Moved scm_i_struct_hash from struct.c to hash.c and made it static. The port's alist is now a field of 'scm_t_port'. Conflicts: libguile/arrays.c libguile/hash.c libguile/ports.c libguile/print.h libguile/read.c 2012-10-31 Mark H Weaver Fix formatting of comments in scm_read_array. * libguile/read.c (scm_read_array): Fix formatting of comments. scm_read_shebang: handle non-ascii characters properly. * libguile/read.c (scm_read_shebang): Abort scan for reader directive if a character other than [-a-z0-9] is encountered. 2012-10-30 Mark H Weaver Test number-theoretic division by -0.0. * test-suite/tests/numbers.test ("Number-theoretic division"): Fix typo so that we actually test for division by -0.0. Minor tweaks to srfi-105.test * test-suite/tests/srfi-105.test ("curly-infix"): Minor tweaks. 2012-10-27 Mark H Weaver Implement SRFI-105 curly infix expressions. * libguile/private-options.h: Add SCM_CURLY_INFIX_P macro, and increment SCM_N_READ_OPTIONS. * libguile/read.c (sym_nfx, sym_bracket_list, sym_bracket_apply): New variables. (scm_read_opts): Add curly-infix reader option. Reformat to comply with GNU coding standards. (scm_t_read_opts): Add curly_infix_p and neoteric_p fields. (init_read_options): Initialize new fields. (CHAR_IS_DELIMITER): Add '{', '}', '[', and ']' as delimiters if curly_infix_p is set. (set_port_square_brackets_p, set_port_curly_infix_p): New functions. (read_inner_expression): New function which contains the code that was previously in 'scm_read_expression'. Handle curly braces when curly_infix_p is set. If curly_infix_p is set and square_brackets_p is unset, follow the Kawa convention: [...] => ($bracket-list$ ...) (scm_read_expression): New function body to handle neoteric expressions where appropriate. (scm_read_shebang): Handle the new reader directives: '#!curly-infix' and the non-standard '#!curly-infix-and-bracket-lists'. (scm_read_sexp): Handle curly infix lists. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-105 feature identifier. * doc/ref/srfi-modules.texi (SRFI-105): Add stub doc for SRFI-105. * doc/ref/api-evaluation.texi (Scheme Read): Add documentation for the 'curly-infix' read option, and the '#!curly-infix' and '#!curly-infix-and-bracket-lists' reader directives. * doc/ref/api-options.texi (Runtime Options): Add 'curly-infix' to the list of read options. * test-suite/Makefile.am: Add tests/srfi-105.test. * test-suite/tests/srfi-105.test: New file. 2012-10-26 Mark H Weaver Implement #!fold-case and #!no-fold-case reader directives. * libguile/read.c (set_port_case_insensitive_p): New function. (scm_read_shebang): Handle #!fold-case and #!no-fold-case. * doc/ref/api-evaluation.texi (Case Sensitivity, Scheme Read): Document the #!fold-case and #!no-fold-case reader directives. * test-suite/tests/reader.test ("per-port-read-options"): Add tests. 2012-10-26 Mark H Weaver Implement per-port read options. * libguile/read.c (scm_t_read_opts): Update comment to mention the per-port read options. (sym_port_read_options): New variable. (set_port_read_option): New function. (init_read_options): Add new 'port' parameter, and consult the per-port read option overrides when initializing the 'scm_t_read_opts' struct. Move to bottom of file. (scm_read): Pass 'port' parameter to init_read_options. 2012-10-24 Mark H Weaver Repurpose scm_i_port_weak_hash to associate an alist with each port. * libguile/ports.c (scm_i_port_weak_hash): Document that the values in this hash table will now be alists. Previously the value slots were unused. (scm_new_port_table_entry): Change the initial value of the entry in scm_i_port_weak_hash from SCM_BOOL_F to SCM_EOL. 2012-10-24 Mark H Weaver Generalize scm_read_shebang to handle other reader directives. * libguile/read.c (READER_DIRECTIVE_NAME_MAX_SIZE): New C macro. (scm_read_shebang): Rewrite to handle arbitrary reader directives. Add source properties to more datum types in scm_read_sharp_extension. * libguile/read.c (scm_read_sharp_extension): Attach source properties to the result of a custom token reader if the returned datum is not immediate. Previously, source properties were added to pairs only. 2012-10-24 Mark H Weaver Change reader to pass read options to helpers via explicit parameter. * libguile/read.c (enum t_keyword_style, struct t_read_opts, scm_t_read_opts): New types. (init_read_options): New function. (CHAR_IS_DELIMITER): Look up square-brackets option via local 'opts'. (scm_read): Call 'init_read_options', and pass 'opts' to helpers. (flush_ws, maybe_annotate_source, read_complete_token, read_token, scm_read_bytevector, scm_read_character, scm_read_commented_expression, scm_read_expression, scm_read_guile_bit_vector, scm_read_keyword, scm_read_mixed_case_symbol, scm_read_nil, scm_read_number, scm_read_number_and_radix, scm_read_quote, scm_read_sexp, scm_read_sharp, scm_read_sharp_extension, scm_read_shebang, scm_read_srfi4_vector, scm_read_string, scm_read_syntax, scm_read_vector, scm_read_array): Add 'opts' as an additional parameter, and use it to look up read options. Previously the global read options were consulted directly. 2012-10-24 Mark H Weaver Minor tweaks to delimiter handling in read.c * libguile/read.c (CHAR_IS_R5RS_DELIMITER, CHAR_IS_DELIMITER): Move the '[' and ']' delimiters from CHAR_IS_R5RS_DELIMITER to CHAR_IS_DELIMITER. Parenthesize all references to the macro parameter. Don't check the global square-brackets read option until after we know the character is '[' or ']'. (scm_read_sexp): Don't check the global square-brackets read option until after we know the character is ']'. 2012-10-24 Mark H Weaver Move array reader from arrays.c to read.c * libguile/arrays.c (read_decimal_integer): Move to read.c. (scm_i_read_array): Remove. Incorporate the code into the 'scm_read_array' static function in read.c. * libguile/arrays.h (scm_i_read_array): Remove prototype. * libguile/read.c (read_decimal_integer): Move here from read.c. (scm_read_array): Incorporate the code from 'scm_i_read_array'. Call 'scm_read_vector' and 'scm_read_sexp' instead of 'scm_read'. 2012-10-18 Ian Price Fix typo in scheme-using.texi * doc/ref/scheme-using.texi (System Commands): Fix typo. Fix @@ usage in --listen option * module/ice-9/command-line.scm (compile-shell-switches): Fix usage of @@, which no longer supports arbitrary expressions, only identifiers. 2012-10-17 Mark H Weaver Remove prototype for scm_read_token, which does not exist. * libguile/read.h: Remove prototype for scm_read_token. Improve formatting of options help given long option names * module/ice-9/boot-9.scm (define-option-interface): When printing options help, e.g. for (read-options 'help), expand the width of the first column by another tab stop, to accommodate option names of up to 23 characters. 2012-10-13 Ludovic Courtès web: Fix possible file descriptor leak in `open-socket-for-uri'. * module/web/client.scm (open-socket-for-uri): Always close S in the `system-error' handler. 2012-10-12 Ludovic Courtès web: Pass `AI_NUMERICSERV' when given a port number. * module/web/client.scm (open-socket-for-uri)[addresses]: Pass AI_NUMERICSERV as the `getaddrinfo' hint when (uri-port URI) is true. web: Change `http-get' to try all the addresses for the given URI. * module/web/client.scm (open-socket-for-uri): Try all the addresses returned by `getaddrinfo' until one succeeds. 2012-10-12 Ludovic Courtès Implement `hash' for structs. * libguile/hash.c (scm_hasher): Call `scm_i_struct_hash' upon `scm_tcs_struct'. * libguile/struct.c (scm_i_struct_hash): New function. * libguile/struct.h (scm_i_struct_hash): New declaration. * test-suite/tests/structs.test ("hash"): New test prefix. 2012-10-12 Mark H Weaver Thanks Daniel Hartwig. * THANKS (Contributors since the last release): Add Daniel Hartwig. 2012-10-12 Daniel Hartwig In string-split, add support for character sets and predicates. * libguile/srfi-13.c (string-split): Add support for splitting on character sets and predicates, like string-index and others. * test-suite/tests/strings.test (string-split): Add tests covering the new argument types. * doc/ref/api-data.texi (string-split): Update. 2012-10-10 Mark H Weaver Revert "Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'" This reverts commit 3e3d32dd9b2d71ffb0703dedc4d47387e981c9b5. 2012-10-08 Mark H Weaver Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule' * module/ice-9/psyntax-pp.scm (syntax-rule, define-syntax-rule): Preserve the keyword identifier. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-10-08 Mark H Weaver Simplify calls to 'eqv?' when one argument is an immediate constant. * module/language/tree-il/primitives.scm (maybe-simplify-to-eq): New helper procedure shared by expanders for 'eqv?' and 'equal?'. (*primitive-expand-table*): Add expansion rule for 'eqv?'. * test-suite/tests/tree-il.test ("primitives"): Add tests. 2012-10-08 Mark H Weaver Don't simplify 'equal?' to 'not' or 'null?'. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't simplify 'equal?' to 'not' or 'null?', but only to 'eq?'. * test-suite/tests/tree-il.test ("primitives"): Adjust tests. 2012-10-08 Mark H Weaver Don't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Refine test for fixnums to verify that the small integer is exact. * test-suite/tests/tree-il.test ("primitives"): Add test. 2012-10-06 Ludovic Courtès Simplify calls to `equal?' when one argument is a constant. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Add expansion rules for `equal?', when called with one constant and another argument. * test-suite/tests/tree-il.test (pass-if-primitives-resolved): New macro. ("primitives"): New test prefix. 2012-10-06 Mark H Weaver Improve error reporting in 'append!' * libguile/list.c (scm_append_x): Report correct argument number when validating arguments. Validate that the last cdr of each argument is null or nil. Rename formal rest argument from 'lists' to 'args'. * test-suite/tests/list.test (append!): Update tests to expect correct handling of improper lists. 2012-10-04 Mark H Weaver Change inappropriate uses of expect-fail X to pass-if not X in chars.test * test-suite/tests/chars.test (basic char handling): Change inappropriate uses of 'expect-fail' to 'pass-if' with 'not' applied to the test. 2012-09-26 Chris K. Jester-Young In fold-matches, set regexp/notbol unless matching string start. * module/ice-9/regex.scm (fold-matches): Set regexp/notbol if the starting position is nonzero. * test-suite/tests/regexp.test (fold-matches): Check that when matching /^foo/ against "foofoofoofoo", only one match results. 2012-09-11 Ludovic Courtès Don't stat(2) and access(2) the .go location before using it. * module/system/base/compile.scm (ensure-directory): Rename to... (ensure-directory): ... this. Update callers. When ERRNO is EEXIST, assume DIR is a writable directory instead of calling `stat' and `access?' again. Fixes UID/EUID mismatches for setuid binaries. Reported by rixed@happyleptic.org at . 2012-09-11 Ludovic Courtès Rewrite SRFI-31 in terms of `syntax-rules'. * module/srfi/srfi-31.scm: Use `#:export' instead of `#:export-syntax'. (rec): Rewrite using `syntax-rules'. * test-suite/tests/srfi-31.test ("rec special form"): Change exception type to EXCEPTION:SYNTAX-PATTERN-UNMATCHED. 2012-09-06 Ian Price Document (ice-9 curried definitions) * doc/ref/Makefile.am (guile_TEXINFOS): Add curried.texi to list * doc/ref/curried.texi: New file. * doc/ref/guile.texi (Guile Modules): Add "Curried Definitions" to menu. * doc/ref/scheme-ideas.texi (Lambda Alternatives): Refer to "Curried Definitions" from the `define' section. `define-public' is no a longer curried definition by default. * module/ice-9/boot-9.scm (define-public): Remove currying functionality. * module/ice-9/curried-definitions.scm (define-public): New export. 2012-09-03 Ludovic Courtès build: Fix race between installing `guild' and the `guile-tools' symlink. Fixes . Report and patch by Song.Li . * meta/Makefile.am (install-data-hook): Rename to... (install-exec-hook): ... this. 2012-09-03 Ludovic Courtès doc: Use scm_{to,from}_double instead of old API in example. Fixed . Reported by Kurt W. Gochko . * doc/ref/tour.texi (Writing Guile Extensions): Change example to use scm_{to,from}_double instead of the pre-1.8 API. 2012-09-03 Ludovic Courtès build: Use Automake's `color-tests'. * configure.ac: Use Automake's `color-tests'. 2012-08-27 Ian Price ISO 8601 time format specifies zero padding for hours, not blank padding. * doc/ref/srfi-modules.texi ("SRFI-19 Date to string"): Fix iso 8601 format strings. * module/srfi/srfi-19.scm (directives): Fix iso 8601 format strings. 2012-08-27 Ludovic Courtès doc: Fix description of regexp/locale encoding interaction. * doc/ref/api-regex.texi (Regexp Functions): Update paragraph that mentions locale encoding and strings-as-bytes. * test-suite/tests/regexp.test ("nonascii locales")["match structures refer to char offsets, non-ASCII pattern"]: New test. 2012-08-26 Ludovic Courtès Update `texinfo.test' to match latest change. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@url{arg}"]: Update test as a follow-up to dc7a9cefbf5434b6e7e503fe83faa07b24a1a6cd ("more robust texinfo alias handling"). 2012-08-26 Ian Price Fix uri-encoding for strings with no unreserved chars * module/web/uri.scm (uri-encode): Change test to check for unreserved chars instead of reserved chars. * test-suite/tests/web-uri.test ("encode"): Add test. Fix uri-encoding for octets 0-15 * module/web/uri.scm (uri-encode): All encoded octets should be of the form % HEXDIGIT HEXDIGIT. * test-suite/tests/web-uri.test ("encode"): Add test. 2012-08-25 Andy Wingo more robust texinfo alias handling * module/texinfo.scm (command-spec): Resolve aliases here. (complete-start-command, make-command-parser): (make-dom-parser, parse-environment-args): Reload command after resolving spec, so we get the alias target. 2012-08-21 Ludovic Courtès Micro-optimize (ice-9 format). * module/ice-9/format.scm (format): Use `call-with-output-string' instead of `with-output-to-string'. 2012-08-20 Ludovic Courtès Optimize `scm_lfwrite_substr', used by `scm_simple_format'. Fixes . Reported by nalaginrut . * libguile/print.c (scm_i_display_substring): New function. * libguile/print.h (scm_i_display_substring): New internal declaration. * libguile/ports.c (scm_lfwrite_substr): Use it instead of `scm_display' + `scm_c_substring'. 2012-08-17 Andy Wingo reinstate type check to scm_to_utf8_stringn * libguile/strings.c (scm_to_utf8_stringn): Re-add missing type check, inadvertantly removed in e3d4597469a543d97c4997b128509c2ceb13ca2b. 2012-08-08 Mark H Weaver Revert "Add tests for 'exp' and 'expt' that should produce complex NaNs" This reverts commit cc26b9de1d3c21cb4be49cc61c4b5872b8f607c5. Revert "Avoid cexp, whose C standard definition is mathematically incorrect" This reverts commit ecbded71bb423a6055c541d6272796aefd1486f9. 2012-08-01 Mark H Weaver Avoid cexp, whose C standard definition is mathematically incorrect * libguile/numbers.c (scm_exp): Do not use cexp. 2012-07-28 Mark H Weaver Add tests for 'exp' and 'expt' that should produce complex NaNs * test-suite/tests/numbers.test (exp, expt): Add tests that should produce complex NaNs, but apparently don't on all systems. 2012-07-28 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/struct.c libguile/struct.h set struct names for , etc * libguile/struct.c (scm_init_struct): Set the struct names for , , and . 2012-07-28 Andy Wingo update tests after vtable-vtable deprecation * test-suite/tests/goops.test ("classes for built-in types"): Use a vtable instead of a vtable-vtable. * test-suite/tests/structs.test (ball-root) ("low-level struct procedures", "make-struct"): Rework to use normal vtables instead of making new vtable-vtable. 2012-07-28 Andy Wingo deprecate make-vtable-vtable * libguile/struct.h: * libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can handle most of the use cases with make-vtable, and we don't want to promote the creation of new roots to the type hierarchy. (scm_i_make_vtable_vtable): The internal replacement. improve documentation for structs * doc/ref/api-compound.texi (Structures): Update to describe , to remove documentation for make-vtable-vtable, to describe meta-vtables, and to add a long example. update structure documentation * doc/ref/api-compound.texi (Records): Add a link to SRFI-9 records. (Structures): Add a link to Records. Describe tail arrays as deprecated, and add a rationale and some details. 1;3202;0cMerge remote-tracking branch 'origin/stable-2.0' improve documentation for structs * doc/ref/api-compound.texi (Structures): Update to describe , to remove documentation for make-vtable-vtable, to describe meta-vtables, and to add a long example. set struct names for , etc * libguile/struct.c (scm_init_struct): Set the struct names for , , and . 2012-07-28 Mark H Weaver Angle of -0.0 is pi, not zero * libguile/numbers.c (scm_angle): Check the sign of an inexact real zero, to ensure that (angle -0.0) => pi and (angle 0.0) => 0.0. * test-suite/tests/numbers.test (angle): Add tests, and increase precision of tests where the angle should be pi. 2012-07-24 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION update structure documentation * doc/ref/api-compound.texi (Records): Add a link to SRFI-9 records. (Structures): Add a link to Records. Describe tail arrays as deprecated, and add a rationale and some details. 2012-07-11 Noah Lavine Document (ice-9 and-let-star) * doc/ref/srfi-modules.texi: note that (srfi srfi-2) is the same as (ice-9 and-let-star). 2012-07-07 Ludovic Courtès build: Use `AM_PROG_AR'. * configure.ac: Use `AM_PROG_AR', as suggested by Automake 1.12.1 ("warning: 'libguilereadline-v-@LIBGUILEREADLINE_MAJOR@.la': linking libtool libraries using a non-POSIX archiver requires 'AM_PROG_AR' in 'configure.ac'"). Fix typos in `NEWS'. * NEWS: Fix typos. Bump version number for 2.0.6. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C functions like `scm_c_nvalues', `scm_to_pointer', etc. (LIBGUILE_INTERFACE_AGE): Increment. Store the `git-version-gen' patch. * gnulib-local/build-aux/git-version-gen.diff: New file. * Makefile.am (EXTRA_DIST): Add it. Work around `gl_CANONICALIZE_LGPL' bug when cross-compiling to GNU/Hurd. * gnulib-local/m4/canonicalize.m4.diff: New file. * Makefile.am (EXTRA_DIST): Add it. Work around `gl_CANONICALIZE_LGPL' bug when cross-compiling. * gnulib-local/m4/canonicalize.m4.diff: New file. * Makefile.am (EXTRA_DIST): Add it. Add missing `m4/clock_time.m4'. 2012-07-06 Ludovic Courtès Use `clock-time' directly from Gnulib, but with a local patch. This is equivalent to the previous situation, but more easily maintainable. * acinclude.m4 (gl_CLOCK_TIME): Remove. * configure.ac: Remove explicit use of `gl_CLOCK_TIME'. * m4/gnulib-cache.m4 (gl_MODULES): Add `clock-time'. * gnulib-local/m4/clock_time.m4.diff: New file. * Makefile.am (EXTRA_DIST): Add it. 2012-07-06 Ludovic Courtès Update Gnulib to v0.0-7509-g98a2286. * Makefile.am (EXTRA_DIST): Add `m4/gnulib-cache.m4'. * build-aux/git-version-gen: Keep unchanged. 2012-07-06 Andy Wingo add http/1.1 transfer codings to the NEWS * doc/ref/web.texi (Transfer Codings): Add a note about modules. * NEWS: Add NEWS for transfer codings. 2012-07-06 Ian Price Document and export `declare-opaque-header!' * module/web/http.scm (declare-opaque-header!): Add docstring. New export. * doc/ref/web.texi (HTTP): Add documentation. 2012-07-06 Ian Price Add HTTP Chunked Encoding support to web modules. * doc/ref/web.texi(Transfer Codings): New subsection for transfer codings. * module/web/http.scm(make-chunked-input-port, make-chunked-output-port): New procedures. * module/web/response.scm (read-response-body): Handle chunked responses. * test-suite/tests/web-response.test: Add test. * test-suite/tests/web-http.test: Add tests. afd 2012-07-06 Mark H Weaver Fix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries * module/ice-9/psyntax.scm (@): Return top-wrap instead of the wrap applied to the '@' form, so that the symbol will be interpreted as a top-level identifier and never refer to any lexical variable. (@@): Change the syntax used to support R6RS 'library' forms to: (@@ @@ (mod ...) body). Change the behavior of the documented (@@ (mod ...) id) form to be the same as that of @, except for the use of 'private' instead of 'public' in the psyntax mod: use syntax->datum on the identifier, and return top-wrap instead of the wrap applied to the '@@' form. This fixes reported by Ludovic Courtès. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/r6rs-libraries.scm (library): Use '@@ @@' syntax instead of the older '@@' syntax. * test-suite/tests/syncase.test (changes to expansion environment): Use '@@ @@' syntax. * module/Makefile.am: Add explicit dependencies for boot-9.go on the files that it includes: quasisyntax.scm and r6rs-libraries.scm. 2012-07-06 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' This anticipates deprecation of make-vtable-vtable in stable-2.0, which hasn't happened yet. Conflicts: libguile/deprecated.c libguile/deprecated.h libguile/print.c libguile/struct.c 2012-07-06 Andy Wingo simplify %condition-type-vtable * module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable instead of make-vtable-vtable. record-type-vtable is not a new root of the vtable hierarchy * module/ice-9/boot-9.scm (record-type-vtable): Simplify to use make-vtable instead of make-vtable-vtable. Scheme standard-vtable-fields binding * libguile/struct.c (scm_init_struct): Export standard-vtable-fields to Scheme. add Scheme binding for scm_standard_vtable_vtable * libguile/struct.c (scm_init_struct): Export to Scheme. simplify scm_init_print * libguile/print.c (scm_init_print): Simplify creation of print-state vtable. deprecate struct-vtable-tag * libguile/deprecated.c: * libguile/deprecated.h: * libguile/struct.c: * libguile/struct.h: * doc/ref/api-compound.texi: Deprecate struct-vtable-tag. disable some uri tests if --disable-networking * test-suite/tests/web-uri.test: Disable some tests if we don't have inet-pton. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/expand.c libguile/hashtab.c libguile/ports.c libguile/vectors.c libguile/weaks.c module/language/ecmascript/compile-tree-il.scm module/language/tree-il/effects.scm module/language/tree-il/fix-letrec.scm module/language/tree-il/peval.scm test-suite/tests/peval.test add --match pattern to git-version-gen * configure.ac: Add --match pattern so we only get v2.0.x tagx. git-version-gen: add --match argument * build-aux/git-version-gen (Options): Add --match argument. (v_from_git): Remove path without --match. update git-version-gen from gnulib * build-aux/git-version-gen: Import from gnulib. 2012-07-06 Daniel Krueger fixed repl command ,describe to also handle syntax 2012-07-06 Dagobert Michelsen Add alignment for Sun Studio 12 2012-07-06 Andy Wingo more uri-related ipv6 fixes * module/web/uri.scm (ipv6-regexp): IPv6 numeric addresses do not have brackets. It's only in URIs that they have them. (ipv6-host-pat, authority-regexp, parse-authority): Refactor ipv6 detection to fix a bug with |, and to extract IPv6 hosts from their brackets. This way we can pass the uri-host directly to inet-pton. (uri->string): If the host contains a `:', assume it is ipv6 and add brackets. * test-suite/tests/web-uri.test ("build-uri"): Adapt tests to assume that the address returned by uri-host and passed to build-uri #:host does not have brackets. 2012-07-06 Daniel Hartwig enhance IPv6 support * module/web/uri.scm (valid-host?): Support dotted-quad notation in IPv6 addresses. (parse-authority): Support IPv6 literals. * test-suite/tests/web-uri.test: Add and fix tests. support URIs with domain names starting with numbers * module/web/uri.scm (valid-host?): Fix regexp to support domain names starting with numbers. * test-suite/tests/web-uri.scm: Add tests for above and IP literals. 2012-07-06 Andy Wingo fix typo in web.texi * doc/ref/web.texi (HTTP Headers): Fix typo in example. Fixes http://bugs.gnu.org/10890. 2012-07-06 Andy Wingo better procedure-arguments for interpreted procs with opt, rest, kwargs * module/ice-9/session.scm (procedure-arguments): Arrange to interpret numbers in the "req" and "opt" positions of an 'arglist as N arguments with unknown name. * module/ice-9/eval.scm (primitive-eval): Set 'arglist on "complex" procedures. Fixes http://bugs.gnu.org/10922. * test-suite/tests/session.test ("procedure-arguments"): Add a test. 2012-07-06 Andy Wingo add check for fchmod * configure.ac: Add a check for fchmod. * libguile/filesys.c (scm_chmod): Guard the fchmod case with HAVE_FCHMOD. 2012-07-06 Andy Wingo remove mkdir alias in filesys.c for mingw * libguile/filesys.c (mkdir): Remove alias, as gnulib handles this for us. fix warnings in mingw in expand.c * libguile/expand.c (VOID_, CONST_): Add trailing underscores to avoid name conflicts on MinGW. fix warning about vsnprintf on mingw * libguile/deprecation.c: Remove a vsnprintf alias for mingw, now that gnulib handles it correctly. be sure to include time.h for struct timespec * libguile/gen-scmconfig.c: The GNU libc manual says that struct timespec is defined in time.h. So, just include both sys/time.h and time.h, if they are available. 2012-07-05 Andy Wingo fix `vector' instruction emission for big vectors * module/language/glil/compile-assembly.scm (dump-constants): Only use the `vector' instruction for vectors whose length can fit in 16 bits. Fixes http://bugs.gnu.org/11087. 2012-07-05 Andy Wingo fix-letrec uses effects.scm for effects analysis * module/language/tree-il/fix-letrec.scm: Use effects.scm for effects analysis, instead of primitives.scm. (simple-expression?, partition-vars): Adapt. 2012-07-05 Andy Wingo simplify one kind of degenerate prompt * module/language/tree-il/peval.scm (): Instead of having a `residualize?' field, have it be a use count. (peval): Adapt to change. Add function to kill uses of an operand. Use it in the inliner. Add another kind of degenerate prompt to elide. We should really switch to CPS though, as that will allow us to contify more aggressively. * test-suite/tests/peval.test ("partial evaluation"): Adapt (while #t #t) test, which was sensitive to how far the recursive inlining got. Add a test for the degenerate prompt elision. 2012-07-05 Andy Wingo fix bugs in effects analysis of "effect+exception-free-primitives" * module/language/tree-il/effects.scm (make-effects-analyzer): Be more precise regarding the effects of the so-called effect+exception-free-primitives: now we check their arities. * test-suite/tests/cse.test ("cse"): Add a test that we don't elide (cons 1 2 3) in effect context. 2012-07-05 Andy Wingo optimize (apply foo 0 (list 1 2)) => (foo 0 1 2) * module/language/tree-il/peval.scm (peval): Inline applications where we know the contents of the tail. * test-suite/tests/peval.test ("partial evaluation"): Add tests. 2012-07-05 Andy Wingo compile ecmascript's `return' as an abort * module/language/ecmascript/compile-tree-il.scm (current-return-tag): (with-return-prompt, comp): Compile `return' as an abort instead of a primcall to `return'. Fixes beta-reduction by the optimizer -- it doesn't make sense for `return' to move from one function to another! fix goops compilation when current language is not scheme * module/oop/goops/dispatch.scm (compute-dispatch-procedure): Set source language to Scheme, not (current-language). 2012-07-04 Andy Wingo add scm_c_nvalues to news * NEWS: Add scm_c_nvalues. 2012-07-04 Andy Wingo add scm_c_nvalues with docs; also, docs for scm_c_values * libguile/values.h: * libguile/values.c (scm_c_nvalues): New function. * doc/ref/api-control.texi (Multiple Values): Add docs for scm_c_values and scm_c_nvalues. Fixes http://bugs.gnu.org/11764. 2012-07-04 Andy Wingo add scm_{to,from}_pointer docs * doc/ref/api-foreign.texi: Add documentation for scm_to_pointer and scm_from_pointer. 2012-07-02 Andy Wingo update NEWS * NEWS: Update. dead code elimination * module/ice-9/psyntax.scm: Remove commented-out definitions of `do' and `case'. remove docs for smob-call instruction * doc/ref/vm.texi (Trampoline Instructions): Remove docs for smob-call. typo fix in web.texi * doc/ref/web.texi (URIs): Fix a typo/thinko. 2012-07-02 Ludovic Courtès Have `procedure-arguments' always return the `allow-other-keys?' pair. Fixes . Based on a patch by Stefan Israelsson Tampe . * module/ice-9/session.scm (procedure-arguments): When the 'arglist property is available, emit the `allow-other-keys?' pair. Use `match-lambda'. * test-suite/tests/session.test ("procedure-arguments")["aok? is preserved"]: New test. 2012-07-02 Ludovic Courtès Add tests for `procedure-arguments'. * test-suite/tests/session.test ("procedure-arguments"): New test prefix. Update `THANKS'. 2012-07-02 Ludovic Courtès Remove backward-compatible `GC_PTR' definition. Fixes . Reported by Kevin J. Fletcher . * libguile/bdw-gc.h (GC_PTR)[(defined GC_VERSION_MAJOR) && (GC_VERSION_MAJOR >= 7)]: Remove. 2012-07-02 Ludovic Courtès Use `void *' instead of `GC_PTR' internally. * libguile/finalizers.c, libguile/foreign.c, libguile/guardians.c, libguile/hashtab.c, libguile/numbers.c, libguile/ports.c, libguile/smob.c, libguile/struct.c, libguile/vectors.c, libguile/weaks.c: Use `void *' instead of `GC_PTR'. 2012-07-02 Ludovic Courtès doc: Remove reference to `closure?', now deprecated. Fixed . * doc/ref/api-procedures.texi (Procedure Properties): Remove reference to `closure?'. Suggested by David Jaquay . 2012-06-22 Andy Wingo instead of our custom .go format, use elf * libguile/objcodes.c: Change to expect objcode on disk to be embedded in ELF instead of having the funky cookie. (to_native_order): Use already existing SCM_BYTE_ORDER style byte order instead of chars. (bytecode_to_objcode): No need for word_size arg. (scm_bytecode_to_objcode, scm_objcode_to_bytecode): Take optional endianness arg instead of sometimes using target-endianness. (scm_load_objcode, scm_write_objcode, scm_bytecode_to_native_objcode): Remove. * libguile/objcodes.h: Adapt. * libguile/vm.c (scm_load_compiled_with_vm): Use scm_load_thunk_from_file. (make_boot_program): Adapt to use scm_bytecode_to_objcode with endianness arg. * module/Makefile.am (OBJCODE_LANG_SOURCES): Add (language objcode elf). * module/language/objcode/elf.scm: New module, embeds objcode in ELF. * module/language/bytecode/spec.scm (compile-objcode): (decompile-objcode): Use (target-endianness). * module/language/objcode/spec.scm: use (language objcode elf) for write-objcode. * module/scripts/disassemble.scm (disassemble): * module/system/repl/command.scm (disassemble-file): Use load-thunk-from-file. * module/system/vm/objcode.scm: Remove load-objcode and write-objcode. * test-suite/tests/asm-to-bytecode.test (test-target): Adapt to the new ELF world. 2012-06-22 Andy Wingo add ELF loader * libguile/objcodes.h: * libguile/objcodes.c (scm_load_thunk_from_file) (scm_load_thunk_from_memory): New procedures. * libguile/elf.h: Import from glibc. Not installed. * libguile/Makefile.am: Adapt for elf.h. * module/system/vm/objcode.scm: (load-thunk-from-file) (load-thunk-from-memory): New exports. 2012-06-22 Andy Wingo add elf parser and linker * module/Makefile.am: * module/system/vm/elf.scm: New file. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/deprecated.c libguile/ports.c libguile/ports.h libguile/strports.c test-suite/tests/cse.test add char->integer, number->string etc to interesting primitives * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add string->number, number->string, integer->char, and char->integer to allow for constant folding and better effects analysis. update version-etc copyright year * module/ice-9/command-line.scm (version-etc): Update copyright year to 2012. 2012-06-22 Andy Wingo cse: expressions evaluated for effect do not provide predicates * module/language/tree-il/cse.scm (cse): When trying to fold conditionals, only look at entries in the database that were added in test context. * test-suite/tests/cse.test ("cse"): Add a test case. 2012-06-22 Andy Wingo scandir: select? takes basenames, operates on (sub)dirs also * module/ice-9/ftw.scm (scandir): Run the select? procedure on all items, including subdirs and the `.' and `..' entries. Pass it the basename of the file in question instead of the full name. * test-suite/tests/ftw.test ("scandir"): Adapt expectation for the .test selector. Add test for a selector that rejects everything. 2012-06-20 Ludovic Courtès Fix possible deadlock upon `encoding-error' in `open-input-string'. Partly addresses . * libguile/strports.c (scm_mkstrport): Call `scm_port_non_buffer', set Z's cell type and stream, and release `scm_i_port_table_mutex' early. Reacquire `scm_i_port_table_mutex' once BUF, C_BUF, and STR_LEN are initialized. * test-suite/tests/ports.test ("string ports")["encoding failure leads to exception"]: New test. 2012-06-20 Ludovic Courtès Make SRFI-6 string ports Unicode-capable. Partly addresses . Reported by Klaus Stehle . * module/srfi/srfi-6.scm (open-input-string, open-output-string): New procedures. * test-suite/tests/srfi-6.test ("open-input-string")["read-char, Unicode"]: New test. ("open-output-string")["λ"]: New test. 2012-06-20 Ludovic Courtès Update `THANKS'. 2012-06-20 Ludovic Courtès Fix cross-compilation of GOOPS-using code. Fixes . Reported by Bogdan A. Marinescu . * module/oop/goops/dispatch.scm (compute-dispatch-procedure)[comp]: Wrap `compile' call in (with-target %host-type ...). 2012-06-09 Sjoerd van Leent Fix unbound variables and unbound values * module/language/ecmascript/base.scm: fix two wrong variable names and a wrong number of arguments in a function call. 2012-06-08 Ludovic Courtès Fix invalid use of `SCM' as a Boolean. * libguile/deprecated.c (scm_sym2var): Check `scm_is_true (definep)'. 2012-06-08 Ludovic Courtès Update (ice-9 match) from Chibi-Scheme. Fixes . * module/ice-9/match.upstream.scm: Update. 2012-05-31 Ludovic Courtès Make `substitute' conversion strategy test portable. * test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy is soft"]: Split into the following tests. ["%default-port-conversion-strategy is escape", "%default-port-conversion-strategy is substitute"]: New tests. In the latter, add the escape form returned on FreeBSD 8.2 and Darwin 10.8.0. 2012-05-31 Ludovic Courtès Fix port test that assumed string ports use the `error' conversion strategy. This is a followup to 9f6e3f5a997f484548bd03e7e7573c38a95c8d09 ("Have string ports honor `%default-port-conversion-strategy'."). * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Set %DEFAULT-PORT-CONVERSION-STRATEGY to 'error. Return #f when no exception is raised. ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Return #f when no exception is raised. 2012-05-31 Ludovic Courtès Have string ports honor `%default-port-conversion-strategy'. * libguile/strports.c (scm_mkstrport): Remove initialization of `pt->ilseq_handler'. * module/ice-9/pretty-print.scm (truncated-print)[ellipsis]: Set %DEFAULT-PORT-CONVERSION-STRATEGY to 'error. * test-suite/tests/ports.test ("string ports")["%default-port-conversion-strategy is honored"]: New test. ["wrong encoding"]: Rename to... ["wrong encoding, error"]: ... this. Explicitly set %DEFAULT-PORT-CONVERSION-STRATEGY to 'error. Return #f when no exception is raised. 2012-05-31 Ludovic Courtès Add the `%default-port-conversion-strategy' fluid. Fixes . * libguile/ports.c (scm_conversion_strategy): Remove. (default_conversion_strategy_var, sym_error, sym_substitute, sym_escape): New variables. (scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x): Remove. (scm_i_default_port_conversion_handler, scm_i_set_default_port_conversion_handler): New functions. (scm_port_conversion_strategy): Use `scm_i_default_port_conversion_handler' when PORT is #f. (scm_set_port_conversion_strategy_x): Use SYM_ERROR, SYM_SUBSTITUTE, and SYM_ESCAPE. Use `scm_i_set_default_port_conversion_handler' when PORT is #f. (scm_init_ports): Initialize DEFAULT_CONVERSION_STRATEGY_VAR. * libguile/ports.h: Update declarations accordingly. * libguile/foreign.c: Change `scm_i_get_conversion_strategy (SCM_BOOL_F)' to `scm_i_default_port_conversion_handler ()'. * libguile/strings.c: Likewise. * test-suite/tests/ports.test ("%default-port-conversion-strategy"): New test prefix. * test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy is error", "%default-port-conversion-strategy is soft"]: New tests. * test-suite/test-suite/lib.scm (exception:encoding-error): Allow the regexp to match `scm_to_stringn' error messages. * doc/ref/api-io.texi (Ports): Document `%default-port-conversion-strategy'. 2012-05-31 Ludovic Courtès Access `pt->ilseq_handler' directly when needed. * libguile/print.c (PORT_CONVERSION_HANDLER): New macro. (print_extended_symbol, iprin1, write_character, scm_write_char): Use it instead of `scm_i_get_conversion_strategy'. * libguile/strports.c (scm_mkstrport): Assign `pt->ilseq_handler' directly instead of via `scm_i_set_conversion_strategy_x'. 2012-05-31 Ludovic Courtès coverage: Add test for applicable structs. * test-suite/tests/coverage.test ("procedure-execution-count")["applicable struct"]: New test. 2012-05-23 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' This commit removes code that was newly deprecated in stable-2.0. Conflicts: libguile/deprecated.c libguile/deprecated.h libguile/modules.c module/ice-9/boot-9.scm module/ice-9/deprecated.scm 2012-05-23 Andy Wingo finish deprecating eval closures * libguile/deprecated.h: * libguile/deprecated.c (scm_eval_closure_lookup) (scm_standard_eval_closure, scm_standard_interface_eval_closure) (scm_eval_closure_module): Deprecate these, as they are unused. * libguile/modules.h: * libguile/modules.c: Remove deprecated code. * module/oop/goops/util.scm (top-level-env, top-level-env?): Deprecate. * module/ice-9/deprecated.scm (set-system-module!): Deprecate. (module-eval-closure): Deprecate, by overriding the core definition to return a fresh eval closure. * module/ice-9/boot-9.scm (make-module): Don't set an eval closure on the module. (the-root-module, the-scm-module): Don't call set-system-module!. 2012-05-23 Andy Wingo deprecate lookup closures * libguile/deprecated.h (SCM_TOP_LEVEL_LOOKUP_CLOSURE): * libguile/deprecated.c (scm_lookup_closure_module): (scm_module_lookup_closure): (scm_current_module_lookup_closure): Deprecate this part of the eval closure interface. It was unused internally, after the scm_sym2var refactor. * libguile/eval.h: * libguile/modules.c: * libguile/modules.h: Remove deprecated code. * libguile/goops.c (scm_ensure_accessor): Use scm_module_variable instead of calling the lookup closure. However I'm not sure that this code is used at all. 2012-05-23 Andy Wingo deprecate scm_sym2var * libguile/deprecated.h: * libguile/deprecated.c (scm_sym2var): Deprecate this function. * libguile/modules.h: * libguile/modules.c (scm_module_ensure_local_variable): New public function, replacing scm_sym2var with a true definep, without going through eval closures (which are deprecated). (scm_current_module): Rework to do something sensible before modules are booted. (scm_module_lookup, scm_lookup): Refactor to use scm_module_variable. (scm_module_define, scm_define): Refactor to use scm_module_ensure_local_variable. * libguile/vm-i-system.c (define!): Use scm_define. * libguile/vm.c (resolve_variable): Use scm_module_lookup. * libguile/macros.c (scm_make_syntax_transformer): Use scm_module_variable. * libguile/gdbint.c (gdb_binding): Use scm_define. * doc/ref/api-modules.texi (Accessing Modules from C): Add docs for scm_module_ensure_local_variable. 2012-05-21 Andy Wingo Merge remote-tracking branch 'origin/master' Merge remote-tracking branch 'origin/stable-2.0' Conflicts: module/language/tree-il/analyze.scm module/language/tree-il/effects.scm module/language/tree-il/fix-letrec.scm module/language/tree-il/peval.scm test-suite/tests/cse.test test-suite/tests/peval.test fix arity check for applicable structs * module/language/tree-il/analyze.scm (validate-arity): Fix for applicable structs. Applicable structs are procedures, but not every struct has a first slot, and not every struct with a procedure in its first slot is applicable. Besides, the approach in this patch gives better errors. rearrange scheme compilation order * module/Makefile.am (SOURCES): Move vlists, srfi-1, peval, and cse up in the compilation order. These are exercised a lot in the compiler. vm.c: remove a useless check * libguile/vm.c: Remove a check for modules being booted. If the module passed in is true, that is guaranteed to have been the case. Passes a fresh bootstrap. 2012-05-21 Ken Raeburn Fix FFI struct sizing to account for trailing padding. * libguile/foreign.c (scm_sizeof): Make sure the overall size is a multiple of the alignment of the structure. * test-suite/tests/foreign.test: Test size of { double, int8 }. Fix lock handling bug in commit aac980de43a0466b968a56607664f5ebbca6b751. * libguile/weak-set.c (resize_set): When releasing a lock temporarily to do an allocation, re-lock it afterwards, instead of unlocking again. * libguile/weak-table.c (resize_table): Likewise. 2012-05-17 Andy Wingo inline scm_cons, scm_car, scm_cdr * libguile/pairs.h (scm_cons, scm_car, scm_cdr): Define these as inline functions. (scm_is_pair): Move here from inline.h. * libguile/pairs.c: Remove definitions here, and define gsubrs. * libguile/inline.h: Remove scm_is_pair implementation. * libguile/inline.c: Include pairs.h to residualize inlines from pairs.h. 2012-05-17 Andy Wingo add guile-2.2 feature * module/ice-9/boot-9.scm (%cond-expand-features): Add guile-2.2 feature. 2012-05-15 Ludovic Courtès Add more `%file-port-name-canonicalization' tests. * test-suite/tests/ports.test ("%file-port-name-canonicalization")["relative canonicalization with /", "relative canonicalization from ice-9", "absolute canonicalization from ice-9"]: New tests. 2012-05-15 Ludovic Courtès Fix relative file name canonicalization with empty %LOAD-PATH entries. * libguile/filesys.c (scm_i_relativize_path): Don't attempt to canonicalize when encountering an entry of IN_PATH that is the empty string. * test-suite/tests/ports.test (with-load-path): New macro. ("%file-port-name-canonicalization"): New test prefix. 2012-05-15 Andy Wingo fix the cse tests * test-suite/tests/cse.test (pass-if-cse): Fix-letrec and canonicalize the output, so that unreferenced failure continuations get trimmed. ("cse"): Fix the two tests regarding bailout info. cse passes a lookup procedure to the effects analyzer * module/language/tree-il/cse.scm (cse): Arrange to pass a lookup procedure to compute-effects, for better effects analysis. better effects analysis for calls to lexically bound procedures * module/language/tree-il/effects.scm (make-effects-analyzer): The analyzer will take an optional second argument, a lookup procedure of type sym -> exp. This can let the analyzer dig into calls to lexically bound procedures. fix-letrec tweak * module/language/tree-il/fix-letrec.scm (make-sequence*, fix-letrec!): When turning unreferenced bindings into sequences, don't bother emitting trivially constant expressions in effect position. CSE in tail position * module/language/tree-il/cse.scm (singly-valued-expression?, cse): Allow CSE to propagate lexicals to tail positions, if the expression is singly-valued. 2012-05-15 Andy Wingo stronger conditional optimization * module/language/tree-il/peval.scm (peval): If we can lift one common test, see if we can lift others as well. * test-suite/tests/peval.test: Add a test. 2012-05-15 Andy Wingo optimization for chain of if expressions with common tests * module/language/tree-il/peval.scm (peval): Optimize common tests in chains of "if" expressions, like those generated by matchers. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2012-05-15 Andy Wingo mvoe tree-il=? and tree-il-hash to tree-il.scm * module/language/tree-il.scm (tree-il=?, tree-il-hash): Move these helpers here, from cse.scm. Export them. * module/language/tree-il/cse.scm (cse): Adapt accordingly. 2012-05-14 Ludovic Courtès Honor $(program_transform_name) for the `guile-tools' symlink. Fixes . Reported by Cyprien Nicolas . * meta/Makefile.am (install-data-hook): Honor $(program_transform_name). 2012-05-12 Ludovic Courtès Have `-Wformat' remain quiet for any procedure called `_' or `N_'. * module/language/tree-il/analyze.scm (proc-ref?)[special?]: New procedure. Return #t for any toplevel-ref of `_'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext as top-level _"): New test. 2012-05-12 Ludovic Courtès Have `-Warity-mismatch' handle applicable structs. * module/language/tree-il/analyze.scm (arity-analysis): Honor applicable structs. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("top-level applicable struct", "top-level applicable struct with wrong arguments"): New tests. 2012-05-12 Ludovic Courtès Improve special-casing of `_' in `-Wformat'. * module/language/tree-il/analyze.scm (proc-ref?): Check for SPECIAL-NAME in the and cases too. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext as module-ref _", "non-literal format string using gettext as lexical _"): New tests. 2012-05-11 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' fix more assumptions that the frame-procedure is a procedure * libguile/frames.c (scm_frame_source, scm_frame_previous): * libguile/stacks.c (scm_make_stack): * module/ice-9/boot-9.scm (exception-printers): * module/system/vm/frame.scm (frame-call-representation): Fix more assumptions that frame-procedure is a program, or even a procedure. 2012-05-10 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' into stable-2.0 Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: libguile/vm-engine.c libguile/vm-i-system.c libguile/vm.c 2012-05-10 Andy Wingo refactor vm application of non-programs; boot continuation refactor * libguile/frames.c (scm_frame_instruction_pointer): * module/system/vm/frame.scm (frame-bindings): (frame-next-source, frame-call-representation): Fix a few locations that thought that the frame-procedure will always be a VM procedure. This will not not be the case when traversing the stack of an application of a non-procedure. * libguile/vm-i-system.c (call, tail-call, mv-call): Instead of special-casing structs and smobs at these call sites, just set up the stack, and jump to a generic apply loop if the proc is not a program. * libguile/vm-engine.c: The generic apply loop is here. Also, the boot program is now simply a boot continuation, and can handle any number of arguments. * libguile/vm.c (make_boot_program): Update the code that makes the boot continuation. 2012-05-08 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/ports.c libguile/ports.h libguile/read.c libguile/vm-i-system.c 2012-05-08 Ludovic Courtès Add missing `SCM_API' for `scm_take_from_input_buffers'. * libguile/ports.h (scm_take_from_input_buffers): Add `SCM_API'. 2012-05-08 Ludovic Courtès Fix `setvbuf' to leave the line/column number unchanged. * libguile/fports.c (scm_setvbuf): Use `scm_take_from_input_buffers' directly instead of `scm_drain_input'; use `scm_unget_byte' instead of `scm_unread_string' to put the drained input back to PORT. This leaves PORT's line/column numbers unchanged, whereas they'd previously be decreased by the `scm_unread_string' call. * libguile/ports.c (scm_take_from_input_buffers): Update description and variable names to refer to "bytes", not "chars". * test-suite/tests/ports.test ("setvbuf"): New test prefix. 2012-05-08 Andy Wingo docbook->texi fix * module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Only convert ulink to uref if there is a URL attribute. 2012-05-07 Andy Wingo (texinfo docbook) support for @acronym * module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Recognize "acronym" as parsing to the @acronym texinfo command. 2012-05-07 Andy Wingo add support for texinfo parsed arguments, like @acronym * module/texinfo.scm (texi-command-specs): Add a new kind of texinfo command, inline-text-args, a sort of a cross between inline-args, which are unparsed, and inline-text, which is. Perhaps this should supersede inline-args at some point. In any case, add acronym as an inline-text-args element. (inline-content?, arguments->attlist, complete-start-command) (parse-inline-text-args, make-dom-parser): Adapt for inline-text-args. * module/texinfo/serialize.scm (inline-text-args): Add serialization for @acronym. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add some tests. 2012-05-07 Andy Wingo Add a missing SYNC_ALL in variable-ref * libguile/vm-i-system.c (variable-ref): Add a missing SYNC_ALL. 2012-05-07 Ludovic Courtès Optimize `scm_read_string'. According to the new benchmarks, this leads a 5% speed improvement when reading small strings, and a 27% improvement when reading large strings. * libguile/read.c (READER_STRING_BUFFER_SIZE): Change to 128; update comment to mention codepoints. (scm_read_string): Make `str' a list of strings, instead of a string. Store characters read in buffer `c_str'. Cons to STR when C_STR is full, and concatenate/reverse at the end. * benchmark-suite/benchmarks/read.bm (small, large): New variables. Set %DEFAULT-PORT-ENCODING to "UTF-8". ("read")["small strings", "large strings"]: New benchmarks. 2012-05-06 Ludovic Courtès Make `scm_unget_byte' public. * libguile/ports.h (scm_unget_byte): Make `SCM_API' instead of `SCM_INTERNAL'. read: Avoid `void *' pointer arithmetic. * libguile/read.c (read_complete_token): Make `new_buf' a `char *' to avoid pointer arithmetic on `void *'. Build with `-Wpointer-arith' when available. * configure.ac (POTENTIAL_GCC_CFLAGS): Add `-Wpointer-arith'. 2012-05-05 Ludovic Courtès Correct typing of assertion in the `wind' instruction. * libguile/vm-i-system.c (wind): Check `scm_to_bool (scm_thunk_p (x))' instead of `scm_thunk_p'. 2012-05-04 Ludovic Courtès Simplify the reader's `read_complete_token'. * libguile/read.c (read_token): Remove unneeded `const' before `size_t'. (read_complete_token): Remove `overflow_buffer' parameter; return `char *' instead of `int'. Allocate the overflow buffer with `scm_gc_malloc_pointerless' instead of `scm_malloc'. Return either the overflow buffer or BUFFER. (scm_read_number, scm_read_mixed_case_symbol, scm_read_number_and_radix): Rename `buffer' to `local_buffer', and `overflow_buffer' to `buffer'. Remove `overflow'. Adjust code to new `read_complete_token'. 2012-04-30 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/vm-engine.c libguile/vm-i-system.c 2012-04-30 Andy Wingo push error handlers out of line in the vm * libguile/vm.c: (vm_error): (vm_error_bad_instruction): (vm_error_unbound): (vm_error_unbound_fluid): (vm_error_not_a_variable): (vm_error_not_a_thunk): (vm_error_apply_to_non_list): (vm_error_kwargs_length_not_even): (vm_error_kwargs_invalid_keyword): (vm_error_kwargs_unrecognized_keyword): (vm_error_too_many_args): (vm_error_wrong_num_args): (vm_error_wrong_type_apply): (vm_error_stack_overflow): (vm_error_stack_underflow): (vm_error_improper_list): (vm_error_not_a_pair): (vm_error_not_a_bytevector): (vm_error_not_a_struct): (vm_error_no_values): (vm_error_not_enough_values): (vm_error_continuation_not_rewindable): (vm_error_bad_wide_string_length): (vm_error_invalid_address): (vm_error_object): (vm_error_free_variable): New internal helpers, implementing VM error handling. * libguile/vm-engine.h (VM_ASSERT): New helper macro. (ASSERT, CHECK_OBJECT, CHECK_FREE_VARIABLE): (PRE_CHECK_UNDERFLOW, PUSH_LIST): Use the new helper. * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Use VM_ASSERT and the out-of-line error handlers. * libguile/vm-engine.c (vm_engine): Remove inline error handlers, and remove a couple of local vars. Use VM_ASSERT. Have halt handle the return itself. 2012-04-30 Andy Wingo add internal SCM_NOINLINE definition * libguile/_scm.h (SCM_NOINLINE): New internal define, for things that we definitely don't want the compiler to inline. add scm_c_values helper * libguile/values.h: * libguile/values.c (scm_c_values): New public helper. fix peval test for recent merge * test-suite/tests/peval.test: Fix test for master. 2012-04-26 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: test-suite/tests/cse.test Merge commit 'f66cbb99ee096186837536885d3436bb334df34d' Merge commit '1cd63115be7a25d0ea18aaa0e1eff5658d8db77a' Conflicts: module/language/tree-il/peval.scm test-suite/tests/peval.test Merge commit 'de1eb420a5a95b17e85b19c4d98c869036e9ecb0' Conflicts: module/language/tree-il/primitives.scm test-suite/tests/tree-il.test Merge commit 'd10f7b572c0ca1ccef87f9c46069daa30946e0cf' Conflicts: libguile/smob.c libguile/smob.h test-suite/tests/tree-il.test 2012-04-24 Noah Lavine Clean up stack tests * test-suite/tests/eval.test: remove duplicate code. make-stack handles prompt tags better * libguile/stacks.c: update make-stack and narrow_stack to handle prompt tags that are not symbols. * test-suite/tests/eval.test: add tests for trimming a stack with a prompt tag. 2012-04-23 Andy Wingo vlist performance improvements; allocate vhash data inline * module/ice-9/vlist.scm (make-block): If we are making a hash table, allocate it inline with the contents. Otherwise don't even add a pointer to the block. (block-hash-table?): New internal accessor. (block-ref*): Remove. Vhash entries are no longer wrapped. (block-ref): (block-hash-table-next-offset): (block-hash-table-set-next-offset!): (block-hash-table-ref): (block-hash-table-set!): (block-hash-table-add!): Adapt to take content vector explicitly, and to expect the hash table inline with the contents. Some of these accessors are new. Adapt callers. (assert-vlist): New helper. (vlist-cons): Update comment. (vhash?): Update scheme to allocate the hash table and chain links inline with the contents. (%vhash-fold*, %vhash-assoc): Rewrite to be more performant. 2012-04-23 Andy Wingo avoid emitting degenerate aliases in peval * module/language/tree-il/peval.scm (, make-operand) (make-bound-operands, peval): Avoid emitting needless aliases in degenerate cases of let. (visit-operand): If we visit an operand with a fresh counter and have to abort, record that fact. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2012-04-23 Andy Wingo vlist-cons micro-optimizations * module/ice-9/vlist.scm (set-block-next-free!): Define this instead of increment-block-next-free!. (block-append!): Refactor to take an offset, and only append if the offset is the next free value, and there is space in the block. (block-cons): Refactor to not be a loop. The partial evaluator would have to understand effects analysis in order to be able to unroll it, and there's at most one recursion. Recovers the performance loss resulting from the previous commit. 2012-04-23 Andy Wingo slight vlist refactor * module/ice-9/vlist.scm: Use define-inlinable instead of define-inline, to ensure strict argument evaluation. There is a slight performance penalty, but I hope subsequent hacks make it up. 2012-04-23 Andy Wingo new pass: cse * module/language/tree-il/cse.scm: New pass, some simple common subexpression elimination with effects analysis. * test-suite/tests/cse.test: New test. * test-suite/Makefile.am: * module/Makefile.am: Adapt. 2012-04-23 Andy Wingo minor tweaks to a peval test * test-suite/tests/peval.test: Update mutable var test to really ensure that the function can't inline. 2012-04-23 Andy Wingo fix replacement of CSE with lexical-ref * module/language/tree-il/cse.scm (cse): Fix dominator unrolling for lexical propagation. * test-suite/tests/cse.test ("cse"): Add test. 2012-04-23 Andy Wingo peval uses effects analysis * module/language/tree-il/peval.scm: Use effects analysis from (language tree-il effects) instead of our own constant-expression?. Eagerly mark assigned lexicals as non-copyable. cse hashing tweak * module/language/tree-il/cse.scm (cse): Minor tweak to hash depth based on time profile of compiling peval.scm. more inlining in effects.scm * module/language/tree-il/effects.scm (define-effects) (&no-effects, &all-effects-but-bailout): (cause, &depends-on, &causes, depends-on-effects?) (causes-effects?, effects-commute?): Add ham-fisted inlining. better primitives support for bit operations * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add lognot. (*effect-free-primitives*): Add ash, logand, logior, logxor, and lognot. (logior, logand): Define associative expanders. disable optimizations in goops dispatch procedures * module/oop/goops/dispatch.scm: Disable peval and cse. 2012-04-23 Andy Wingo enable cse * module/language/tree-il/optimize.scm: Enable CSE unless #:cse? #f is passed. * test-suite/tests/tree-il.test: Disable CSE for one test. 2012-04-23 Andy Wingo add effects * module/language/tree-il/effects.scm: New module, for effects analysis. * module/Makefile.am: Adapt. 2012-04-23 Andy Wingo peval tests into separate file * test-suite/tests/tree-il.test ("partial evaluation"): * test-suite/tests/peval.test ("partial evaluation"): Separate peval * tests. * test-suite/Makefile.am: Adapt. 2012-04-23 Andy Wingo add more primitives and predicates to (language tree-il primitives) * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add number? and char?. Add more numeric predicates. Add character comparators. Add throw, error, and scm-error. (*primitive-accessors*): Remove struct-vtable. Though the vtable's contents may change (through redefinition), its identity does not change. (*effect-free-primitives*): Put struct-vtable, number?, and char? here. (*multiply-valued-primitives*): Instead of listing singly-valued primitives, list multiply-valued primitives. (*bailout-primitives*): New list. (*negatable-primitives*): New alist. (*bailout-primitive-table*, *multiply-valued-primitive-table*) (*negatable-primitive-table*): New tables. (singly-valued-primitive?): Adapt to use *multiply-valued-primitive-table*. (bailout-primitive?, negate-primitive): New exported procedures. 2012-04-23 Andy Wingo move (test-suite lib) to lower dir; cleans up uninstalled paths. * check-guile.in: * test-suite/Makefile.am: * test-suite/test-suite/lib.scm: * benchmark-guile.in: * benchmark-suite/Makefile.am: * benchmark-suite/benchmark-suite/lib.scm: Lower the lib modules in the source tree. This lets us remove top_srcdir and top_builddir from the uninstalled paths. * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/brainfuck.test: * test-suite/tests/compiler.test: * test-suite/tests/ftw.test: * test-suite/tests/gc.test: * test-suite/tests/match.test: * test-suite/tests/rnrs-libraries.test: * test-suite/tests/rnrs-test-a.scm: * test-suite/tests/sxml.match.test: Adapt to not expect that module names be prefixed with "test-suite". 2012-04-23 Andy Wingo modernize (benchmark-suite lib) * benchmark-suite/benchmark-suite/lib.scm: Rewrite to be more modern, using parameters, records, and higher precision timers. Since this file was never installed, this is an acceptable interface change. (run-benchmark): Run the thunk once before going into the benchmark. Adapt to new `report' interface. (report): Change to expect only one argument, a object. (print-result): Adapt. The result is in the same format as before. (print-user-result): Adapt. The result is different from before, but as this is just printed on stdout and not logged, there should be no problem. (calibrate-benchmark-framework): Pull initialization into a function. avoid inexact iteration count in benchmarks * benchmark-suite/benchmarks/arithmetic.bm: * benchmark-suite/benchmarks/r6rs-arithmetic.bm: Use #e1e7 for the iteration count, instead of the flonum 1e7. 2012-04-22 Ludovic Courtès Thank Klaus. 2012-04-22 Ludovic Courtès bytevectors: Fix IEEE-754 endianness conversion. Fixes . Reported by Klaus Stehle . * libguile/ieee-754.h: Remove. * libguile/Makefile.am (noinst_HEADERS): Remove `ieee-754.h'. * libguile/bytevectors.c (scm_ieee754_float, scm_ieee754_double): New unions. (float_to_foreign_endianness, float_from_foreign_endianness, double_to_foreign_endianness, double_from_foreign_endianness): Rewrite in terms of the new unions. * test-suite/tests/bytevectors.test ("2.8 Operations on IEEE-754 Representations")["single, little endian", "single, big endian", "double, little endian", "double, big endian"]: New tests. 2012-04-22 Ludovic Courtès Fix and clarify documentation of `sorted?'. Fixed . Reported by Alexei Matveev . * libguile/sort.c (scm_sorted_p): Fix and clarify docstring. * doc/ref/api-utility.texi (Sorting): Update accordingly. 2012-04-22 Ludovic Courtès Remove duplicate test in `tree-il.test'. * test-suite/tests/tree-il.test ("partial evaluation"): Remove duplicate test for `(cons 0 (cons 1 (cons 2 (list 3 4 5))))'. 2012-04-12 Ludovic Courtès Avoid use of `GC_PTR' in "smob.h". Commit c46fee438cf9f4a3449e8d04e7a54805517fd092 removed the "bdw-gc.h" include from "smob.h", so better avoid `GC_PTR'. * libguile/smob.c (scm_i_finalize_smob): Use `void *' instead of `GC_PTR'. * libguile/smob.h (scm_i_finalize_smob): Update declaration accordingly. 2012-04-10 Ludovic Courtès SRFI-9: Set the `record-constructor' slot of the RTD. Fixed . Reported by Klaus Stehle . * module/srfi/srfi-9.scm (define-record-type): Define the contructor before TYPE-NAME. Set RTD's constructor field. * test-suite/tests/srfi-9.test ("record compatibility"): New test prefix. 2012-04-05 Mark H Weaver Fix scm_to_utf8_stringn once and for all; optimize; add tests * libguile/strings.c (scm_to_utf8_stringn): Fix another new bug in this recent comedy of errors: pass the size of the preallocated buffer to u32_to_u8. Arrange to call 'scm_i_string_wide_chars' and 'scm_i_string_length' only once each. Rename local variables for improved code clarity. * test-suite/standalone/test-conversion.c (test_to_utf8_stringn): New function to test scm_to_utf8_stringn. 2012-04-03 Mark H Weaver Fix scm_to_utf8_stringn to NUL-terminate properly * libguile/strings.c (scm_to_utf8_stringn): NUL-terminate using the correct pointer. 2012-04-03 Mark H Weaver Fix scm_to_utf8_stringn to return the length in bytes, et al * libguile/strings.c (u32_u8_length_in_bytes): Internal static function renamed from u32_u8_strlen, whose name was potentially confusing. For added safety, handle everything that can be encoded in the more general UTF-8 encoding: up to six bytes for each code point, with code points up to 2^31-1. (scm_to_utf8_stringn): NUL-terminate only if (lenp == NULL). If (lenp != NULL) return the length in bytes in *lenp. 2012-04-01 Andy Wingo fix scm_to_utf8_stringn for wide strings to NUL-append the strings * libguile/strings.c (u32_u8_strlen, scm_to_utf8_stringn): Sigh, fix the u32-to-u8 optimization to ensure that the utf8 string is NUL-terminated. 2012-04-01 BT Templeton length's argument is a sequence * module/language/elisp/boot.el (length): Use `length' if the argument is a list or `generalized-vector-length' otherwise. 2012-03-26 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/procprop.c libguile/smob.c libguile/smob.h libguile/vm.c module/language/tree-il/primitives.scm 2012-03-24 BT Templeton primitive resolution for public refs * module/language/tree-il/primitives.scm (resolve-primitives!): Resolve public module-refs to primitives. * test-suite/tests/tree-il.test: New tests for primitive resolution. 2012-03-22 Andy Wingo add bad-request printer * module/web/request.scm (bad-request-printer): Add printer for these exceptions. add exception printers for bad-header, bad-header-component * module/web/http.scm (bad-header-component): Throw 'bad-header-component instead of 'bad-header. (bad-header-printer, bad-header-component-printer): Add exception printers. 2012-03-22 Andy Wingo micro-optimizations to string-trim-both, and to (web http) * libguile/srfi-13.c (scm_string_trim, scm_string_trim_right) (scm_string_trim_both): Take the whitespace fast-path if the char_pred is scm_char_set_whitespace. * module/web/http.scm (read-header, split-and-trim, parse-quality-list): (parse-param-component, parse-credentials, "Content-Type"): (read-request-line, read-response-line): Use char-set:whitespace instead of char-whitespace?. It avoids recursing into the VM. 2012-03-18 Andy Wingo make applicable smob calls cheaper, and fix a memory leak * libguile/vm.c (prepare_smob_call): New helper. Now, instead of making a per-smob trampoline, we will shuffle the smob into the args and use a gsubr. This prevents a memory leak in which the trampolines, which were values in a weak-key table, were preventing the smobs from being collected. * libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob application mechanism. (smob-call): Remove this instruction. * libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode to apply_trampoline. * libguile/smob.c: Remove our own objcode trampolines in favor of using scm_c_make_gsubr. (scm_smob_prehistory): No more trampoline weak map. * libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob representation change. 2012-03-18 Andy Wingo fix to procedure-arity in previous patch * libguile/procprop.c (scm_i_procedure_arity): Fix infinite loop. 2012-03-18 Andy Wingo make applicable smob calls cheaper, and fix a memory leak * libguile/vm.c (prepare_smob_call): New helper. Now, instead of making a per-smob trampoline, we will shuffle the smob into the args and use a gsubr. This prevents a memory leak in which the trampolines, which were values in a weak-key table, were preventing the smobs from being collected. * libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob application mechanism. (smob-call): Remove this instruction. * libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode to apply_trampoline. * libguile/smob.c: Remove our own objcode trampolines in favor of using scm_c_make_gsubr. (scm_smob_prehistory): No more trampoline weak map. * libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob representation change. 2012-03-12 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Merge branch 'master' of git.sv.gnu.org:/srv/git/guile web http: fix Ma -> Mar * module/web/http.scm (write-date): Fix serialization of Mar. Oops. 2012-03-11 Andy Wingo fix bad-request-printer * module/web/request.scm (bad-request-printer): Fix printer to expect args as a list. Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: configure.ac add bad-request printer * module/web/request.scm (bad-request-printer): Add printer for these exceptions. web server http: 400 Bad Request on bad requests * module/web/server/http.scm (bad-request, http-read): If an exception is raised while reading a response, write out a 400 Bad Request response before closing the port. add exception printers for bad-header, bad-header-component * module/web/http.scm (bad-header-component): Throw 'bad-header-component instead of 'bad-header. (bad-header-printer, bad-header-component-printer): Add exception printers. 2012-03-08 Andy Wingo more libgc 7.1 compat * configure.ac: * libguile/gc.c (GC_set_finalize_on_demand): Check for this function, and shim if it isn't present. 2012-03-08 BT Templeton elisp rng * module/language/elisp/boot.el (random): New function. elisp i/o * module/language/elisp/boot.el (send-string-to-terminal) (read-from-minibuffer, prin1-to-string): New functions. elisp: symbol-name, intern * module/language/elisp/boot.el (symbol-name, intern): New functions. elisp: when, unless * module/language/elisp/boot.el (when, unless): New macros. elisp sequence functions * module/language/elisp/boot.el (nreverse, assoc, assq, rplaca, rplacd) (caar, cadr, cdar, cddr, dolist, stringp, string-equal, string=) (substring, upcase, downcase, string-match, make-vector, mapc, aref) (aset, concat): New functions. integerp, wholenump return nil for non-numbers * module/language/elisp/boot.el (integerp, wholenump): Call `integer?' before `exact?' so that these predicates return nil for non-numbers instead of signalling an error. 2012-03-08 Andy Wingo Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: configure.ac libguile/finalizers.c libguile/finalizers.h libguile/gc.c libguile/gc.h libguile/inline.c libguile/inline.h libguile/ports.c libguile/smob.c libguile/smob.h module/ice-9/deprecated.scm module/ice-9/r4rs.scm 2012-03-08 Andy Wingo run finalizers asynchronously in asyncs * libguile/finalizers.c: New excitement! We'll be running finalizers asynchronously, from asyncs. This will make it safer to allocate while holding a mutex. (GC_set_finalizer_notifier): Add back-compat shim. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. * libguile/threads.c (guilify_self_2): Run finalizers here if queue_finalizer_async happened to run during guilify_self_1. * configure.ac: Add check for GC_set_finalizer_notifier. 2012-03-08 Andy Wingo use the new finalizer helpers * libguile/foreign.c (scm_set_pointer_finalizer_x) * libguile/ports.c (finalize_port) * libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob) * libguile/struct.c (scm_i_alloc_struct) * libguile/numbers.c (make_bignum): Use the new API. 2012-03-08 Andy Wingo add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitator * libguile/finalizers.h: * libguile/finalizers.c: New files. * libguile.h: * libguile/Makefile.am: Add to build. 2012-03-08 Andy Wingo scm_new_smob, scm_new_double_smob inline functions * libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors, which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline functions instead of macros. They also bail to scm_i_new_smob / scm_i_new_double_smob in either the mark or the free case, so that the inline definition doesn't reference other internal details like libgc stuff. (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see them as already being declared. (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2): (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new inline functions. Remove now-unneeded bdw-gc include. * libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and make static. (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators. (scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add back-compatibility shims to preserve ABI. * libguile/inline.c: Include smob.h, so as to reify scm_new_smob and scm_new_double_smob. 2012-03-08 Andy Wingo scm_cell, scm_double_cell, scm_words back to gc.h * libguile/inline.h: * libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move declarations and definitions back here, from inline.h. It's more natural. * libguile/inline.c: Include gc.h as well. 2012-03-08 Andy Wingo simplify inline function infrastructure * libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here, from inline.h. We'd like to support inline function definitions in more header files: not just inline.h. (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New definitions. * libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these wrappers, which redirect to the GC_MALLOC macros when building Guile, and the scm_gc_malloc functions otherwise. A step towards getting BDW-GC out of Guile's API. * libguile/inline.h: Simplify, using SCM_INLINE, SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the new SCM_GC_MALLOC macros. 2012-03-08 Ian Price Fix flush on soft ports, so that it actually runs. * libguile/vports.c (sf_flush): Remove conditional testing the position in the port's write_buf, as it is no longer used. 2012-03-07 Ludovic Courtès Change `scm_words' to accept a 32-bit word number. Fixes . Reported by Tobias Brandt . * libguile/gc.h (scm_words): Change `n_words' to be `scm_t_uint32'. * libguile/inline.h: Update extraneous declaration. 2012-03-07 Ludovic Courtès Improve port benchmark. * benchmark-suite/benchmarks/ports.bm (sequence): New macro, formerly local to the "rdelim" benchmark prefix. (large-string): New procedure. (%latin1-port, %utf8/ascii-port, %utf8/wide-port): Use it. ("peek-char", "char-ready?", "read-char"): Use `sequence'. 2012-03-07 Giuseppe Scrivano Fix a segfault when /dev/urandom is not accessible * libguile/init.c (scm_i_init_guile): Call `scm_init_random' before `scm_init_macros'. 2012-03-07 Andy Wingo faster (make-prompt-tag); default-prompt-tag is a parameter * module/ice-9/boot-9.scm (default-prompt-tag): Once parameters have booted, redefine as a parameter. (make-prompt-tag): Change from a gensym to a list. Thanks to Mark Weaver for the suggestion. * doc/ref/api-control.texi (Prompt Primitives): Update docs. 2012-03-07 Andy Wingo call-with-{input,output}-string implemented in scheme * module/ice-9/boot-9.scm (call-with-input-string) (call-with-output-string): Implement in Scheme. * libguile/strports.c (scm_call_with_output_string): (scm_call_with_input_string): Dispatch to Scheme. 2012-03-07 Andy Wingo micro-optimizations to string-trim-both, and to (web http) * libguile/srfi-13.c (scm_string_trim, scm_string_trim_right) (scm_string_trim_both): Take the whitespace fast-path if the char_pred is scm_char_set_whitespace. * module/web/http.scm (read-header, split-and-trim, parse-quality-list): (parse-param-component, parse-credentials, "Content-Type"): (read-request-line, read-response-line): Use char-set:whitespace instead of char-whitespace?. It avoids recursing into the VM. 2012-03-07 Andy Wingo names of encodings are ascii * libguile/ports.c (scm_mode_bits): Parse the mode bits as latin1. (scm_i_set_default_port_encoding, open_iconv_descriptors) (scm_port_encoding, scm_set_port_encoding_x): Restrict the names of encodings to ASCII. 2012-03-07 Andy Wingo dynstack: pushing a prompt no longer allocates memory * libguile/control.h: Remove scm_t_prompt_registers and scm_c_make_prompt_registers. (scm_c_abort): Take a pointer to a jmpbuf instead of a cookie. It will serve the same purpose. * libguile/control.c (reify_partial_continuation, scm_at_abort): Adapt to new prompt representation. * libguile/dynstack.h: * libguile/dynstack.c (scm_dynstack_push_prompt): Prompts now have 5 words instead of 2, as they now push the fp, sp, ip, and jmpbuf on the stack separately. This avoids allocation. (scm_dynstack_find_prompt): Likewise, add return values for fp, sp, etc. (scm_dynstack_wind_prompt): Replaces scm_dynstack_relocate_prompt. * libguile/eval.c (eval): * libguile/stacks.c (find_prompt): * libguile/throw.c (pre_init_catch): Adapt to the new prompt mechanism. * libguile/vm-engine.c (vm_engine): Setjmp an on-stack jmpbuf every time the VM enters. We can then re-use that jmpbuf for all prompts in that invocation. * libguile/vm-i-system.c (partial_cont_call): Adapt to change in prompt representation. We don't need to wind here any more, since we pass in the prompt's jmpbuf. (prompt): Adapt to scm_dynstack_push_prompt change. (abort): Adapt to vm_abort change. * libguile/vm.h (struct scm_vm): No more cookie. * libguile/vm.c (vm_abort): Adapt to scm_c_abort change. (vm_reinstate_partial_continuation): Rewind the dynamic stack here, now that we do have a valid jmpbuf. (make_vm): No need to initialize a cookie. 2012-03-06 Andy Wingo micro-optimization in (web server) * module/web/server.scm (extend-response): Micro-optimize to not mutate data, and to copy as little as possible. ports.c: inline get_codepoint * libguile/ports.c (get_codepoint): Add inline keyword. It showed up high in benchmarks, and it's static, so it's probably important to inline. 2012-03-06 Andy Wingo optimize symbol printing * libguile/print.h: Remove internal declaration of scm_i_print_symbol_name. * libguile/print.c (symbol_has_extended_read_syntax): Optimize to avoid calling symbol_to_string if we know the symbol cannot be mistaken for a number. (print_normal_symbol): Optimize to call display_string directly, instead of jumping through scm_display. (print_symbol): Rename from scm_i_print_symbol_name. (scm_print_symbol_name, iprin1): Adapt to print_symbol name change. 2012-03-06 Andy Wingo shuffle r4rs procedures into boot-9 * module/ice-9/boot-9.scm: Refine a comment about low-level port functions. Move call-with-foo-port, with-input-from-foo, etc later in the file, and define using `parameterize' instead of `dynamic-wind'. Somewhat cleaner, and avoids thunk? checks for "swaports" in the old implementation. load parameters earlier in boot-9 * module/ice-9/boot-9.scm: Move parameters earlier in the boot process. The new with-output-to-port code will use it. slight tweak to file-exists?, file-is-directory? * module/ice-9/boot-9.scm (file-exists?, file-is-directory?): For the fallback cases, use open-input-file instead of open-file with OPEN_READ. bootstrapping shenanigans in `warn' * module/ice-9/boot-9.scm (warn): Don't use with-output-to-port, as we'll move that definition after the psyntax boot. more clear comments in boot-9.scm * module/ice-9/boot-9.scm: Update comment header for language primitives. remove deprecated close-io-port * module/ice-9/boot-9.scm (close-io-port): Remove proc that was deprecated in 2.0. 2012-03-06 Andy Wingo inline ice-9/r4rs.scm into ice-9/boot-9.scm * module/ice-9/boot-9.scm: Inline r4rs.scm, in anticipation of more refactorings. * module/ice-9/r4rs.scm: Remove. * module/Makefile.am: Update. 2012-03-06 BT Templeton use #nil as default for elisp rest parameters * module/langauge/elisp/compile-tree-il.scm (compile-lambda): Bind the rest parameter to `#nil' instead of `()' by default. 2012-03-05 Andy Wingo deprecate close-io-port * module/ice-9/r4rs.scm: * module/ice-9/deprecated.scm (close-io-port): Deprecate. 2012-03-05 BT Templeton Merge branch 'bt/elisp' Conflicts: am/guilec libguile/_scm.h libguile/vm-i-scheme.c module/language/elisp/compile-tree-il.scm module/language/elisp/runtime.scm module/language/elisp/runtime/macros.scm module/language/tree-il/compile-glil.scm module/language/tree-il/primitives.scm 2012-03-05 Mark H Weaver Don't call SYMBOL_STRINGBUF on a string * libguile/strings.c (scm_i_make_symbol): Use STRING_STRINGBUF instead of SYMBOL_STRINGBUF to get the stringbuf of a string. Remove documentation of internal static string comparison functions * doc/ref/api-data.texi (String Comparison): Remove documentation for scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only internal functions but static, and thus unusable by external code. 2012-03-04 Mark H Weaver Comment out unused definitions of 'do' and 'case' in psyntax.scm * module/ice-9/psyntax.scm (do, case): Comment out these definitions, which are never used and immediately replaced by definitions in boot-9.scm. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-03-04 Mark H Weaver Fix syntax wrap comments; remove old unused cruft * module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new, rename-marks, make-rename): Remove these unused syntax rules. Fix description of syntax wraps to match current reality. Merge branch 'stable-2.0' Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il.scm 2012-03-04 Mark H Weaver Minimize size of embedded syntax objects in psyntax-pp.scm * module/ice-9/compile-psyntax.scm: Minimize syntax object literals embedded in psyntax-pp.scm. * module/ice-9/psyntax.scm: Rename a few variables so that syntax objects embedded in macros have no lexical bindings, so that their minimized syntax objects will have no embedded labels. These labels were the last remaining gensym counters in psyntax-pp.scm. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one quarter of its previous size! More importantly, this file no longer contains any gensym counters, which means that in the future, local changes to psyntax.scm will usually result in only local changes to psyntax-pp.scm. 2012-03-04 Mark H Weaver tree-il->scheme improvements * module/language/tree-il.scm (tree-il->scheme): New implementation that simply calls 'decompile-tree-il'. * module/language/scheme/decompile-tree-il.scm (choose-output-names, do-decompile): New internal procedures. (decompile-tree-il): New and improved implementation. Print source identifiers where possible, otherwise add minimal numeric suffixes. Previously we printed the gensyms. Avoid 'begin' in contexts that provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or', 'let*', named let, and internal defines where appropriate. Recognize keyword arguments in 'opts' to disable the production of these derived syntactic forms, and to optionally strip numeric suffixes from variable names. * module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec fixing, and primitive expansion when producing psyntax-pp.scm, in order to produce output as close to the original source as practical. Disable production of derived syntactic forms as needed during bootstrap. Strip numeric suffixes from variable names. Adjust pretty-printing parameters. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half of the original size. 2012-03-03 Andy Wingo optimize dynamic-wind when we know winders are thunks * libguile/vm-i-system.c (wind): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Instead of making `wind' call `scm_thunk_p' on the winder and unwinder at runtime, make it the responsibility of the compiler to emit code to call thunk? and error, but only if the compiler cannot prove them to be thunks. * libguile/vm-engine.c (vm_engine): Remove a now-unused error block. 2012-03-03 Andy Wingo remove out-of-date comment * libguile/dynwind.c (scm_dynwind_end): Remove out-of-date comment. 2012-03-03 Andy Wingo the dynamic stack is really a stack now, instead of a list * libguile/dynstack.h: * libguile/dynstack.c: New files, implementing the dynamic stack as a true stack instead of a linked list. This lowers the cost of dynwinds: frames, winders, prompts, with-fluids, and dynamic-wind. For the most part, we allocate these items directly on the stack. * libguile/dynwinds.h: * libguile/dynwinds.c: Adapt all manipulators of the wind stack to use interfaces from dynstack.c. Remove heap-allocated winder and frame object types. (scm_dowinds, scm_i_dowinds): Remove these. The first was exported, but it was not a public interface. * libguile/continuations.c: * libguile/continuations.h (scm_t_contregs): Continuation objects reference scm_t_dynstack* values now. Adapt to the new interfaces. * libguile/control.c: * libguile/control.h: There is no longer a scm_tc7_prompt kind of object that can be allocated on the heap. Instead, the prompt flags, key, and registers are pushed on the dynwind stack. (The registers are still on the heap.) Also, since the vm_cont will reference the dynwinds, make the partial continuation stub take just one extra arg, instead of storing the intwinds separately in the object table. * libguile/fluids.c: * libguile/fluids.h: No more with-fluids objects; instead, the fluids go on the dynstack. The values still have to be on the heap, though. (scm_prepare_fluids, scm_swap_fluids): New internal functions, replacing scm_i_make_with_fluids and scm_i_swap_with_fluids. * libguile/print.c: Remove prompt and with-fluids printers. * libguile/tags.h: Revert prompt and with-fluids tc7 values to what they were before they were allocated. * libguile/vm-i-system.c (partial_cont_call): Just pop the vmcont, the intwinds will not be passed as a second arg. Rewind the dynamic stack from within the VM, so that any rewinder sees valid prompt entries. (call_cc, tail_call_cc): Adapt to pass the dynstack to scm_i_vm_capture_stack. (prompt, wind, unwind, wind_fluids, unwind_fluids): Adapt to the new interfaces. * libguile/vm.h (scm_i_capture_current_stack): Rename from scm_i_vm_capture_continuation. (scm_i_vm_capture_stack): Take a dynstack as an argument. * libguile/vm.c (vm_reinstate_partial_continuation): Don't wind here, as that could result in winders seeing invalid prompts. * libguile/eval.c: * libguile/root.c: * libguile/stacks.c: * libguile/threads.c: * libguile/threads.h: * libguile/throw.c: Adapt other users of dynwinds to use the dynstack. 2012-03-03 Mark H Weaver pretty-print: allow max-expr-width to be set; recognize more keywords * module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument '#:max-expr-width'. (generic-write): Add new argument 'max-expr-width'. Previously this was internally defined to the constant value 50. 2012-03-03 Mark H Weaver Fix typos in psyntax.scm * module/ice-9/psyntax.scm (gen-syntax-case): #'pad --> #'pat (define*): #'x --> #'id * module/ice-9/psyntax-pp.scm: Regenerate 2012-03-02 Andy Wingo comment formatting in ports.c * libguile/ports.c: Fix comment. 2012-03-02 Andy Wingo hash-set! on weak tables returns the value * libguile/weak-table.h: * libguile/weak-table.c (scm_weak_table_putq_x) (scm_weak_table_remq_x, scm_weak_table_clear_x) (scm_weak_table_for_each): Declare these as returning void instead of SCM. * libguile/hashtab.c (scm_hashq_set_x, scm_hashq_remove_x) (scm_hashv_set_x, scm_hashv_remove_x) (scm_hash_set_x, scm_hash_remove_x) (scm_hashx_set_x, scm_hashx_remove_x): (scm_hash_for_each): For weak tables, have the set! functions return the values, as they used to do. Have remove! functions return #f, indicating the lack of a handle. Shim around for-each to return unspecified, even though that wasn't yet a problem. * test-suite/tests/weaks.test: Add a test. 2012-03-02 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2012-03-02 Andy Wingo tweaks to -Wformat's gettext detection * module/language/tree-il/analyze.scm (proc-ref?): Change to use less false-if-exception and more variable-bound?. If a variable is present in the local module but not bound, assume that it is gettext if it has the right name. This is to allow for (define _ gettext). * test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example. 2012-03-02 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' There are a some failures currently: FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #) (#))) ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #) (#))) ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #) (#))) Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test 2012-03-02 Andy Wingo peval: inline applications of lambda to rest args * module/language/tree-il/peval.scm (peval): Add optimization to hoist the inner procedure out of e.g. (lambda args (apply (lambda ...) args)) This commit restores the ability to detect escape-only prompts at compile-time. * test-suite/tests/tree-il.test: Update test for prompt with a lambda, and add a specific test for lambda application. 2012-03-02 Andy Wingo tree-il: fix `canonicalize!' for prompts * module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in which the sense of `escape-only?' was reversed. We never saw this though, because for other reasons, no prompts were being identified as escape-only. more general treatment of call-with-prompt * module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't limit the call-with-prompt to transition to lambda expressions. Instead we can lexically bind the handler, and rely on peval to propagate a lambda expression. 2012-03-01 Mark H Weaver pmatch: always wrap with let, even if the expression appears atomic * module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even if the expression appears atomic, because in the presence of 'identifier-syntax', we cannot know what an atomic expression will later expand to. Also use '#:export-syntax' instead of '#:export' to export 'pmatch'. 2012-03-01 Mark H Weaver Fix vector-length when applied to other uniform vector types * module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm (define-bytevector-type): Fix definition of vector-length when applied to uniform vectors of different element sizes. Thanks to Tobias Brandt for reporting this bug. * test-suite/tests/srfi-4.test: Add tests. 2012-02-27 Ludovic Courtès Avoid failure when `format-analysis' stumbles upon unbound variables. * module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref' in `false-if-exception'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string with forward declaration"): New test. 2012-02-24 Andy Wingo port i/o optimizations for iso-8859-1 * libguile/ports.h (scm_t_port_encoding_mode): * libguile/ports.c (scm_c_make_port_with_encoding): (scm_i_set_port_encoding_x): Add special treatment for latin1 encoding. (get_latin1_codepoint, get_codepoint): Add latin1 fast-path. * libguile/print.c (display_string_as_latin1): Add latin1 fastpath. 2012-02-24 Andy Wingo fixes to threaded finalizers * libguile/finalizers.c (finalization_thread_proc): (run_finalization_thread): (start_finalization_thread): (stop_finalization_thread): Use pthreads + scm_with_guile instead of scm_spawn_thread, to avoid deadlocks. srfi-18 test fix * test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of an and. Before, they were not being run, for some reason I don't fully understand. slight cleanup to run-test * test-suite/lib.scm (run-test): Slight cleanup. srfi-18 cleanup * module/srfi/srfi-18.scm (with-exception-handler): (thread-join!, mutex-lock!, mutex-unlock!): Avoid useless invocations of `apply'. statically initialize the pthread mutex in fat mutexen * libguile/threads.c (make_fat_mutex): Remove smob free function. Because we use normal mutexen, we can just blit the mutex to initialize it. 2012-02-24 Andy Wingo run finalizers asynchronously (in asyncs and/or pthreads) * libguile/finalizers.c: New excitement! We'll be running finalizers in threads, if that's available. If it's not available, during early boot, we can run finalizers in asyncs. This will make it safer to allocate while holding a mutex. * libguile/posix.c (scm_fork): Shut down the finalizer thread before forking. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot and, if available, initialialize the finalizer thread at the very end. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. If you're calling this function, you probably want synchronous GC. 2012-02-24 Andy Wingo signal an error on multithreaded fork * libguile/posix.c (scm_fork): Signal an error if a `fork' is attempted after threads have been spawned. * test-suite/tests/00-socket.test: Moved here, from socket.test, so as to run before any threads are created. * test-suite/Makefile.am: Adapt. 2012-02-23 Andy Wingo remove atfork on revealed mutex in fports.c * libguile/fports.c: Remove atfork call. Revert "add pthread_atfork helpers to our threading shims" This reverts commit 2f745b64a1eb06e9e175a1b497d5270bebff9097. Revert "with a threaded guile, lock weak sets and tables during a fork" This reverts commit f609480611cfd1585409fd6b1b90beb730b026cf. Revert "install pthread_atfork handlers for guile's static mutexen" This reverts commit 6a97b1f93aace5c7c976aef51d36b3ae9cfd5630. Revert "wrap iconv_open / iconv_close with a lock to help in thread/fork issues" This reverts commit 8dfb7bbfd908ca883d0fdd0d868e13e6b20803ae. Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: module/language/tree-il/analyze.scm 2012-02-23 Andy Wingo rewrite open-process in C, for robustness * libguile/posix.c (scm_open_process): Rewrite in C, so as to avoid allocations and other calls that are not async-signal-safe. (scm_init_popen, scm_init_posix): Register popen extension. * module/ice-9/popen.scm: Load the popen extension, to get open-process. 2012-02-22 Andy Wingo microoptimizations in (web uri) * module/web/uri.scm (valid-host?): Micro-optimizations. add test for recent quick fix * test-suite/tests/web-uri.test ("string->uri"): Add test for string->uri with hosts beginning in digits. 2012-02-21 Andy Wingo quick fix the quick fix quick fix to uri parser * module/web/uri.scm: Quick fix to not throw an error on e.g. http://2012.jsconf.us. 2012-02-20 Noah Lavine Optimize Equality Primitives * module/language/tree-il/primitives.scm: add equality-primitive?, which is true for eq?, eqv?, and equal? * module/language/tree-il/peval.scm: if an equality primitive is applied to the same variable twice, fold it to #t * test-suite/tests/tree-il.test: add tests for pevaling equality primitives 2012-02-19 Ludovic Courtès Have `-Wformat' recognize `ngettext' calls. * module/language/tree-il/analyze.scm (gettext?): Rename to... (proc-ref?): ... this. Add `proc' and `special-name' parameters. (gettext?): Define in terms of `proc-ref?'. (ngettext?): New procedure. (const-fmt): Recognize `ngettext' calls. (format-analysis)[](check-format-args]: Check constant-but-non-string 2nd argument in the (not (const-fmt ...)) case. [check-simple-format-args]: Use `const-fmt'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using ngettext", "non-literal format string using ngettext as N_"): New tests. ("simple-format")["unsupported, ngettext"]: New test. 2012-02-19 Ludovic Courtès Have `-Wformat' better recognize the `gettext' procedure. Fixes . Reported by Bruno Haible . * module/language/tree-il/analyze.scm (gettext?): New procedure. (const-fmt): Add `env' parameter; update callers. Use `gettext?'. (format-analysis)[check-simple-format-args]: Actually support gettextized format strings. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext"): Use `gettext' as the procedure name. ("non-literal format string using gettext as _"): New test. ["simple-format"]("unsupported, gettext"): New test. 2012-02-19 Andy Wingo use the new finalizer helpers * libguile/foreign.c (scm_set_pointer_finalizer_x) * libguile/ports.c (finalize_port, scm_c_make_port_with_encoding) (open_iconv_descriptors) * libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob) * libguile/struct.c (scm_i_alloc_struct) * libguile/weak-set.c (weak_gc_finalizer) (scm_c_register_weak_gc_callback) * libguile/weak-table.c (scm_c_register_weak_gc_callback) (weak_gc_finalizer) * libguile/numbers.c (make_bignum): Use the new API. 2012-02-19 Andy Wingo add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitator * libguile/finalizers.h: * libguile/finalizers.c: New files. * libguile.h: * libguile/Makefile.am: Add to build. 2012-02-19 Andy Wingo better hysteresis in weak-set, weak-table * libguile/weak-set.c: * libguile/weak-table.c: Attempt to avoid bouncing between sizes when growing the vector causes elements to be removed from the set/table. tune default hash table sizes * libguile/modules.c: In my current image, there are 1790 bindings in the root module, which tips over to the next hash vector size, so declare that to prevent rehashing. * libguile/srcprop.c (scm_init_srcprop): Don't preallocate a big source_whash table, as we might not need it (if everything is compiled, for example). * module/ice-9/boot-9.scm (make-module): Don't preall-cate big hash tables for imported bindings. Instead trust that resizing works correctly. 2012-02-19 Andy Wingo move revealed-count mechanism to fports.c * libguile/fports.c (scm_revealed_count, scm_port_revealed) (scm_set_port_revealed_x, scm_adjust_port_revealed_x): Move these APIs here, and only operate on fports. To keep revealed ports alive, now we will just keep them in a data structure that the GC knows about -- a static list. * libguile/fports.h: Add revealed count to scm_t_fport, and move decls of revealed-count functions here. * libguile/ports.h: * libguile/ports.c: Adapt to change. Remove SCM_REVEALED and SCM_SETREVEALED; since they only apply to fports now, keeping them around would be inviting type errors. (finalize_port): We don't need to worry about resuscitating ports here. * libguile/init.c: Use the scm_set_port_revealed_x function to set the revealed counts on stream ports. 2012-02-19 Andy Wingo ice-9/poll optimization * module/ice-9/poll.scm (poll-set-add!): Use fileno instead of port->fdes, to avoid manipulating revealed counts. 2012-02-18 Ludovic Courtès Don't fail when locale env. vars specify a dot-less locale name. Fixes . Reported by Alírio Eyng . * gnulib-local/lib/localcharset.c.diff (environ_locale_charset): Change to set CODESET to "" when LOCALE lacks a dot. Return "ISO-8859-1" when CODESET is the empty string. * lib/localcharset.c: Update. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add `test-command-line-encoding2'. (TESTS): Likewise. * test-suite/standalone/test-command-line-encoding2: New file. 2012-02-17 Andy Wingo wrap iconv_open / iconv_close with a lock to help in thread/fork issues * libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8) (UTF_TO_STRING): * libguile/ports.c (open_iconv_descriptors, close_iconv_descriptors): * libguile/strings.c (scm_from_stringn, scm_to_stringn): Wrap operations that acquire and destroy iconv contexts with a mutex. While iconv is threadsafe, internally it uses a lock, and we need to make sure when we fork() that no one has that lock -- so we surround it with another one. Gross. install pthread_atfork handlers for guile's static mutexen * libguile/async.c: * libguile/deprecation.c: * libguile/fluids.c: * libguile/gc.c: * libguile/instructions.c: * libguile/ports.c: * libguile/posix.c: * libguile/strings.c: * libguile/threads.c: Use the SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX mechanism to lock a number of static mutexen. 2012-02-17 Andy Wingo add pthread_atfork helpers to our threading shims * libguile/null-threads.h: * libguile/pthread-threads.h (SCM_DEFINE_ATFORK_HANDLERS_FOR_MUTEX) (scm_i_pthread_atfork): Define a pthread_atfork shim, and a helper to declare procedures to lock and unlock a mutex. * libguile/threads.h (SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX): New macro, causes the snarfer to emit a pthread_atfork call to lock a mutex, if threads are enabled. 2012-02-17 Andy Wingo with a threaded guile, lock weak sets and tables during a fork * libguile/weak-set.c (make_weak_set): * libguile/weak-table.c (make_weak_table): If we have a threaded Guile, * keep a weak set (table) of weak sets (tables). Use this and the pthread_atfork mechanism to lock and unlock weak sets and weak tables during a fork(). * libguile/weak-set.h (scm_weak_set_prehistory): New internal API. * libguile/init.c: Add call to scm_weak_set_prehistory(). 2012-02-17 Andy Wingo Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: libguile/read.c libguile/srcprop.c module/ice-9/psyntax-pp.scm 2012-02-15 Andy Wingo remove deprecated features test * test-suite/tests/procprop.test ("procedure-arity"): Remove a test of deprecated features. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: module/ice-9/psyntax-pp.scm 2012-02-15 Mark H Weaver Add tests to verify that 'read' sets source properties when appropriate * test-suite/tests/srcprop.test (source properties): Add tests. 2012-02-15 Mark H Weaver Add support for source properties on non-immediate numbers * libguile/read.c (scm_read_number): Set source properties on non-immediate numbers if the 'positions' reader option is set. * doc/ref/api-debug.texi (Source Properties): Update manual. 2012-02-15 Mark H Weaver psyntax: access source properties for all supported objects * module/ice-9/psyntax.scm (decorate-source): Set source properties on any object that satisfies 'supports-source-properties?'. Previously we used 'pair?' as the predicate. (source-annotation): Apply 'source-properties' to _any_ kind of source expression, where previously only pairs were queried. If the argument is a syntax-object, apply the source-properties to the syntax-object's expression. In the peculiar case of a syntax-object whose expression is also a syntax-object: previously we would iterate, but with this commit we now call 'syntax-object-expression' only once. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-02-15 Mark H Weaver Add 'supports-source-properties?' predicate * libguile/srcprop.c (scm_supports_source_properties_p): New procedure. (supports_source_props): New static C function. * libguile/srcprop.h (scm_supports_source_properties_p): Add prototype. * doc/ref/api-debug.texi (Source Properties): Add documentation. 2012-02-15 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2012-02-15 Mark H Weaver Relax validation of source property accessors * libguile/srcprop.c (scm_source_properties, scm_source_property, scm_i_has_source_properties): Relax validation to allow _any_ object to be queried for source properties. 2012-02-15 Mark H Weaver syntax-violation: prefer 'subform' for source info, with 'form' as fallback * module/ice-9/psyntax.scm (syntax-violation): Look for source properties of 'subform' first. If 'subform' has none, 'form' is used. Previously, the source information of 'form' was used unless 'form' _itself_ was '#f', in which case 'subform' was used. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-02-15 Mark H Weaver Fix psyntax bugs that would cause bad source annotations * module/ice-9/psyntax.scm (rebuild-macro-output): Fix two bugs that would cause bogus source properties to be added to vectors and macro-introduced syntax objects. These bugs were masked by the limitation that only pairs can be decorated with source properties. Due to a typo, each vector in the macro output was decorated using the vector itself as its source. Due to accidental variable capture, each syntax-object introduced by the macro had its expression decorated with its own wrap-subst. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-02-15 Mark H Weaver Fix typo in comment in message.scm: 'know' to 'known' warning types * module/system/base/message.scm (%warning-types): Fix typo. 2012-02-14 Andy Wingo better handling for exceptions in close-port and port finalizers * libguile/fports.c (close_the_fd, fport_close): Arrange to always close the fd, even if the flush procedure throws an exception. Perhaps the port machinery should do this for us, though. Don't wrap the close call in SCM_SYSCALL, EINTR leaves the fd in an unspecified state. Don't bother freeing buffers, the collector will handle that; simply drop references via scm_port_non_buffer. * libguile/ports.c (do_free, finalize_port): Catch exceptions caused by the free procedure. Don't bother setting the stream to 0 at all. (scm_close_port): Ensure that exceptions thrown by the "close" procedure don't prevent the port from being marked as closed. 2012-02-14 Andy Wingo web server: fix spurious warning * module/web/server.scm (sanitize-response): Quick fix to the 304-has-no-body sanitizer. scm_from_stringn utf8 optimization * libguile/strings.c (scm_from_stringn): Optimize scm_from_stringn for utf-8. fix buggy scm_from_utf8_stringn (!) * libguile/strings.c (scm_from_utf8_stringn): Embarassingly, my scm_from_utf8_stringn implementation was buggy for non-ascii characters, since October (41d1d984). Fixed. Will be tested with the next patch. 2012-02-14 Andy Wingo ports: avoid adding port table entries and finalizers if possible * libguile/ports.h (scm_t_port_type_flags, scm_t_ptob_descriptor): Add flags to ptob descriptors. * libguile/ports.c (scm_set_port_flush): Set the SCM_PORT_TYPE_HAS_FLUSH flag here. (scm_c_make_port_with_encoding): Only add ports to the table if SCM_PORT_TYPE_HAS_FLUSH is set. Only add finalizers to ports if there is a free function. (scm_close_port): Inline scm_i_remove_port here. Only remove from the weak set if SCM_PORT_TYPE_HAS_FLUSH is set. (scm_set_port_revealed_x): Add a comment. 2012-02-14 Andy Wingo refactor port encoding modes: utf-8 and iconv * libguile/ports.h (struct scm_t_port): Add a flag for the port encoding mode: UTF8 or iconv. The iconv descriptors are now in a separate structure so that we can avoid attaching finalizers to the ports themselves, in some cases. * libguile/ports.c (scm_c_make_port_with_encoding): Init the encoding mode. (scm_i_remove_port): Adapt to call close_iconv_descriptors. (finalize_iconv_descriptors, open_iconv_descriptors): (close_iconv_descriptors): New infrastructure to manage iconv descriptors. (scm_i_port_iconv_descriptors): New internal helper. (scm_i_set_port_encoding_x): Use open_iconv_descriptors, if needed. (get_iconv_codepoint): Use pt->iconv_descriptors. (get_codepoint): Check the port encoding mode flags. * libguile/print.c (display_string_using_iconv): Use scm_i_port_iconv_descriptors. (display_string): Use pt->encoding_mode flag. 2012-02-14 Andy Wingo string ports simplification * libguile/strports.c (st_fill_input): Rename from stfill_buffer, and remove an unneeded scm_return_first_int. (st_resize_port): Minor variable renaming. (st_write): Keep read_pos updated to be the same as write_pos. If we need to resize, do so only once. (st_seek): No more need to flush. (st_truncate): Update read_pos here too. (scm_mkstrport): No need to flush here. (scm_strport_to_string): Just call scm_from_stringn; rely on it to detect the latin1 case. (scm_make_stptob): No more flush function. 2012-02-13 Andy Wingo weaks: move an allocation outside a critical section * libguile/weak-set.c (resize_set): * libguile/weak-table.c (resize_table): Drop the set/table lock while allocating the new vector. Fixes a bug in which a finalizer could recursively try to grab the port table lock. 2012-02-12 Mark H Weaver Fix manual: scm_foreign_to_bytevector to scm_pointer_to_bytevector * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix outdated function name: scm_foreign_to_bytevector to scm_pointer_to_bytevector. 2012-02-12 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2012-02-12 Andy Wingo web server: do not provide a response body where it is not permitted * module/web/response.scm (response-must-not-include-body?): New function. * doc/ref/web.texi: Doc the function. * module/web/server.scm (sanitize-response): Error if we have a body, but the response type does not permit a body. If we are responding to a HEAD request, silently drop the body. 2012-02-11 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' web server: print backtrace on errors when run in batch mode * module/web/server.scm (read-client, handle-request, write-client): When run in batch mode, give a full backtrace for errors. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/read.c test-suite/tests/tree-il.test 2012-02-10 Andy Wingo more efficient scm_string_to_utf8, scm_string_to_utf32 * libguile/bytevectors.c (scm_string_to_utf8): More efficient implementation. (scm_string_to_utf32): Likewise. more efficient scm_to_utf8_stringn, scm_to_utf32_stringn * libguile/strings.c (scm_to_utf8_stringn): More efficient implementation than calling scm_to_stringn. (scm_to_utf32_stringn): Likewise. 2012-02-08 Mark H Weaver Support => within case, and improve error messages for cond and case * module/ice-9/boot-9.scm (cond, case): Reimplement using syntax-case, with improved error messages and support for '=>' within 'case' as mandated by the R7RS. Add warnings for duplicate case datums and case datums that cannot be meaningfully compared using 'eqv?'. * module/system/base/message.scm (%warning-types): Add 'bad-case-datum' and 'duplicate-case-datum' warning types. * test-suite/tests/syntax.test (cond, case): Update tests to reflect improved error reporting. Add tests for '=>' within 'case'. * test-suite/tests/tree-il.test (partial evaluation): Update tests to reflect changes in how 'case' is expanded. * doc/ref/api-control.texi (Conditionals): Document '=>' within 'case'. 2012-02-08 Mark H Weaver Add source properties to many more types of data * libguile/read.c (scm_read_array): New internal helper that calls scm_i_read_array and sets its source property if the 'positions' reader option is set. (scm_read_string): Set source properties on strings if the 'positions' reader option is set. (scm_read_vector, scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bitvector, scm_read_sharp): Add new arguments for the 'line' and 'column' of the first character of the datum being read. Set source properties if the 'positions' reader option is set. (scm_read_expression): Pass 'line' and 'column' to scm_read_sharp. * doc/ref/api-debug.texi (Source Properties): Update manual. 2012-02-08 Mark H Weaver Unoptimize 'read' to return freshly allocated empty strings * libguile/read.c (scm_read_string): Return a freshly allocated string every time, even for empty strings. The motivation is to allow source properties to be added to all strings. Previously, the shared global 'scm_nullstr' was returned for empty strings. Note that empty strings still share a common global 'null_stringbuf'. * test-suite/tests/srfi-13.test (substring/shared): Fix tests to reflect the fact that empty string literals are no longer guaranteed to be 'eq?' to each other. 2012-02-08 Mark H Weaver Optimize empty substring case of scm_i_substring_copy * libguile/strings.c (scm_i_substring_copy): When asked to create an empty substring, use 'scm_i_make_string' to make use of its optimization for empty strings that reuses the global null_stringbuf. Add and use maybe_annotate_source helper in read.c * libguile/read.c (maybe_annotate_source): New static helper function. (scm_read_sexp, scm_read_quote, scm_read_syntax): Use 'maybe_annotate_source'. Remove inline and register attributes from read.c * libguile/read.c: Remove all 'inline' and 'register' attributes. Remove incorrect comment in read.c * libguile/read.c (scm_read_sharp): Remove incorrect comment that claims that scm_read_boolean might return a SRFI-4 vector. 2012-02-08 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' i18: avoid freelocale (NULL) * libguile/i18n.c (smob_locale_free): Don't freelocale (NULL). Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c 2012-02-05 Andy Wingo Fix --enable-debug-malloc * libguile/gc-malloc.c (do_realloc, do_calloc, do_gc_malloc) (do_gc_malloc_atomic, do_gc_realloc, do_gc_free): Wrap the allocators in helper methods. The non-GC allocators call scm_gc_register_allocation, and the GC allocators ensure that gc_malloc returns a nonzero value. (scm_realloc, scm_calloc): Allow NULL return for malloc(0). It is permitted by POSIX. Don't wrap in a SCM_SYSCALL; the only possible errno is ENOMEM. (scm_gc_malloc_pointerless, scm_gc_malloc, scm_gc_calloc): (scm_gc_realloc, scm_gc_free, scm_gc_strndump): Use the wrappers. Don't call the debug-malloc registrations and deregistrations, as it is neither mandatory nor advised to call scm_gc_free. Fixes compilation with debug-malloc. (scm_must_free): Don't scm_malloc_unregister. 2012-02-04 Ludovic Courtès i18n: Skips ~h `format' tests when digit grouping info is missing. * test-suite/tests/i18n.test ("format ~h"): Skip tests when `locale-digit-grouping' returns '(). 2012-02-04 BT Templeton function binding fixes * module/language/elisp/bindings.scm (bindings): Add `function-bindings' field. (make-bindings): Initialize the `function-bindings' field. (get-function-binding, with-function-bindings): New functions. (access-variable, reference-variable, set-variable!): Remove the `module' argument and only handle references to the value cell. All callers changed. Callers passing `function-slot' as the module changed to use the corresponding functions for the function cell instead. (access-function, reference-function, set-function!): New procedures. (compile-flet, compile-labels): Use `with-function-bindings' instead of `with-lexical-bindings'. 2012-02-04 BT Templeton sharpsign-colon for uninterned symbols * module/language/elisp/lexer.sm (lex): Add support for `#:' syntax for uninterned symbols. elisp I/O * module/language/elisp/boot.el (princ, print, terpri, format*): New functions. 2012-02-04 BT Templeton improve management of global special variables * module/language/elisp/bindings.scm (bindings): Remove `globals' field. (global?, mark-global!, map-globals): Remove. All callers changed. * module/language/elisp/compile-tree-il.scm (generate-ensure-global, ensuring-globals): Remove. All callers changed. (global?, ensure-globals!): New procedures. (bind-lexically?): Use new `global?'. (compile-lambda, compile-let, compile-let*): Use `ensure-globals!'. 2012-02-04 BT Templeton more lexical declarations * module/language/elisp/boot.el (condition-case, catch): Add `lexical' declarations in macro expansions. 2012-02-04 BT Templeton signal an error for uncaught throws * module/language/elisp/boot.el (%catch): New variable. (catch): Bind `%catch' to `t' during the evaluation of `body'. Call `throw' instead of signalling an exception directly. (throw): Signal a `no-catch' error if there is no `catch' to throw to. 2012-02-04 BT Templeton `catch' in terms of `condition-case' * module/language/elisp/boot.el (throw): Define an `error-conditions' property for this symbol. (catch): Define in terms of `condition-case' instead of using Guile exceptions directly. (throw): Signal a `throw' condition instead of throwing a Guile exception directly. 2012-02-04 BT Templeton standard error symbols * module/language/elisp/boot.el (error, wrong-type-argument, no-catch, invalid-function): Define `error-conditions' properties for these standard error symbols. `%plist-member' fix * module/language/elisp/boot.el (%plist-member): Use recursion to avoid using `catch' and `throw'. condition-case * module/language/elisp/boot.el (signal): Accept only two arguments, and throw an `elisp-condition' exception instead of an `elisp-error' exception. (condition-case): New macro. elisp `member' subrs * module/language/elisp/boot.el (%member, member, memql, memq): New functions. use `dynlet' for dynamic binding * module/language/elisp/compile-tree-il.scm (let-dynamic): Remove. All callers changed to use `dynlet' instead. inline `generate-let' and `generate-let*' * module/language/elisp/compile-tree-il.scm (generate-let, compile-let): Inline the former into the latter. (generate-let*, compile-let*): Likewise. define `flet' directly * module/language/elisp/compile-tree-il.scm (compile-flet): Compile `flet' directly instead of using `generate-let'. 2012-02-04 BT Templeton lexical binding macros * module/language/elisp/boot.el (lexical-let, lexical-let*): New macros. * module/language/elisp/compile-tree-il.scm (bind-lexically?): Remove the check for a `lexical' flag, since `lexical-let' and `lexical-let*' are no longer special operators. (compile-lexical-let, compile-lexical-let*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition. 2012-02-04 BT Templeton use `lexical' declarations in "boot.el" * module/language/elisp/boot.el (prog1, cond, or, catch): Use `let' with `lexical' declarations instead of `lexical-let'. (%plist-put): Use `let' instead of `lexical-let', since "boot.el" now uses lexical binding by default. 2012-02-04 BT Templeton elisp `while' macro * module/language/elisp/compile-tree-il.scm (compile-while): Remove. * module/language/elisp/boot.el (while): New macro. * module/language/elisp/runtime/function-slot.scm: Update module definition. 2012-02-04 BT Templeton elisp `labels' * module/language/elisp/compile-tree-il.scm (compile-labels): New special operator. * module/language/elisp/runtime/function-slot.scm: Update module definition. 2012-02-04 BT Templeton fix `flet' syntax * module/language/elisp/compile-tree-il.scm (process-let-bindings): Remove. (parse-let-binding, parse-flet-binding): New procedures. (generate-let, generate-let*): Now takes an association list mapping symbols to values for the `bindings' argument. (compile-let, compile-let*, compile-lexical-let) (compile-lexical-let*): Parse the bindings list with `parse-let-binding'. (compile-flet): Parse the bindings list with `parse-flet-binding'. 2012-02-04 BT Templeton elisp binding declarations * module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a new `decls' argument and check it for `lexical' declarations. Establish the same kind of binding whether or not a lexical binding for `sym' exists, whereas previously the presence of a lexical binding would cause newly-established bindings to be lexical bindings as well. (split-let-bindings): Remove. All callers changed. (generate-let, generate-let*, compile-lambda): Pass the declarations list to `bind-lexically?'. * test-suite/tests/elisp-compiler.test: Explicitly disable the lexical-binding mode. Add `lexical' declarations where necessary. 2012-02-04 BT Templeton declaration parsing * module/language/elisp/compile-tree-il.scm (parse-body-1, parse-body) (parse-lambda-body, parse-declaration): New procedures. (generate-let, generate-let*): Use `parse-body'. (compile-lambda): Use `parse-lambda-body'. 2012-02-04 BT Templeton elisp lambda list parsing * module/language/elisp/compile-tree-il.scm (split-lambda-arguments): Remove. (parse-lambda-list, make-simple-lambda): New procedures. (compile-lambda): Use `parse-lambda-list' and `make-simple-lambda'. Set empty rest arguments to the empty list instead of `#nil'. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["rest argument"]: Use Elisp `null' instead of a Scheme equality check. 2012-02-04 BT Templeton elisp function subrs * module/language/elisp/boot.el (null, consp, listp, car, cdr) (make-symbol, signal): Use `%funcall' instead of `funcall' or `fset'. (symbolp, symbol-function, eval): Use `%funcall', since `funcall' now calls these functions. (functionp, %indirect-function): New functions. (funcall): Define in terms of `%funcall' and `%indirect-function'. (apply): New function. Previously defined in "module/language/elisp/runtime/subrs.scm". (fset): If `definition' is not a function, set the function cell of `symbol' to an falias for `definition'. * module/language/elisp/falias.scm: New file. * module/language/elisp/subrs.scm: Remove file. (apply): Remove. Now defined in "boot.el". * module/language/elisp/runtime/function-slot.scm: Update module definition. * module/Makefile.am: Update. 2012-02-04 BT Templeton remove dynamic function binding * module/language/elisp/compile-tree-il.scm (find-operator): Assume that `name' is lexically bound. * module/language/elisp/runtime.scm (symbol-fbound?, fmakunbound!): Assume that `symbol' is lexically bound. (defspecial): Bind special operators lexically. elisp nil equality * module/language/elisp/boot.el (eq, equal): Return `#t' if both arguments are nil. (eql): New function. use lexical binding in boot.el * module/language/elisp/boot.el: Use lexical binding. remove unused code * module/language/elisp/compile-tree-il.scm (runtime-error): Remove. * module/language/elisp/runtime.scm (macro-error, runtime-error, elisp-bool, prim): Remove. new elisp special form `%funcall' * module/language/elisp/compile-tree-il.scm (compile-%funcall): New procedure. * module/language/elisp/runtime/function-slot.scm: Update module definition. rewrite `eval' and `load' in elisp * module/language/elisp/subrs.scm (eval, load): Rewrite in Elisp and move to... * module/language/elisp/boot.el (eval, load): ...here. 2012-02-04 BT Templeton evaluate the function position correctly * module/language/elisp/compile-tree-il (compile-pair): Use `function' to perform functional evaluation. Previously, if the operator of a compound form was not a symbol, the operator would be evaluated as a normal expression. This happened to work only because there is a `lambda' macro. The compiler will now signal an error if the operator is neither a function name nor a lambda expression. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional argument"]: Remove an erroneous use of `function' in the function position. 2012-02-04 BT Templeton purify elisp symbol cell modules * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/value-slot.scm: Define these as pure modules. 2012-02-04 BT Templeton record elisp function names * language/elisp/compile-tree-il.scm (compile-lambda): Add a `meta' argument for the procedure's properties. (compile-function, compile-defmacro, compile-defun): Update accordingly, passing a `name' property to `compile-lambda' where possible. 2012-02-04 BT Templeton elisp variable aliases * module/language/elisp/boot.el (defvaralias): New function. 2012-02-04 BT Templeton simplify elisp symbol accessors * module/language/elisp/boot.el (fset, symbol-value, symbol-function) (set, makunbound, fmakunbound, boundp, fboundp): Use procedures in `(language elisp runtime)'. (symbolp): New function. * module/language/elisp/compile-tree-il.scm (set-variable!): Use `set-symbol-function!'. * module/language/elisp/runtime.scm (reference-variable, set-variable!): Remove. (symbol-fluid, set-symbol-fluid!): New procedure. (symbol-value, set-symbol-value!, symbol-function) (set-symbol-function!, symbol-bound?, symbol-fbound?, makunbound!) (fmakunbound!): Moved from `(language elisp subrs)' and updated to avoid using `reference-variable' and `set-variable!'. * module/language/elisp/runtime/subrs.scm (symbol-value) (symbol-function, set, fset, makunbound, fmakunbound, boundp) (fboundp): Move to `(language elisp runtime)'. (apply): Use `symbol-function'. 2012-02-04 BT Templeton elisp property lists * module/language/elisp/boot.el (%plist-member, %plist-get, %plist-put) (plist-get, plist-put, plist-member, lax-plist-get, lax-plist-put) (symbol-plist, setplist, get, put): New functions. (plist-function): New variable. simplify `mark-global!' * module/language/elisp/bindings.scm (mark-global!): Use `lset-adjoin'. remove `flet*' elisp special form * module/language/elisp/compile-tree-il.scm (compile-flet*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["flet and flet*"]: Remove `flet*' test. remove `with-always-lexical' elisp special form * module/language/elisp/compile-tree-il.scm: (always-lexical): Remove. All uses changed. (with-added-symbols): Remove. (compile-with-always-lexical): Remove. (process-options!): Remove support for the `#:always-lexical' option. * module/language/elisp/runtime/function-slot.scm: Update import and re-export lists. * test-suite/tests/elisp-compiler.test: Remove or update tests using `with-always-lexical'. emacs-compatible lexical binding * module/language/elisp/bindings.scm (global?): New function. * module/language/elisp/compile-tree-il.scm (lexical-binding): New variable. (bind-lexically?): If lexical binding is enabled, bind lexically unless a special binding exists. (compile-%set-lexical-binding-mode): New function. * module/language/elisp/lexer.scm (lexical-binding-regexp): New variable. (lex): Return a `set-lexical-binding-mode!' token if a comment is found while reading the first line. * module/language/elisp/parser.scm (get-expression): Add support for `set-lexical-binding-mode!' tokens. * module/language/elisp/runtime/function-slot.scm: Import and re-export the `%set-lexical-binding-mode' special form. * test-suite/tests/elisp-compiler.test ("Let and Let*")["lambda args inside lexical-let"]: Update. remove `bind-arg-lexical?' * module/language/elisp/compile-tree-il.scm (bind-arg-lexical?): Remove. All callers changed to use `bind-lexically?'. fix elisp `catch' * module/language/elisp/boot.el (catch): Only catch exceptions of type `elisp-exception'. implement `throw' in elisp * module/language/elisp/runtime/subrs.scm (throw): Rewrite in Elisp and move to... * module/language/elisp/boot.el (throw): ...here. rewrite `map-globals' * module/language/elisp/bindings.scm (map-globals): Use `append-map' and `map' instead of explicit iteration with named `let'. use srfi-9 for elisp bindings records * module/language/elisp/bindings.scm: Use `(srfi srfi-9)'. (bindings-type): Remove low-level record type definition and replace with... (bindings): ...this, an SRFI-9 record type. All uses changed. (mark-global-needed!): Rename to... (mark-global!): ...this. All callers changed. (map-globals-needed): Rename to... (map-globals): ...this. All callers changed. fix compilation of elisp forms with empty bodies * module/language/elisp/compile-tree-il.scm (generate-let) (generate-let*, compile-lambda, compile-with-added-symbols) (compile-progn, compile-if): Return nil if the form's body is empty. * test-suite/tests/elisp-compiler.test ("Sequencing")["empty progn"]: New test. ("Conditionals")["if with no else"]: New test. ("Let and Let*")["empty let, empty let*"]: New test. ("Lambda Expressions")["empty lambda"]: New test. rewrite elisp macros in elisp * module/language/elisp/runtime/macros.scm: Remove. (macro-lambda, macro-prog1, macro-prog2, macro-cond, macro-and, macro-or, macro-catch, macro-unwind-protect): Rewrite in Elisp and move to... * module/language/elisp/boot.el (lambda, prog1, prog2, cond, and, or, catch, unwind-protect): ...here. (eval-and-compile): New macro. (funcall, fset, null, consp, listp, car, cdr, make-symbol-signal): Wrap definitions in an `eval-and-compile' form so that they can be used by the rewritten macros. * module/language/elisp/runtime.scm: Remove `built-in-macro'. * module/language/elisp/Makefile.am: Remove module/language/elisp/runtime/macros.scm from `ELISP_LANG_SOURCES'. new elisp special form `eval-when-compile' * module/language/elisp/compile-tree-il.scm (compile-eval-when-compile): New function. * module/language/elisp/runtime/function-slot.scm: Update module definition. 2012-02-04 BT Templeton remove unnecessary elisp macros * module/language/elisp/runtime/macros.scm (when, unless, dotimes) (dolist, pop, push): Remove. (They are not special forms in Emacs.) * module/language/elisp/runtime/function-slot.scm: Update import and export lists. * test-suite/tests/elisp-compiler.test ("Conditionals")["failing when"] ["succeeding when", "failing unless", "succeeding unless"]: Remove. ("Iteration")["dotimes", "dolist"]: Remove. ("List Built-Ins")["pop", "push"]: Remove. 2012-02-04 BT Templeton elisp test fixes * test-suite/tests/elisp-compiler.test ("Exceptions")["catch and throw"]: Use a freshly-consed object instead of a literal object. This test previously assumed that similar literal objects are never identical, which no longer true. ("Equivalence Predifcates")["eq"]: Likewise. new `string' and `mapcar' elisp subrs * module/language/elisp/boot.el (string, mapcar): New functions. rewrite elisp subrs in elisp * module/language/elisp/runtime/subrs.scm (%, *, +, -, /=, 1+, 1-, <) (<=, =, >, >=, abs, append, atom, car, car-safe, cdr, cdr-safe, cons) (consp, eq, equal, fceiling, ffloor, float, floatp, fround, ftruncate) (funcall, integerp, length, list, listp, make-list, max, min, nlistp) (nth, nthcdr, null, numberp, reverse, setcar, setcdr, wholenump) (zerop): Rewrite in Elisp and move to... * module/language/elisp/boot.el: ...here. Some functions have stricter type checking, and `elisp-bool' is not currently used (so some predicate functions now return `#f' instead of `#nil'). (boundp, eval, fboundp, fmakunbound, fset, load, makunbound, set) (symbol-function, symbol-value, throw): New functions; they call their existing implementations in subrs.scm. (@): New macro. * module/language/elisp/runtime.scm (built-in-func): Remove. All uses changed. * module/language/elisp/runtime/function-slot.scm: Update module definition. 2012-02-04 BT Templeton remove unnecessary elisp subrs * module/language/elisp/runtime/subrs.scm (copy-tree, number-sequence): Remove. (They are not subrs in Emacs.) * test-suite/tests/elisp-compiler.test ("List Built-ins")["copy-tree", "number-sequence"]: Remove. 2012-02-04 BT Templeton `atomp' -> `atom' * module/language/elisp/runtime/subrs.scm (atomp) Rename to... (atom): ...this. All callers changed. use `nil?' for elisp conditionals * module/language/elisp/compile-tree-il.scm (compile-if): Use the `nil?' primitive for conditionals. 2012-02-04 BT Templeton add `nil?' primitive * libguile/boolean.c (scm_nil_p): New function. * libguile/vm-i-scheme.c (nilp, not_nilp): * libguile/vm-i-system.c (br_if_nil, br_if_not_nil): New instructions. Renumber other ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Increment. * module/language/assembly/compile-bytecode.scm (compile-bytecode): Add support for writing `br-if-nil' and `br-if-not-nil' instructions. * module/language/assembly/disassemble.scm (code-annotation): Add `br-if-nil' and `br-if-not-nil' to the list of branch instructions. * module/language/tree-il/compile-glil.scm: Add `nil?' to `*primcall-ops*'. (flatten): Use the new branch instructions for `nil?' conditionals. * module/language/tree-il/primitives.scm: Add `nil?' to `*interesting-primitive-names*', `*effect-free-primitives', and `*effect+exception-free-primitives*'. 2012-02-04 Andy Wingo fix check for when libc already has clock_gettime / clock_getcpuclockid * acinclude.m4 (gl_CLOCK_TIME): If both clock_gettime and clock_getcpuclockid are present without -lrt and -lposix4, don't add any libs to LIB_CLOCK_GETTIME. Thanks to taylanbarirli@gmail.com. 2012-02-04 Bake Timmons Improve consistency of definitions of C functions in manual. * doc/ref/api-compound.texi * doc/ref/api-evaluation.texi * doc/ref/api-foreign.texi * doc/ref/api-io.texi * doc/ref/posix.texi * doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions of C functions. * doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function with arguments not of SCM type. 2012-02-04 Andy Wingo fix compilation of control.c, continuations.c when SCM_ALIGNED is not defined * libguile/control.c: * libguile/continuations.c: Fix for the case in which SCM_ALIGNED is not defined. Though I wonder, perhaps we should just error out in those cases. 2012-02-04 Bake Timmons Make notation for Scheme repeated arguments more consistent in manual. * doc/ref/api-compound.texi * doc/ref/api-control.texi * doc/ref/api-data.texi * doc/ref/api-debug.texi * doc/ref/api-evaluation.texi * doc/ref/api-macros.texi * doc/ref/api-memory.texi * doc/ref/api-modules.texi * doc/ref/api-procedures.texi * doc/ref/api-regex.texi * doc/ref/api-scheduling.texi * doc/ref/api-utility.texi * doc/ref/goops.texi * doc/ref/match.texi * doc/ref/misc-modules.texi * doc/ref/posix.texi * doc/ref/r6rs.texi * doc/ref/scheme-using.texi * doc/ref/srfi-modules.texi * doc/ref/sxml-match.texi: Make notation for Scheme repeated arguments more consistent in manual. 2012-02-03 Ludovic Courtès i18n: Provide default values for when Gnulib has no replacement. This reverts parts of a0919aefee7512686c3374876df2c549fd47e071 ("i18n: Use Gnulib's `nl_langinfo' module."). * module/ice-9/i18n.scm (define-simple-langinfo-mapping): Re-add `default' parameter, and update users accordingly. 2012-02-03 Ludovic Courtès Augment `-Wformat' analysis with support for `~:h'. * module/language/tree-il/analyze.scm (format-string-argument-count): Add support for ~h. * test-suite/tests/tree-il.test ("warnings")["format"]("~h", "~:h with locale object", "~:h without locale object"): New tests. 2012-02-03 Ludovic Courtès format: Add specifier ~h for localized number output. * doc/ref/misc-modules.texi (Formatted Output): Document ~h. Recommend use of ~h instead of ~:d. * module/ice-9/format.scm (format): Add support for ~h. * test-suite/tests/format.test ("~h localized number"): New test prefix. * test-suite/tests/i18n.test (%american-english-locale-name, %american-english-locale): New variables. (under-american-english-locale-or-unresolved): New procedure. ("format ~h"): New test prefix. 2012-02-03 Ludovic Courtès i18n: Add a couple of tests for `monetary-amount->locale-string'. * test-suite/tests/i18n.test ("monetary-amount->locale-string"): New test prefix. 2012-02-03 Ludovic Courtès i18n: Use Gnulib's `nl_langinfo' module. * configure.ac: Remove checks for and , and `nl_langinfo'. * libguile/i18n.c: Remove #ifdefs for HAVE_LANGINFO_H, HAVE_NL_TYPES_H, HAVE_NL_ITEM, and HAVE_LANGINFO_CODESET. (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): Use `SCM_UNBNDP'. * m4/gnulib-cache.m4 (gl_MODULES): Add `nl_langinfo'. * module/ice-9/i18n.scm (define-vector-langinfo-mapping): Remove `defaults' parameter; assume (provided? 'nl-langinfo) is always true. Update users accordingly. (define-simple-langinfo-mapping): Likewise. (define-monetary-langinfo-mapping): Likewise, but do not assume LOCAL-ITEM and INTL-ITEM are always defined. 2012-02-03 Ludovic Courtès Use Gnulib's `regex' module. This should help with regex portability, as reported in for Darwin 8.11. * m4/gnulib-cache.m4 (gl_MODULES): Add `regex'. * configure.ac: Remove header checks for regex.h, rxposix.h, and rx/rxposix.h. Remove check for the `regcomp' function. Remove definition of `HAVE_REGCOMP'. Define `ENABLE_REGEX'. * libguile/init.c: Check for `ENABLE_REGEX' instead of `HAVE_REGCOMP'. * libguile/regex-posix.c: Always include . Remove #ifdefs for rxposix.h and co. 2012-02-03 Ludovic Courtès tests: Have `getaddrinfo' test work for Darwin 8. * doc/ref/posix.texi (Network Databases): Update description of `EAI_NODATA' to mention that Darwin provides it. * libguile/net_db.c (scm_getaddrinfo): Likewise. * test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]: Accept `EAI_NODATA' too. Reported by David Fang , see . 2012-02-03 Ludovic Courtès tests: Work around erroneous tr_TR locale in Darwin 8. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Add exception for Darwin 8. Reported by David Fang , see . 2012-02-03 Mike Gran Update srfi-14 test for Unicode 6.1 Some Latin-1 symbols have been reclassified as punctuation * test-suite/tests/srfi-14.test: updated 2012-02-03 Mark H Weaver Implement scm_to_pointer * libguile/foreign.c, libguile/foreign.h (scm_to_pointer): New C function. * test-suite/standalone/test-loose-ends.c: Add test. 2012-02-02 Andy Wingo revert r5rs changes * doc/r5rs/r5rs.texi: Reverts the recent changes to r5rs.texi. 2012-02-02 Ludovic Courtès Fix `SCM_I_ERROR' definition for MinGW without networking. * libguile/error.c (SCM_I_ERROR)[__MINGW32__]: Conditionalize on `HAVE_NETWORKING'. 2012-02-02 Bake Timmons Fix case in identifiers starting sentences in doc/r5rs/r5rs.texi * doc/r5rs/r5rs.texi: Use proper case of characters in identifiers starting sentences. Improve the usage of variable names in Scheme docstrings. * module/ice-9/boot-9.scm: * module/ice-9/popen.scm: * module/ice-9/pretty-print.scm: * module/ice-9/r4rs.scm: * module/rnrs/io/ports.scm: * module/texinfo/string-utils.scm: * module/web/http.scm: * module/web/request.scm: * module/web/response.scm: * test-suite/vm/run-vm-tests.scm: Make the variable names in Scheme docstrings more consistent. Replace a few instances of @var with @code when appropriate. Improve the usage of variable names in C docstrings. * libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate. 2012-02-02 Andy Wingo Remove unused doc/sources/ * doc/sources: Remove. It is not used at all, presumably because all it had to offer was already incorporated in the manual. 2012-02-02 Bake Timmons Make consistent the usage of variable names in the function definitions found in the Texinfo docs. * doc/r5rs/r5rs.texi: * doc/ref/api-compound.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-io.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/compiler.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/scheme-using.texi: * doc/ref/srfi-modules.texi: * doc/ref/vm.texi: * doc/ref/web.texi: * doc/sources/env.texi: Make usage of variable names of function definitions more consistent. Fix unbalanced parentheses in docs. * doc/ref/sxml-match.texi (sxml-match-let, sxml-match-let*): Remove extraneous parenthesis at end of Texinfo function definition header. 2012-02-02 Mike Gran Update srfi-14 character sets to Unicode 6.1 * libguile/srfi-14.i.c (cs_lower_case_ranges, cs_lower_case) (cs_upper_case_ranges, cs_upper_case, cs_letter_ranges, cs_letter) (cs_digit_ranges, cs_digit, cs_letter_plus_digit_ranges, cs_letter_plus_digit) (cs_graphic_ranges, cs_graphic, cs_printing_ranges, cs_printing) (cs_punctuation_ranges, cs_punctuation, cs_symbol_ranges, cs_symbol) (cs_designated_ranges, cs_designated): modified * doc/ref/api-data.texi: modified 2012-02-02 Mark H Weaver Fix search_path to fill stat_buf when given an absolute pathname * libguile/load.c (search_path): When the provided 'filename' is an absolute pathname, perform a 'stat' on that pathname to fill the 'stat_buf'. Previously, 'stat_buf' was left uninitialized in this case, even though 'scm_primitive_load_path' assumes that 'stat_buf' will be filled. Update the header comment to explicitly specify that 'stat_buf' will be filled. Also 'goto end' in a few failure cases instead of replicating its code. 2012-02-02 Andy Wingo leniency in the "unused modules are removed" gc.test * libguile/foreign.h: Remove comment about the finalizer bit, as I don't think that is the case any more. * test-suite/tests/gc.test: Ignore flakiness in the gc-modules test. 2012-01-31 Andy Wingo Revert "add SCM_HEAP_OBJECT_BASE" This reverts commit 47ed8656db8800f3ad20a40eb2c4e9ef3dc891e3. Conflicts: libguile/foreign.c 2012-01-31 Ludovic Courtès Augment `Libs.private' in `guile-2.0-uninstalled.pc'. Followup to 58f86505d658359508732c8f187bc37d010074d0 ("Augment `Libs.private' with for non-GNU platforms."). Reported by Eli Zaretskii . * meta/guile-2.0-uninstalled.pc.in (Libs): Add all the optional libraries, as done in commit 58f86505d658359508732c8f187bc37d010074d0. 2012-01-31 Andy Wingo an experiment: clearing the C stack in gc tests * test-suite/lib.scm (clear-stale-stack-references): New helper. * test-suite/tests/gc.test: * test-suite/tests/threads.test: Use the new helper. I removed the "unresolved" throw, as I'd like to see what the bots do with this. 2012-01-30 Ludovic Courtès Update `NEWS'. 2012-01-30 Ludovic Courtès Bump version number for 2.0.4/2.0.5. Version 2.0.4 was pushed with the version info of 2.0.3, which is incorrect. Version 2.0.5 fixes that. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions `scm_c_value_ref', `scm_call', etc. (LIBGUILE_INTERFACE_AGE): Increment. 2012-01-30 Ludovic Courtès Amend `NEWS'. * NEWS: Mention `-Wformat' change. Remove intermediate/minor bug fixes. Remove stale test file. * test-suite/tests/srfi-42.test: Delete "tmp1" at the end. doc: Add "warnings" to the concept index. * doc/ref/api-evaluation.texi (Compilation): Add "warnings" to the concept index. 2012-01-30 Andy Wingo "fix" local-eval for introduced toplevels * module/ice-9/local-eval.scm: Fix for introduced toplevel identifiers. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/debug.h module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm module/language/tree-il/peval.scm module/language/tree-il/primitives.scm Merge commit '3d51e57cfb0404db568a6adfde2a346d3fd9907e' Conflicts: libguile/foreign.c libguile/hashtab.c module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm Merge commit '9b0975f1dc41ddd10d81fb5b0965b9e9a54ef37a' Conflicts: libguile/foreign.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm fix hook invocation during thread guilification * libguile/gc.c (run_before_gc_c_hook): Don't run pre-GC hooks from a thread that is in the process of guilification. 2012-01-30 Mark H Weaver Rename scm_call_varargs -> scm_call * libguile/eval.c, libguile/eval.h, doc/ref/api-evaluation.texi, test-suite/standalone/test-loose-ends.c, NEWS: Rename scm_call_varargs -> scm_call Suggested by Ludovic Courtès 2012-01-30 Mark H Weaver Implement scm_call_varargs and scm_call_{7,8,9} * libguile/eval.c (scm_call_7, scm_call_8, scm_call_9, scm_call_varargs): New functions. * libguile/eval.h: Add prototypes. * doc/ref/api-evaluation.texi: Add documentation. * test-suite/standalone/test-loose-ends.c: Add tests. * NEWS: Add news entry. 2012-01-30 Mark H Weaver Fix primitive-eval to return # for definitions * module/ice-9/eval.scm (primitive-eval): Return # for definitions. Previously the variable object was returned. * test-suite/tests/eval.test (evaluator): Add test. * NEWS: Add news entry. 2012-01-30 Mark H Weaver Fix 'local-eval' when the specified environment is a module * module/ice-9/local-eval.scm (local-wrap): Fix the (module? e) case, to reference the expression 'x' instead of the non-existent variable 'exp', as was previously done. Also use quasisyntax instead of quasiquote, so that the introduced 'lambda' is an identifier instead of a bare symbol, so that this will work in modules that have rebound 'lambda' to something else. * test-suite/tests/eval.test (local-eval): Make sure to test both 'local-eval' and 'local-compile' when the specified environment is a module. 2012-01-30 Mark H Weaver Update user-visible copyright dates in manual and REPL to 2012 * doc/ref/guile.texi, module/system/repl/common.scm: Update user-visible copyright dates to 2012. 2012-01-30 Ludovic Courtès Augment `Libs.private' with for non-GNU platforms. Reported by Eli Zaretskii . * meta/guile-2.0.pc.in (Libs.private): Add all the optional libraries that may be pulled via Gnulib on non-GNU platforms. 2012-01-29 Andy Wingo paper over some "lexical vars are collectable" flakiness * test-suite/tests/gc.test ("gc"): Hack around flakiness in "lexical vars are collectable" on some architectures. 2012-01-29 Andy Wingo Revert "vm-i-scheme.c slight refactor" This reverts commit c0e4449908eee84bcb293ec21c10fec646bde45d. This refactor was needed for the introduction of DEAD(), which does not appear to have been necessary. 2012-01-29 Andy Wingo Revert "attempt to clear stale references on VM C stack" This reverts commit 04b2d773548c57b6eadd1808a8d15cce47af9630. Since it wasn't fixing the "lexical vars are collectable" test, it added complexity with no benefit. 2012-01-29 Ludovic Courtès Revert "Work around instruction reordering on SPARC and HPPA in the VM." This reverts commit 2b264d7e4fb649955ade1814527b6eb6f34f4e18, which is unnecessary after commit f5ea0499a411309014475dc7f7983e827f431af2 ("Build with `-fno-strict-aliasing' when available."). 2012-01-28 Chris K. Jester-Young Fix double-free error on non-GNU systems. * libguile/i18n.c (scm_make_locale): Null out c_locale_name after it's freed, so it doesn't get freed again. While this only has effect if USE_GNU_LOCALE_API is unset, the nulling out happens in both cases, to be consistent and robust. (scm_nl_langinfo): Free c_result in all switch cases, in particular P_SIGN_POSN, N_SIGN_POSN, INT_P_SIGN_POSN, and INT_N_SIGN_POSN. 2012-01-28 Andy Wingo mention new manual sections in NEWS * NEWS: Mention new sections. 2012-01-27 Ludovic Courtès Build with `-fno-strict-aliasing' when available. * configure.ac (POTENTIAL_GCC_CFLAGS): Add `-fno-strict-aliasing'. Suggested by Mark H. Weaver. 2012-01-27 Andy Wingo attempt to clear stale references on VM C stack * libguile/vm-engine.h (DEAD): New macro, nulls out a value. * libguile/vm-i-system.c: * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: Use DEAD when variables become dead. Later we can #ifdef this out, but I want to give the buildbots a try with this patch to make sure it's correct. 2012-01-27 Andy Wingo vm-i-scheme.c slight refactor * libguile/vm-i-scheme.c: Refactor the RETURN macro to not include NEXT. Adapt all uses to NEXT on their own. document `include', `include-from-path' * doc/ref/api-evaluation.texi (Local Inclusion): New section. 2012-01-27 Andy Wingo more documentation on the process of loading source and compiled files * doc/ref/api-evaluation.texi (Load Paths): Move documentation of %load-path and related procedures here, from Build Config. Add docs for %load-compiled-path. * doc/ref/api-foreign.texi: * doc/ref/api-modules.texi: * doc/ref/api-options.texi: * doc/ref/scheme-using.texi: Update xrefs. 2012-01-27 Mark H Weaver Fix error messages involving definition forms * module/ice-9/psyntax.scm (syntax-type): Return an additional value that contains the entire form in _all_ cases, including for definition forms. Previously, the entire form was not returned for definition forms. (expand-expr): Add an additional argument that contains the entire form in _all_ cases, including for definition forms. Use it to include the entire form in error messages, notably for definitions in expression context. Include the source location information, which was previously missing from these errors when the rhs expression was an atom. Improve the "definition in expression context" error message to be more comprehensible for Scheme beginners. (expand-top-sequence, expand, expand-body): Adjust as needed to handle the additional return value from 'syntax-type' and the additional argument to 'expand-expr'. * module/ice-9/psyntax-pp.scm: Regenerate. * NEWS: Update. 2012-01-26 Andy Wingo update NEWS * NEWS: Update. fix test-loose-ends * test-suite/standalone/test-loose-ends.c (test_scm_local_eval): Use ice-9 local-eval to get (the-environment). update local-eval docs * doc/ref/api-evaluation.texi (Local Evaluation): Update docs, add some examples. 2012-01-26 Andy Wingo more readable gensyms * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (dynamic-wind): When you make a gensym that just has to be compared against other gensyms, it will be unique if the prefix doesn't end in something that can be interpreted as a number. There's no reason to make that character something difficult like " ". So change to use a dash in that case. * module/ice-9/psyntax-pp.scm: Regenerate. More readable now. 2012-01-26 Andy Wingo globally unique marks and labels using syntax-session-id * libguile/macros.c (scm_init_macros): Add definition of new syntax-session-id helper. * module/ice-9/psyntax.scm: Capture a reference to syntax-session-id at boot time. Uniquify marks and labels using the session id. * module/ice-9/boot-9.scm: Shunt syntax-session-id off to (system syntax) once we finished booting. * module/ice-9/compile-psyntax.scm: Override syntax-session-id when remaking psyntax to avoid spurious diffs. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-01-26 Andy Wingo Revert "Universally-unique gensyms" This reverts commit ad432bc8317c33899efc29854550b67f3d7babf7. Not all gensyms need to be universally-unique: most of them just need to be unique within some portion of a Guile session. We'll take a different tack on this problem in the next commit. 2012-01-26 Andy Wingo Implement `local-eval', `local-compile', and `the-environment' * module/ice-9/local-eval.scm: New module (ice-9 local-eval) which exports `the-environment', `local-eval', and `local-compile'. * libguile/debug.c (scm_local_eval): New C function that calls the Scheme implementation of `local-eval' in (ice-9 local-eval). * libguile/debug.h (scm_local_eval): Add prototype. * doc/ref/api-evaluation.texi (Local Evaluation): Add documentation. * test-suite/tests/eval.test (local evaluation): Add tests. * test-suite/standalone/test-loose-ends.c (test_scm_local_eval): Add test. * module/Makefile.am: Add ice-9/local-eval.scm. Based on a patch by Mark H Weaver . 2012-01-26 Ludovic Courtès Fix a couple of warnings. * module/scripts/list.scm: Use SRFI-1. * module/system/repl/error-handling.scm: Use (ice-9 format). Fix typo in `-Wformat'. * module/language/tree-il/analyze.scm (format-analysis): Call `warning', not `warn'. 2012-01-26 Ludovic Courtès Add warnings for unsupported `simple-format' options. * module/language/tree-il/analyze.scm (format-analysis)[check-simple-format-args]: New procedure. Use it. Add support for applications of . * module/system/base/message.scm (%warning-types): Handle the `format simple-format' warning. * module/language/scheme/spec.scm (scheme)[make-default-environment]: Use `simple-format' as the default `format'. * test-suite/tests/tree-il.test ("warnings")["format"]: Explicitly use (@ (ice-9 format) format) where needed. ("simple-format"): New test prefix. 2012-01-25 Ludovic Courtès Import Gnulib's `setenv' module, for MinGW. Reported by Eli Zaretskii . * m4/gnulib-cache.m4 (gl_MODULES): Add `setenv'. 2012-01-25 Andy Wingo new syntax procedures to (system syntax) * module/ice-9/boot-9.scm: * module/ice-9/psyntax.scm (syntax-module, syntax-local-binding) (syntax-locally-bound-identifiers): After boot, move these definitions to a new (system syntax) module. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-macros.texi: Add some words about syntax-module and friends being in (system syntax). 2012-01-25 Andy Wingo add syntax-module * module/ice-9/psyntax.scm (syntax-module): New accessor for syntax objects. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm: Declare syntax-module. * doc/ref/api-macros.texi: Document it. 2012-01-25 Andy Wingo add syntax-locally-bound-identifiers * module/ice-9/boot-9.scm (syntax-locally-bound-identifiers): Declare variable. * module/ice-9/psyntax.scm: Add locally-bound-identifiers helper, and define syntax-locally-bound-identifiers. * module/ice-9/psyntax-pp.scm: Regenerated. * doc/ref/api-macros.texi: Document the new procedure. fix "lexical vars are collectable" test * test-suite/tests/gc.test ("gc"): Fix "lexical vars are collectable" test. (Previously, the binding was getting inlined, so we weren't testing what we meant to test. Besides that, the value was a constant, not a closure, so it wasn't collectable in the first place!) better function prologue disassembly * module/language/assembly/disassemble.scm (code-annotation): Add an annotation for assert-nargs-ee/locals and assert-nargs-ge/locals. add another case in which to fold (values FOO) to FOO, for some FOO * module/language/tree-il/peval.scm (peval): Fold (values 'singly-valued-expression) to 'singly-valued-expression in contexts that expect multiple values, in addition to those that expect single values. fix values miscompilation in push context with RA * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Fix miscompilation of `values' in a push context with RA. * test-suite/tests/tree-il.test: Add low-level test for this miscompilation. 2012-01-24 Ludovic Courtès Work around instruction reordering on SPARC and HPPA in the VM. Fixes part of . Reported by Bruno Haible . * libguile/vm-i-system.c (COMPILER_BARRIER): New macro. (halt, return, return_values): Insert compiler barrier after each assignment to `fp'. 2012-01-24 Ludovic Courtès vlist: Use (ice-9 format). * module/ice-9/vlist.scm: Use (ice-9 format). 2012-01-23 Ludovic Courtès FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged. This is a followup to 690a0112e55823aa8b862daeddcf44cea97e7917 ("Remove the "has finalizer?" bit from pointer objects.") * libguile/foreign.c (scm_set_pointer_finalizer_x): Leave the type cell unchanged. Before, `equal?' would break on pointers on which `set-pointer-finalizer!' had been called. * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer (set-pointer-finalizer!)"]: New test. 2012-01-23 Ludovic Courtès guile-readline: Clean `.go' files. * guile-readline/Makefile.am (CLEANFILES): Add *.go. 2012-01-23 Andy Wingo current-filename canonicalizes path, remove add-to-path * module/ice-9/boot-9.scm (current-filename): Canonicalize the path, so that the result is independent of the current directory, and so that `dirname' can traverse up the file system, as in the add-to-load-path example. (add-to-path): Remove. The eval-when semantics make this macro too tricky to explain -- people will start using it on other path-like things, in lexical contours, whereas it only really makes sense with load-like paths at the toplevel. * doc/ref/api-evaluation.texi (Loading): Fix link to load-with-path docs, and remove add-to-path docs. 2012-01-23 Ludovic Courtès Adjust tests that relied on the output of the hash table printer. * libguile/hashtab.c (scm_i_hashtable_print): Use `SCM_UNPACK', not `SCM2PTR'. * test-suite/tests/hash.test: Adjust tests that rely on the output of the printer to just check for the suffix of the hash table's external representation. 2012-01-23 Ludovic Courtès Print the address of hash tables. * libguile/hashtab.c (scm_i_hashtable_print): Print the address of EXP. 2012-01-22 Ludovic Courtès Augment `release.org'. * doc/release.org: Mention debbugs and `platform-testers@gnu.org'. 2012-01-22 Ludovic Courtès Parenthesize and type `SCM_FRAME' macros; check layout of `scm_vm_frame'. * libguile/frames.c: Add compile-time assertions on the layout of `struct scm_vm_frame'. (RELOC): Parenthesize and type VAL. * libguile/frames.h (SCM_FRAME_STRUCT): Write in terms of `SCM_FRAME_DATA_ADDRESS'. (SCM_FRAME_DATA_ADDRESS): Parenthesize and type FP. (SCM_FRAME_SET_DYNAMIC_LINK): Write in terms of `SCM_FRAME_DYNAMIC_LINK'. * libguile/vm.c (RELOC): Parenthesize and type SCM_P. 2012-01-22 Ludovic Courtès Relax `asm-to-bytecode.test' for when target CPU == native CPU. * test-suite/tests/asm-to-bytecode.test (native-cpu, native-word-size): New procedures. (test-target): When the target is the native CPU, use the native word size instead of WORD-SIZE. 2012-01-21 Mark H Weaver Universally-unique gensyms * libguile/symbols.c (scm_gensym): Make the gensym counter a 128-bit thread-local, initialized to a random number upon the first call to `gensym' within a given thread. This counter is rendered as a 22 byte suffix of mostly base64 digits. * libguile/threads.h (scm_i_thread): Add a thread-local gensym_counter. * libguile/threads.c (guilify_self_1): Initialize gensym_counter to NULL. 2012-01-21 Mark H Weaver Add `random-state-from-platform' and `scm_i_random_bytes_from_platform' * libguile/random.c (scm_random_state_from_platform): New procedure. (scm_i_random_bytes_from_platform): New internal function. * libguile/random.h (scm_random_state_from_platform, scm_i_random_bytes_from_platform): Add prototypes. * doc/ref/api-data.texi (Random): Add documentation. 2012-01-21 Andy Wingo add current-filename, add-to-path, add-to-load-path * module/ice-9/boot-9.scm (current-filename, add-to-path) (add-to-load-path): New syntaxen. * doc/ref/api-evaluation.texi (Loading): Move load-path related procedures to a new section: (Load Paths): Hither. Document add-to-path and add-to-load-path. * doc/ref/api-debug.texi (Source Properties): Document current-source-location and current-filename. * doc/ref/api-modules.texi: * doc/ref/guile-invoke.texi: * doc/ref/scheme-using.texi: Update @ref for Load Paths change. 2012-01-20 Andy Wingo remove duplicate when/unless definitions * module/rnrs/control.scm: * module/sxml/ssax.scm: * test-suite/lalr/common-test.scm: Remove local `when'/`unless' definitions. 2012-01-20 Andy Wingo add when, unless * module/ice-9/boot-9.scm (when, unless): New forms. * doc/ref/api-control.texi (Conditionals): Add docs. Rename this node from "if cond case". * doc/ref/r6rs.texi: * doc/ref/scheme-ideas.texi: * doc/ref/srfi-modules.texi: Update referrers. 2012-01-19 Andy Wingo avoid gensym when making labels in psyntax * module/ice-9/psyntax.scm (gen-label): Avoid gensym, as we don't need to make symbols. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-01-19 Andy Wingo add syntax-local-binding * module/ice-9/boot-9.scm (syntax-local-binding): New binding. * module/ice-9/psyntax.scm: Locally define a fluid that holds the "transformer environment". with-transformer-environment calls a procedure with the transformer environment, or raises an error if called outside the extent of a transformer. Bind transformer-environment in expand-macro. (resolve-identifier): Backport this helper from master. (syntax-local-binding): New procedure to return binding information of a bound identifier (a lexical, macro, a pattern variable, a displaced lexical, a global, or some other form). * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-macros.texi (Syntax Transformer Helpers): Add docs for syntax-local-binding, and syntax-source, and move some other descriptions to this new section. 2012-01-19 Mark H Weaver Add `scm_c_value_ref' to allow access to multiple returned values from C Based on a patch by Julian Graham * libguile/values.c, libguile/values.h (scm_c_value_ref): New function. * doc/ref/api-control.texi (Multiple Values): Add documentation. * test-suite/standalone/test-scm-values.c: New test program. * test-suite/standalone/Makefile.am: Add test-scm-values test. 2012-01-16 Ludovic Courtès Update Gnulib to v0.0-6827-g39c3009; use the `dirfd' module. * m4/gnulib-cache.m4: Use `dirfd'. * libguile/filesys.c: Include Gnulib's directly. (dirfd): Remove. Suggested by Bruno Haible . 2012-01-16 Ludovic Courtès Improve wording in README regarding `pkg-config'. * README: Mention $PKG_CONFIG_PATH, and make it clear that $BDW_GC_LIBS, etc. aren't normally needed. Fix typo in threads.c on IA64. * libguile/threads.c (guilify_self_1)[__ia64__]: Fix typo. Reported by Bruno Haible . Skip `tr_TR' tests on Solaris 2.10. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Special-case Solaris 2.10. 2012-01-15 Chris K. Jester-Young Add #ifdefs for langinfo items that don't exist on OpenBSD. * libguile/i18n.c (define_langinfo_items): Add #ifdefs for ERA_* and ALT_DIGITS, as those constants don't exist on OpenBSD. Call scm-error with the correct argument order. * module/ice-9/boot-9.scm (catch, with-throw-handler): Switch the order of the error key and function name arguments. 2012-01-14 Ludovic Courtès Have `statprof.test' fail gracefully when samples could not be collected. * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Throw unresolved when one of A-DATA, B-DATA, and C-DATA is #f, which means samples were not collected for this one. Avoid non-portable `tail' argument in `test-guile-snarf'. * test-suite/standalone/test-guile-snarf (strip_first_line): New function. (snarf): Use it. Fix signed/unsigned pointer mismatches. * libguile/foreign.c (scm_pointer_to_bytevector, scm_bytevector_to_pointer): Use pointers of the same signedness. 2012-01-14 Mark H Weaver Don't diverge when serializing cyclic lists during compilation * module/language/glil/compile-assembly.scm (scheme-list?): Don't diverge when serializing cyclic lists. 2012-01-14 Mark H Weaver Fix serialization of #nil-terminated lists during compilation * module/language/glil/compile-assembly.scm (scheme-list?): New predicate, like `list?' but requires that the last cdr must be '(), not #nil. (dump-object, dump-constants): Use `list' opcode to create a list only if it is terminated by '(). If it's terminated by #nil, we must use the more general `cons' opcode. 2012-01-12 Andy Wingo fix array printing * libguile/print.c (iprin1): Fix unmatched ENTER_NESTED_DATA. Fixes http://debbugs.gnu.org/10482. Thanks to Daniel Llorens for the report. update NEWS * NEWS: Minor edits. Remove a THANKS; we need to assemble a larger THANKS for this release. 2012-01-12 Ludovic Courtès Make sure `scm_spawn_thread' returns a thread. * libguile/threads.c (scm_spawn_thread): Add an assertion that DATA.thread is a thread. This assertion is sometimes hit on x86_64-freebsd8.2. Disable statprof tests on platforms that lack `ITIMER_PROF' support. * test-suite/tests/statprof.test (when-implemented): New macro. ("statistical sample counts within expected range", "accurate call counting"): Use it. 2012-01-12 Andy Wingo update NEWS * NEWS: Update. print-options doc update * doc/ref/api-evaluation.texi (Scheme Write): Update print-options. fluids.c docstring * libguile/fluids.c (scm_make_fluid_with_default): Update docstring. Move parameters documentation to core * doc/ref/api-scheduling.texi (Fluids and Dynamic States): Update for default values. (Parameters): Move here from srfi-39, and adapt. add docs for scm_gc_register_allocation * doc/ref/api-memory.texi: Update for scm_gc_register_allocation. Remove docs for scm_gc_{un,}register_collectable_memory. 2012-01-10 Mark H Weaver Remove docs `procedure-environment', which no longer exists * doc/ref/api-procedures.texi (Procedure Properties): Remove the entry for `procedure-environment', which no longer exists. Use a common null stringbuf in `scm_i_make_string' * libguile/strings.c (scm_i_make_string): Use a common null stringbuf for newly-allocated empty strings. Empty substrings no longer reference the original stringbuf * libguile/strings.c (scm_i_substring, scm_i_substring_read_only, scm_i_substring_shared): When asked to create an empty substring, return a freshly allocated null string. Previously, an empty substring needlessly held a reference to the original stringbuf. scm_i_substring_copy tries to narrow the substring * libguile/strings.c (scm_i_substring_copy): Try to narrow the substring if it came from a wide string. Avoid calling `u32_conv_from_encoding' on the null string * libguile/strings.c (scm_from_stringn): Avoid calling `u32_conv_from_encoding' on the null string, by using the same fast-path code used if (encoding == NULL). This is an optimization, and also avoids any possible encoding errors. 2012-01-10 Mike Gran Typo in documentation of local-boxed-set * doc/ref/vm.texi: modified 2012-01-10 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/__scm.h libguile/array-map.c libguile/procprop.c libguile/tags.h module/ice-9/deprecated.scm module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/standalone/test-num2integral.c test-suite/tests/regexp.test 2012-01-10 Mark H Weaver Remove null string optimization from scm_from_stringn * libguile/strings.c (scm_from_stringn): Always return a freshly allocated string from scm_from_stringn, even when asked to construct the null string, in accordance with the R5RS. Previously, we optimized the null string case by returning a reference to a global null string object (scm_nullstr). 2012-01-10 Andy Wingo Merge commit 'f78a1ccede02ccad89d6c91a6b297f1f14a30907' Merge commit 'cc8afa2b361635953dfba7f10e4193b1f243a50f' Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il/peval.scm 2012-01-09 Daniel Hartwig permit non-date values for Expires header * module/web/http.scm ("Expires"): Permit (some) non-date values. 2012-01-09 Ludovic Courtès Have `cpu-word-size' error out on unknown CPUs; add support for MIPSEL. * module/system/base/target.scm (cpu-word-size): Add support for `mipsel'. Call `error' when CPU is unknown. Make sure `regexp-quote' tests use Unicode-capable string ports. * test-suite/tests/regexp.test (with-unicode): New macro. ("regexp-quote"): Wrap all `regexp-quote' calls in it. This fixes tests on machines where the default port encoding is US-ASCII. Fix incorrect use of `SCM_UNPACK'. * libguile/arrays.c (scm_i_make_array): Cast the result of `scm_gc_malloc' directly to `scm_t_bits'. i18n: Fix gc_malloc/free mismatch on non-GNU systems. * libguile/i18n.c (scm_i_locale_free): Remove. (smob_locale_free): Define only when USE_GNU_LOCALE_API. (scm_make_locale)[!USE_GNU_LOCALE_API]: Allocate `c_locale->locale_name' with `scm_gc_strdup', not `malloc'. i18n: Disable Turkish locale tests on FreeBSD 8. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Check %HOST-TYPE and throw `unresolved' on FreeBSD 8. Fix loose typing in `test-scm-spawn-thread.c'. * test-suite/standalone/test-scm-spawn-thread.c (inner_main): Use `SCM2PTR' instead of a cast. 2012-01-09 Andy Wingo allocate a tc7 to bitvectors * libguile/tags.h (scm_tc7_bitvector): Allocate a tc7 to bitvectors. * libguile/print.c (iprin1): * libguile/goops.c: * libguile/evalext.c (scm_self_evaluating_p): * libguile/eq.c (scm_equal_p): Add cases for bitvectors. * libguile/bitvectors.h: Declare internal print and equal? helpers. * libguile/bitvectors.c: Use a tc7 instead of a smob type. 2012-01-09 Andy Wingo allocate a tc7 to arrays * libguile/tags.h (scm_tc7_array): Allocate a tag for arrays. * libguile/arrays.h (SCM_I_ARRAYP): Change to use scm_tc7_array. The previous definition was not externally usable because scm_i_tc16_array was internal. (scm_i_print_array): Declare, though internally. * libguile/arrays.c (scm_i_make_array): Use scm_cell with the tc7 instead of NEWSMOB. (scm_i_print_array): Make not static. (SCM_ARRAY_IMPLEMENTATION): Adapt. (scm_init_arrays): Remove array smob declaration. * libguile/eq.c (scm_equal_p): Refactor to put the string, pointer, and bytevector cases in the switch. Add a case for arrays. * libguile/goops.c: Add declarations. * libguile/print.c (iprin1): Call scm_i_print_array as needed. * libguile/evalext.c (scm_self_evaluating_p): Add a case for arrays. 2012-01-09 Andy Wingo primitive-load returns the value(s) of the last expression * libguile/load.c (scm_primitive_load): Return the values yielded from evaluating the last expression in the file. * test-suite/tests/load.test ("return value of `load'"): Add tests. 2012-01-09 Rob Browning Define _GNU_SOURCE to fix the GNU/kFreeBSD build. Author: Petr Salinger Closes: #401168 Fix the SRFI 60 copy-bit documentation. 2012-01-09 Andy Wingo test-pthread-create-secondary: gc/gc.h, not gc/gc_version.h * test-suite/standalone/test-pthread-create-secondary.c: Include gc/gc.h. It works on libgc from git, and on 7.1. 2012-01-09 Mark H Weaver Avoid calling scm_i_string_start_writing if no chars will be mutated * libguile/srfi-13.c (scm_string_copy_x, scm_substring_fill_x, string_upcase_x, string_downcase_x, string_titlecase_x, string_reverse_x, scm_string_xcopy_x): Avoid calling `scm_i_string_start_writing' if the range of indices to be modified is empty. This avoids the error that would be raised by `scm_i_string_start_writing' if the string is not mutable. Thanks to Bruce Korb for reporting this problem and suggesting the fix. 2012-01-08 Andy Wingo no need to warn people off of s_FOO generated by SCM_DEFINE * doc/ref/libguile-snarf.texi (Function Snarfing): The s_FOO binding isn't deprecated; no need to warn people to stop using it. Thanks to Peter Brett for the hint. allow scm_display_error to use a stack as the first argument * libguile/backtrace.c (scm_display_error): Allow a deprecated use of this function to pass a stack as the first argument. Thanks to Peter Brett for pointing it out, in http://lists.gnu.org/archive/html/guile-user/2011-06/msg00000.html. 2012-01-08 Ludovic Courtès Fix typo in `test-num2integral.c'. * test-suite/standalone/test-num2integral.c (out_of_range_handler): Use `scm_is_eq' when comparing KEY. 2012-01-08 Ludovic Courtès ftw: Add an `error' parameter to `file-system-fold'. * module/ice-9/ftw.scm (errno-if-exception): New macro. (file-system-fold): Add an `error' parameter. Wrap `opendir' and STAT calls in `errno-if-exception' and call ERROR when appropriate. (file-system-tree): Provide an `error' procedure. Return #f when FILE-NAME is unreadable. (scandir): Provide an `error' procedure. * test-suite/tests/ftw.test (%top-builddir): New variable. (make-file-tree, delete-file-tree): New procedures. (with-file-tree): New macro. ("file-system-fold"): Update tests to add an `error' procedure. ["ENOENT", "EACCES", "dangling symlink and lstat", "dangling symlink and stat"]: New tests. ("file-system-tree")["ENOENT"]: New test. ("scandir")["EACCES"]: New test. * doc/ref/misc-modules.texi (File Tree Walk): Update `file-system-fold' documentation. 2012-01-08 Andy Wingo fix SCM_ASRTGO deprecation * libguile/__scm.h (SCM_ASRTGO): Whoops, actually remove the ASRTGO definitions here. * libguile/deprecated.h: Fix type of scm_i_deprecated_asrtgo. syntax parameters doc formatting * doc/ref/api-macros.texi (Syntax Parameters): Some copy-editing on Ian's lovely syntax-parameters documentation. 2012-01-08 Andy Wingo deprecate SCM_ASRTGO * libguile/deprecated.h: Mark scm_immutable_cell and scm_immutable_double_cell as being SCM_DEPRECATED, not SCM_API. Deprecate SCM_ASRTGO. * libguile/deprecated.c (scm_i_deprecated_asrtgo): New support procedure. * doc/ref/api-control.texi (Handling Errors): Remove ASRTGO docs. 2012-01-08 Ian Price document syntax parameters * doc/ref/api-macros.texi (Macros): Add subsection for "Syntax Parameters" 2012-01-07 Mark H Weaver Fix bugs related to mutation-sharing substrings * libguile/strings.c (scm_i_is_narrow_string, scm_i_try_narrow_string, scm_i_string_set_x): Check to see if the provided string is a mutation-sharing substring, and do the right thing in that case. Previously, if such a string was passed to these functions, they would behave very badly: while trying to fetch and/or mutate the cell containing the stringbuf, they were actually fetching or mutating the cell containing the original shared string. That's because mutation-sharing substrings store the original string in CELL_1, whereas all other strings store the stringbuf there. Make scm_nullstr mutable * libguile/strings.c (scm_init_strings): Make scm_nullstr mutable. It is still usable as a common object, because of course it contains no characters to mutate anyway. It is returned by several procedures that are specified to return mutable strings, and string mutators raise errors when passed an immutable string, even if it is the null string. 2012-01-07 Andy Wingo don't leak file descriptors when mmaping objcode * libguile/objcodes.c (make_objcode_from_file): Close the mmap'd file, so that we don't leak the descriptor. I was previously under the mistaken impression that closing the fd unmapped the memory, which is not the case. Thanks to Cedric Cellier for the tip! 2012-01-07 Ian Price `write-request-line' writes absolute paths, not absolute URIs. * module/web/http.scm (write-request-line): RFC 2616 says that absolute paths are used to identify resources on an origin server. 2012-01-07 Andy Wingo remove duplicate write-uri definition * module/web/http.scm: Remove duplicate write-uri definition. update api-modules.texi * doc/ref/api-modules.texi (Modules): Add subsection for "Modules and the File System". Move "Included Guile Modules" to the end. Move "Module System Reflection" after "Variables", as we need to know about variables. Flesh out "Module System Reflection" a bit, with docs on module-ref, module-variable, and other bindings. General editing. 2012-01-06 Andy Wingo deprecate fluid-let-syntax in favor of syntax-parameterize * module/ice-9/psyntax.scm (syntax-parameterize): Rename from fluid-let-syntax. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm (define-inlinable): Use syntax-parameterize (and define-syntax-parameter). * module/ice-9/deprecated.scm (fluid-let-syntax): Add deprecated shim. 2012-01-06 Andy Wingo add define-syntax-parameter, same as define-syntax * module/ice-9/psyntax.scm (define-syntax-parameter): New toplevel form. Will be used to implement syntax parameters, following Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper, "Keeping it Clean with syntax-parameterize". Adds a new binding type and definition form. Conflicts: module/ice-9/psyntax.scm 2012-01-05 Ludovic Courtès Fix the exception type of the (begin) test. * test-suite/tests/syntax.test (exception:zero-expression-sequence): New variable. ("begin")["legal (begin)"]: Rename to "valid (begin)". ["illegal (begin)"]: Ditto. Expect `exception:zero-expression-sequence'. Placate a number of `syntax-check' verifications. - "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files Regenerate `psyntax-pp.scm'. * module/ice-9/psyntax-pp.scm: Regenerate. Fix erroneous check in `set-procedure-properties!'. * libguile/procprop.c (scm_set_procedure_properties_x)[SCM_ENABLE_DEPRECATED == 1]: Pass arguments to `scm_assq' in the right order, and check its return value with `scm_is_true'. Reported by Mike Gran . 2012-01-05 Ludovic Courtès Raise an error for (begin) when `--disable-deprecated'. * module/ice-9/psyntax.scm (define-expansion-constructors)[begin-form]: Emit a syntax-violation error for empty sequences when --disable-deprecated. * test-suite/tests/syntax.test (pass-if-syntax-error): Fix typo in error message. 2012-01-04 Mark H Weaver Fix docs of string mutators to do so on a mutable string * doc/ref/api-data.texi (String Modification): Change (define y "abcdefg") => (define y (string-copy "abcdefg")) before mutating the string bound to y in the example code. 2012-01-04 Mike Gran Rework c-api.test to use test lib The failure path for the c-api.test had been to call the undefined function 'fail', instead of logging the error like the other tests. * test-suite/tests/c-api.test: modified 2012-01-03 Ludovic Courtès doc: Fix typo in `define-wrapped-pointer-type' example. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix typo in `define-wrapped-pointer-type' example. 2011-12-31 Mark H Weaver Fix documentation for vhash-fold and vhash-fold-right * doc/ref/api-compound.texi (VHashes): Add missing `init' parameter in documentation for vhash-fold and vhash-fold-right, and also improve description. * module/ice-9/vlist.scm (vhash-fold, vhash-fold-right): Rename formal parameter `seed' to `init', to match documentation. Improve docstrings. 2011-12-31 Mark H Weaver Fix comment summarizing allocation table * module/language/tree-il/analyze.scm (analyze-lexicals): Fix comment, which describes the compiler's allocation table, to match reality. Update comment: ~/.guile-ccache => ~/.cache/guile/ccache * module/system/base/compile.scm: Update comment to match where the ccache dir now lives: ~/.cache/guile/ccache 2011-12-22 Daniel Llorens New array-map! and array-for-each tests * ramap.test: New tests. - array-map! with noncompact arrays and more than one argument. - array-for-each with noncompact arrays and more than two arguments. 2011-12-22 Andy Wingo fix generalized-vector-{ref,set!} for slices * libguile/generalized-vectors.c (scm_c_generalized_vector_ref): (scm_c_generalized_vector_set_x): Fix for the case in which base was not 1, lbnd was not 0, or inc was not 1. * test-suite/tests/arrays.test (array): Add a test. Thanks to Daniel Llorens for the report. 2011-12-22 Andy Wingo freebsd itanium support * libguile/threads.c (scm_ia64_register_backing_store_base) (scm_ia64_ar_bsp): Provide implementation of these itanium helpers on freebsd. Thanks to Jim Pryor. freebsd implementation of get_thread_stack_base * configure.ac: Check for pthread_np.h and pthread_attr_get_np. Patch by Jim Pryor. * libguile/threads.c (get_thread_stack_base): Provide an implementation for FreeBSD. 2011-12-22 Andy Wingo stdlib.h, not malloc.h * configure.ac: Remove check for malloc.h. * libguile/gc-malloc.c: * libguile/gc.c: * libguile/mallocs.c: * libguile/smob.c: Use stdlib instead of malloc.h. 2011-12-22 Andy Wingo Make the "Dia Primitives" section of the manual more clear. * doc/ref/libguile-program.texi (Dia Primitives): Use scm_assert_smob_type, and update the text. 2011-12-22 Andy Wingo HTTP: Fix qstring writing of cache-extension values * module/web/http.scm ("Cache-Control"): Write string values using the default val writer, to get quoting correct. * test-suite/tests/web-http.test (pass-if-round-trip): New helper. ("general headers"): Check that cache-extensions round trip properly. 2011-12-22 Daniel Hartwig Extend handling of "Cache-Control" header. * module/web/http.scm ("Cache-Control"): Value for `max-stale' is optional. Strict validation for value-less directives (`no-store', etc.). String values optional for "cache-extension" directives. * test-suite/tests/web-http.test: Value for `max-stale' is optional. 2011-12-22 Andy Wingo peval fix: (cons 1 #nil) is not (list 1) * module/language/tree-il/peval.scm (peval): (cons FOO #nil) is not (cons FOO '()). * test-suite/tests/tree-il.test ("partial evaluation"): Add a test. 2011-12-22 Andy Wingo peval minor tweak * module/language/tree-il/peval.scm (peval): Record residual values in both value and values contexts. No test cases, it just seemed like a good idea. 2011-12-22 Andy Wingo document invalidity of (begin) as expression; add back-compat shim * doc/ref/api-control.texi (begin): Update to distinguish between splicing begin and sequencing begin. * module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim for `(begin)'. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Update to run illegal (begin) test only if we are not including deprecated features. 2011-12-19 Ludovic Courtès ftw: Include sub-directories in the result of `scandir'. * module/ice-9/ftw.scm (scandir)[skip]: Keep NAME in the resulting list. * test-suite/tests/ftw.test ("scandir")["top-srcdir"]: New test. 2011-12-19 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/feature.c m4/gnulib-cache.m4 module/ice-9/deprecated.scm module/language/tree-il/peval.scm fix scm_protects deprecation warning * libguile/gc.c: Fix warning about scm_protects being deprecated. fix peval to preserve effects when folding (values) forms * module/language/tree-il/peval.scm (singly-valued-expression?): New helper. (truncate-values): Use the helper. (make-operand): Minor refactor. (set-operand-residual-value!): Try to undo the effects of (values FOO), if the continuation will check itself for the correct number of values. (peval): Fold helpers into fold-constant. Add a constant-expression? case for (values FOO). Add a new context: "values", for contexts in which multiple values are allowed, either because of being in a tail context relative to a function, or because of let-values. "value" is now for single values. Don't visit operands for "values", as their binding form truncates to one value. Add a case to fold (values ...) forms. Fix folding of (lambda), to process the cases in values context instead of tail context (which could have been "value", which would cause the procedure to truncate). 2011-12-19 Ludovic Courtès ftw: Fix typos/thinkos in `file-system-fold' and `scandir'. * module/ice-9/ftw.scm (file-system-fold): Fix reference to STAT instead of ST. (scandir)[enter?]: Change the argument name to `dir', to avoid confusion. [skip]: Return RESULT, not #f. 2011-12-19 Ludovic Courtès ftw: Clarify the behavior of `scandir' for flat files and unreadable dirs. * module/ice-9/ftw.scm (scandir)[leaf]: Only add NAME when RESULT is a pair. [down]: Ignore RESULT. Start with #f instead of the empty list. * test-suite/tests/ftw.test ("scandir")["flat file"]: New test. * doc/ref/misc-modules.texi (File Tree Walk): Update `scandir' documentation accordingly. 2011-12-19 Christian Persch Add a deprecated alias for $expt * module/ice-9/deprecated.scm: Add alias for $expt. $expt was removed in commit 6fc4d0124d633d1b3ddc5af82967f23bd17556f8 but no deprecated alias was added in ad79736c68a803a59814fbfc0cb4b092c2b4cddf like for all the other deprecated $sin, $cos, ... functions. 2011-12-19 Andreas Schwab FFI: Properly unpack small integer return values in closure call. Fixes . * libguile/foreign.c (unpack): Add parameter return_value_p. Properly store integer return values smaller than int. (scm_i_foreign_call): Update call to unpack. (invoke_closure): Likewise. 2011-12-18 Ludovic Courtès doc: Add link from `opendir' to (ice-9 ftw). * doc/ref/posix.texi (File System): Add link to "File Tree Walk". doc: Use `@deffn {Scheme Procedure}' in `misc-modules.texi'. * doc/ref/misc-modules.texi: Use `@deffn {Scheme Procedure}' instead of `@defun'. 2011-12-18 Ludovic Courtès ftw: Add `scandir'. Suggested by Nala Ginrut . * module/ice-9/ftw.scm (scandir): New procedure. * test-suite/tests/ftw.test ("scandir"): New test prefix. * doc/ref/misc-modules.texi (File Tree Walk): Document `scandir'. 2011-12-18 Ludovic Courtès ftw: Add an optional `stat' parameter to `file-system-fold' and `-tree'. * module/ice-9/ftw.scm (file-system-fold): Add an optional `stat' parameter. Use it instead of `lstat'. Handle the case where (STAT child) fails. (file-system-tree): Likewise, and pass it to `file-system-fold'. * doc/ref/misc-modules.texi (File Tree Walk): Update the documentation of these functions. 2011-12-15 Ludovic Courtès Arrange to convert command-line arguments from the right encoding. This is a temporary workaround for the 2.0 stable series. The next stable series should have an implicit `setlocale (LC_ALL, "")' call, which will make this unnecessary. * libguile/feature.c (progargs_fluid): Rename to... (scm_program_arguments_fluid): ... this. Update users. * libguile/feature.h (scm_program_arguments_fluid): New internal declaration. * libguile/init.c (invoke_main_func): Call `scm_i_set_boot_program_arguments' instead of `scm_set_program_arguments'. * libguile/script.c (locale_arguments_to_string_list, scm_i_set_boot_program_arguments): New functions. (scm_compile_shell_switches): Use `locale_arguments_to_string_list'. * libguile/script.h (scm_i_set_boot_program_arguments): New internal declaration. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add `test-command-line-encoding'. * test-suite/standalone/test-command-line-encoding: New file. 2011-12-15 Ludovic Courtès Use Gnulib's `localcharset', with local patches. This follows Bruno Haible's suggestion at . * m4/gnulib-cache.m4: Add `gl_LOCAL_DIR'; use `localcharset'. * Makefile.am (EXTRA_DIST): Add gnulib-local/lib/localcharset.[ch].diff. (TESTS_ENVIRONMENT): New variable. * gnulib-local/lib/localcharset.c.diff, gnulib-local/lib/localcharset.h.diff: New files. * test-suite/Makefile.am (TESTS_ENVIRONMENT): Add @LOCALCHARSET_TESTS_ENVIRONMENT@. * test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Likewise. 2011-12-14 Ludovic Courtès Augment `.gitignore'. Update Gnulib to v0.0-6703-g4e0358a. Use `alignof_type' instead of `alignof'. * libguile/foreign.c: Use `alignof_type' instead of `alignof'; the latter was removed from Gnulib's in 408e170e3ae81f73fb65686c5834693d89a96594 (Nov. 1 2011). * libguile/vm-i-scheme.c: Likewise. doc: Set document encoding to UTF-8; typeset my surname correctly. * doc/ref/guile.texi: Add @documentencoding. * doc/ref/history.texi: Always write "Court@`es". * doc/ref/preface.texi (Contributors): Likewise. 2011-12-13 Ludovic Courtès Add `file-system-fold' and `file-system-tree' to (ice-9 ftw). * module/ice-9/ftw.scm (file-system-fold, file-system-tree): New procedures. * test-suite/tests/ftw.test (%top-srcdir, %test-dir): New variables. ("file-system-fold", "file-system-tree"): New test prefixes. * doc/ref/misc-modules.texi (File Tree Walk): Document `file-system-tree' and `file-system-fold'. 2011-12-13 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: configure.ac 2011-12-12 Andy Wingo add an apropos-hook to ice-9 session * module/ice-9/session.scm: #:keyword-ify the define-module form, and export apropos-hook. (apropos-hook): New hook. (apropos, apropos-fold): Run the apropos-hook. 2011-12-10 Andy Wingo current-input-port et al are srfi-39 parameters * libguile/ports.c (scm_init_ports): Export the port fluids to Scheme, temporarily. * module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port' et al into srfi-39 parameters, backed by the exported fluids, then remove the fluids from the guile module. (%cond-expand-features): Add srfi-39. * module/srfi/srfi-39.scm: Re-export features from boot-9. * test-suite/tests/parameters.test: Add tests. 2011-12-08 Chris K. Jester-Young fix compilation with gc 7.1 * configure.ac: Add checks for GC_gcollect_and_unmap and GC_get_unmapped_bytes. * libguile/gc-malloc.c (scm_realloc): GC_gcollect() if we don't have GC_gcollect_and_unmap. * libguile/gc.c (GC_get_heap_usage_safe): Likewise, don't GC_get_unmapped_bytes if the function doesn't exist. 2011-12-06 Ludovic Courtès Add an exception printer for `getaddrinfo-error'. * module/ice-9/boot-9.scm (getaddrinfo-error-printer): New procedure. Use it as the `getaddrinfo-error' exception printer. 2011-12-06 Ludovic Courtès peval: Truncate multiple values when extending the environment. Reported by Cédric Cellier . * module/language/tree-il/peval.scm (truncate-values): New procedure. (make-operand): Call `truncate-values' SOURCE. * test-suite/tests/tree-il.test ("partial evaluation"): New tests for multiple value truncation. 2011-12-06 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/deprecation.c libguile/load.c libguile/print.c enable port locking * libguile/ports.c (scm_c_make_port_with_encoding): Enable port locking. fix scm_adjust_port_revealed_x FUNC_NAME * libguile/ports.c (scm_adjust_port_revealed_x): Fix FUNC_NAME. fix asm-to-bytecode.test * test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size) (test-target): The objcode version embedded in the cookie is not an effective version, so elide it from the test. 2011-12-06 Andy Wingo port locking refactor * libguile/ports.h (struct scm_t_port): Make the lock into a pointer field instead of an inline field. It should be possible to make unlocked ports by having a NULL lock field. (scm_c_lock_port, scm_c_try_lock_port): Return the mutex if the port was actually locked. (scm_c_unlock_port): Remove. * libguile/ports.c (scm_c_make_port_with_encoding): For now, leave `lock' set to 0. Change scm_c_lock_port callers to pay attention to the new API. * libguile/print.c (scm_write, scm_display): Fix call to dynwind-lock-port for ports-with-print-states. 2011-12-06 Andy Wingo allow URIs of the form file:///etc/hosts * module/web/uri.scm (parse-authority): Allow empty authorities, so that we accept URIs of the form, file:///etc/hosts. * test-suite/tests/web-uri.test ("string->uri"): Add tests. Update a comment in (web client) * module/web/client.scm: Update a comment. 2011-12-05 Andy Wingo warnings written to warning port * libguile/deprecation.c (scm_c_issue_deprecation_warning): * libguile/load.c (auto_compile_catch_handler): (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): * module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers) (load-in-vicinity): * module/system/base/message.scm (warning): Write to the warning port. (*current-warning-port*): Alias the warning port. 2011-12-05 Andy Wingo add current-warning-port * libguile/ports.h: * libguile/ports.c (scm_current_warning_port) (scm_set_current_warning_port): New functions, wrapping the Scheme parameter. * module/ice-9/boot-9.scm (current-warning-port): New parameter, defining a port for warnings. 2011-12-05 Andy Wingo setting a parameter returns the previous value * module/ice-9/boot-9.scm (make-parameter): Setting a parameter by invoking it with an argument now returns the previous value. 2011-12-05 Andy Wingo add srfi-39 parameters to boot-9 * module/ice-9/boot-9.scm (, make-parameter, parameter?) (parameter-fluid, parameter-converter, parameterize): New top-level bindings, implementing SRFI-39 parameters. Currently, current-input-port and similar procedures are not yet parameters. * test-suite/Makefile.am: * test-suite/tests/parameters.test: Add tests, taken from srfi-39 tests. 2011-12-04 Andy Wingo ice-9/poll: verify sizeof(struct pollfd) * libguile/poll.c (scm_init_poll): Define %sizeof-struct-pollfd. * module/ice-9/poll.scm: Check %sizeof-struct-pollfd. new print option escape-newlines, defaults to #t * libguile/private-options.h (SCM_PRINT_ESCAPE_NEWLINES_P): * libguile/print.c: Add new escape-newlines print option, defaulting to on. (write_character): For newlines, if SCM_PRINT_ESCAPE_NEWLINES_P, then print them as \n. (scm_init_print): Refactor print options initialization. ,language at REPL sets current-language * module/system/repl/command.scm (language): Set the *current-language*. * module/system/repl/repl.scm (start-repl): Create a new dynamic scope for *current-language*. 2011-12-02 Andy Wingo fix `free' of mpz_to_str * libguile/numbers.c (scm_number_to_string): Don't `free' the result of mpz_get_str; use the mp free function. scm_gc_register_collectable_memory calls scm_gc_register_allocation * libguile/gc-malloc.c (scm_gc_register_collectable_memory): Call scm_gc_register_allocation. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/guile.c libguile/numbers.c 2011-12-02 Andy Wingo install gmp memory functions that let libgc know about allocations * libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc, custom_gmp_free): New static functions used by GMP for allocation. These are just wrappers for scm_malloc, scm_realloc, and free. (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero, use mp_set_memory_functions to configure GMP to use custom_gmp_{malloc,realloc,free} for memory allocation. (scm_bigprint): Ask gmp for the function used to deallocate the string returned by mpz_get_str. * libguile/numbers.h: Declare scm_install_gmp_memory_functions. * libguile/guile.c: When running the Guile binary, install the gmp_memory_functions. Based on a patch by Mark H Weaver . 2011-12-01 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: configure.ac libguile/fluids.c libguile/gc.c libguile/gc.h libguile/objcodes.c libguile/procprop.c libguile/vm.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm fix deadlock in before-gc-hook on certain 7.2alpha gc versions * libguile/gc.c (scm_init_gc): Only adjust gc frequency in the gc start hook if we know that it won't take a lock. 2011-11-29 Andy Wingo attempt to handle steady-state mallocations better * libguile/gc-malloc.c (scm_realloc): Call the new scm_gc_register_allocation() here. If we have to collect, do a GC_gcollect_and_unmap. * libguile/gc.c (scm_gc_register_allocation): Add a routine to track steady-state mallocation, and cause gc to run if there is a high mallocation rate. (adjust_gc_frequency): Reset the bytes-until-GC countdown timer. 2011-11-29 Andy Wingo collect a little in call-with-new-thread * libguile/threads.c (scm_call_with_new_thread): Collect a little before making a new thread. Our adjust_gc_frequency hack doesn't work well if the main allocation load is thread creation, as in https://savannah.gnu.org/bugs/?34140. This does not appreciably affect the speed of the test in that bug, but does effectively limit the image size. adjust_gc_frequency before gc, for more precision * libguile/gc.c (scm_init_gc): Run the adjust_gc_frequency from the before-gc-hook, not the after-gc-hook. More precise, this way. fix uninitialized variable in gc.c * libguile/gc.c (get_image_size): Fix use of uninitialized variable. switch off debugging flag that was mistakenly left on * libguile/gc.c (HEURISTICS_DEBUG): Whoops, switch this off. increase garbage collection rate if the process is growing * configure.ac: Check for GC_get_free_space_divisor. * libguile/gc.c (GC_get_free_space_divisor): Define an implementation, if needed. (accumulate_gc_timer): Fix indentation. (get_image_size): New terrible hack. Needs implementations on other platforms. (adjust_gc_frequency): Attempt to adjust the GC frequency based on process image growth. Needs more comments. (scm_init_gc): Add the adjust_gc_frequency to the after_gc_c_hook. 2011-11-28 Andy Wingo get heap stats with GC_get_heap_usage_safe, if available. * configure.ac: Check for GC_get_heap_usage_safe. * libguile/gc.c (SCM_DEFINE): Use GC_get_heap_usage_safe. 2011-11-26 Ludovic Courtès FFI: Hold a weak reference to the procedure passed to `procedure->pointer'. * libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference to PROC. * test-suite/tests/foreign.test ("procedure->pointer")["procedure is retained"]: New test. 2011-11-24 Andy Wingo support for new GC_move_disappearing_link * configure.ac: Check for GC_move_disappearing_link. * libguile/weak-set.c (move_weak_entry): * libguile/weak-table.c (move_disappearing_links): (move_weak_entry): Use GC_move_disappearing_link if available. remove scm_si_name_access * libguile/goops.h (scm_si_name_access): Remove alias for scm_si_getters_n_setters. remove unused slot: keyword-access * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_keyword_access): * libguile/goops.c (build_class_class_slots): Remove unused keyword-access slot from classes. deprecate make-vtable-vtable * libguile/struct.h: * libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can handle most of the use cases with make-vtable, and we don't want to promote the creation of new roots to the type hierarchy. (scm_i_make_vtable_vtable): The internal replacement. simplify %condition-type-vtable * module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable instead of make-vtable-vtable. record-type-vtable is not a new root of the vtable hierarchy * module/ice-9/boot-9.scm (record-type-vtable): Simplify to use make-vtable instead of make-vtable-vtable. Scheme standard-vtable-fields binding * libguile/struct.c (scm_init_struct): Export standard-vtable-fields to Scheme. add Scheme binding for scm_standard_vtable_vtable * libguile/struct.c (scm_init_struct): Export to Scheme. remove public scm_protects export * libguile/gc.h: * libguile/gc.c: Remove scm_protects from the API. It is deprecated on stable-2.0. no gc_register_root in scm_init_print * libguile/print.c (scm_init_print): No need to gc_register_root here. remove object protection from options.c * libguile/options.c (change_option_setting, scm_init_options): Rely on the options being allocated in GC-able memory, as in static memory. Therefore there is no need for the gc-protect dance. simplify scm_init_print * libguile/print.c (scm_init_print): Simplify creation of print-state vtable. 2011-11-23 Daniel Hartwig web-http.test validates headers * test-suite/tests/web-http.test (pass-if-parse): Validate header values as well. fix validators for various list-style headers * module/web/http.scm (default-val-validator): Valid with no value. (key-value-list?): Keys are always symbols, do not accept strings. (validate-param-list): Apply `valid?' to list elements. (validate-credentials): Validate param for Basic scheme, which is parsed as a string. (declare-symbol-list-header!): `list-of?' args were in wrong order. ("Cache-Control"): Replace `default-val-validator' with more specific procedure. ("Accept"): Validate on first param which has no value. 2011-11-23 Ludovic Courtès Update cross-compilation instructions. * README (Cross building Guile): Update. 2011-11-23 Ludovic Courtès configure: Make sure $GUILE_FOR_BUILD is suitable. * acinclude.m4 (GUILE_CHECK_VERSION, GUILE_CHECK_GUILE_FOR_BUILD): New macros. * configure.ac: Remove $GUILE_FOR_BUILD tests. Use `GUILE_CHECK_GUILE_FOR_BUILD'. 2011-11-23 Ludovic Courtès Allow $GUILE_FOR_BUILD to use its own environment when cross-compiling. * am/guilec (.scm.go): Use `-L' to specify the search path. * module/Makefile.am (ice-9/psyntax-pp.go): Likewise. * meta/uninstalled-env.in (top_builddir): Leave $GUILE_LOAD_PATH, $GUILE_SYSTEM_PATH, and $GUILE_SYSTEM_EXTENSIONS_PATH unchanged when cross-compiling. 2011-11-23 Andy Wingo Use default value for make-fluid in Scheme files * module/ice-9/boot-9.scm (%exception-handler) (%running-exception-handlers, read-eval?, *repl-stack*) (make-mutable-parameter): * module/ice-9/getopt-long.scm (%program-name): * module/language/elisp/runtime.scm (built-in-macro, defspecial): * module/srfi/srfi-39.scm (make-parameter/helper): * module/system/base/language.scm (*current-language*): * module/system/base/message.scm (*current-warning-port*): (*current-warning-prefix*): * module/system/base/target.scm (%target-type, %target-endianness) (%target-word-size): * module/texinfo/plain-text.scm (*indent*, *itemizer*): * benchmark-suite/lib.scm (prefix-fluid): * test-suite/lib.scm (prefix-fluid): Give fluids a useful default value. use new scm_make_fluid_with_default * libguile/load.c (scm_init_load): * libguile/ports.c (scm_init_ports): * libguile/read.c (scm_init_read): Use scm_make_fluid_with_default. 2011-11-23 Andy Wingo optional default-value arg to make-fluid * libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the default value in the dynamic-state vector to be SCM_UNDEFINED instead of SCM_BOOL_F. If the value in the dynamic-state is #f, default to a value attached to the fluid instead. This allows useful default values. (scm_make_fluid_with_default): New function, allows the user to specify a default value for the fluid. Defaults to #f. Bound to `make-fluid' on the Scheme side. (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all threads. (scm_fluid_unset_x): Also unset the default value. Not sure if this is the right thing. (fluid_ref): Update to the new default-value strategy. * libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED. * libguile/threads.h: Remove extra arg to scm_i_reset_fluid. * libguile/vm-i-system.c (fluid-ref): Update to new default-value strategy. * module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all threads. Fixes http://debbugs.gnu.org/10093. 2011-11-22 BT Templeton load boot.el * am/guilec: Add support for compiling Elisp files. * module/Makefile.am: New variable ELISP_SOURCES. * module/language/elisp/boot.el: New file. * module/language/elisp/spec.scm: Load boot.el. remove void-checking cruft * module/language/elisp/compile-tree-il.scm: Don't export `compile-without-void-checks', which was removed. Remove unused `disable-void-check' variable. Update comments. 2011-11-22 Ludovic Courtès Install the current locale when Guile is invoked directly. * libguile/guile.c (main): Add `setlocale' call. Add Gnulib `largefile' module. It will really be added next time we run "gnulib-tool --update". Leave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling. * meta/uninstalled-env.in: Don't define $GUILE_LOAD_COMPILED_PATH when cross-compiling. Build `psyntax-pp.go' with `--target=$(host)'. * module/Makefile.am (ice-9/psyntax-pp.go): Pass `--target=$(host)'. Run `guild compile' with `--target=$(host)'. * am/guilec (.scm.go): Run `guild compile' with `--target=$(host)'. 2011-11-22 Ludovic Courtès Add a `--target' option to `guild compile'. * module/scripts/compile.scm (%options)["--target"]: New option. (show-version): Update copyright year. (compile): Use `with-target' to install the target. * doc/ref/api-evaluation.texi (Compilation): Mention `--target' option. 2011-11-22 Ludovic Courtès Add missing implicit `SCM_API' for `scm_c_make_objcode_slice'. * libguile/objcodes.h (scm_c_make_objcode_slice): Add implicit `SCM_API'. 2011-11-22 Ludovic Courtès Complete cross-compilation support. * module/system/base/target.scm (%target-endianness, %target-word-size): New fluids. (%native-word-size): New variable. (with-target): Set these fluids. (cpu-endianness, cpu-word-size, triplet-cpu, triplet-vendor, triplet-os): New procedures. (target-cpu, target-vendor, target-os): Use them. (target-endianness, target-word-size): Refer to the corresponding fluid. * libguile/objcodes.c (target_endianness_var, target_word_size_var): New global variables. (NATIVE_ENDIANNESS): New macro. (target_endianness, target_word_size, to_native_order): New functions. (make_objcode_from_file): Use `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'. (bytecode_to_objcode): New function, based on `scm_bytecode_to_objcode', with the addition of an `endianness' and `word_size' parameters. (scm_bytecode_to_objcode): Use it. (scm_bytecode_to_native_objcode): New function. (scm_write_objcode): Use `target_word_size' and `target_endianness'. Convert OBJCODE's len and meta-len to native byte order. (scm_init_objcodes): Initialize `target_endianness_var' and `target_word_size_var'. * libguile/objcodes.h (scm_bytecode_to_native_objcode): New declaration. * libguile/vm.c (really_make_boot_program): Use `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'. * test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size): New variable. (test-target): New procedure. ("cross-compilation"): Add `test-target' calls and the "unknown target" test. 2011-11-22 Ludovic Courtès Fix `validate-target' in (system base target). * module/system/base/target.scm (validate-target): Accept any tuple with at least 3 parts. * test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure. ("cross-compilation"): New test prefix. 2011-11-21 Andy Wingo deprecate direct scm_protects access * libguile/gc.h: * libguile/gc.c: Deprecate direct access to scm_protects. 2011-11-20 Ludovic Courtès Allow overlapping regions to be passed to `bytevector-copy!'. Reported by Dmitry Chestnykh . Fixes . * libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not `memcpy'. * test-suite/tests/bytevectors.test ("2.2 General Operations")["bytevector-copy! overlapping"]: New test. * doc/ref/api-data.texi (Bytevector Manipulation): Mention possible overlapping. 2011-11-17 Andy Wingo eval.test work * test-suite/tests/eval.test ("stacks"): Enable another test, fix to use with-throw-handler, and remove a duplicate test, now that there is no difference between subrs and gsubrs. 2011-11-16 Ludovic Courtès FFI: Hold a weak reference to the CIF made by `procedure->pointer'. * libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference to CIF so that it is not reclaimed before POINTER. Before that it could be reclaimed and typically reused to store the CIF of another procedure with the same arity, leading to obscure wrong-type-arg errors. FFI: Add a `procedure->pointer' test. * test-suite/tests/foreign.test ("procedure->pointer")["procedures returning a pointer"]: New test. 2011-11-16 Andy Wingo fix urls in docs * doc/ref/intro.texi (Introduction): * doc/ref/scheme-reading.texi (Further Reading): * doc/ref/srfi-modules.texi (SRFI Support): Fix some urls. Thanks to Henrik Sandklef for the report. fix web.texi typo * doc/ref/web.texi (HTTP Headers): Fix a typo. Thanks to Brian Gough for the report. hack the port-column of current-output-port after printing a prompt * module/ice-9/boot-9.scm (repl-reader): Reset the output-column to 0 after printing the prompt. Fixes bug 9664. eval-when tidying up * module/ice-9/psyntax.scm: Rename expand-when-list to parse-when-list, and simplify to compare literal values. * module/ice-9/psyntax-pp.scm: Regenerate. psyntax: s/chi/expand/g * module/ice-9/psyntax.scm: Rename all instances of "chi" to "expand". Addded a hack to expand-eval-when that will be fixed later. * module/ice-9/psyntax-pp.scm: Regenerated. fix bug in make-repl when lang is actually a language * module/system/repl/common.scm (make-repl): Fix to accept language objects in addition to symbols. Fixes http://debbugs.gnu.org/9857. Thanks to Tristan Colgate for the report. 2011-11-16 Ludovic Courtès Re-enable a couple of evaluator tests. These tests had been disabled as part of b7742c6b7132544b9d6cd9cb32c09e2084ad9e52 ("new evaluator, y'all"). * test-suite/tests/eval.test ("define set procedure-name")["closure"]: Change to `pass-if' since it now works, as a result of ee15aa46e3fb29e609bd7c431e8f2676f6573d57 ("set names of functions defined at the toplevel from `eval'"). ("stacks")["arguments of a gsubr stack frame"]: Remove (throw 'unresolved). 2011-11-16 Andy Wingo memoize: booleanify the rest arg * libguile/memoize.c (memoize): Turn the rest arg into a boolean. Fixes an error when rest gets passed to set-procedure-minimum-arity!. 2011-11-15 Andy Wingo set names of functions defined at the toplevel from `eval' * module/ice-9/eval.scm (primitive-eval): Set the name of toplevel-defined functions. 2011-11-15 Andy Wingo better debuggability for interpreted procedures * libguile/procprop.c (scm_set_procedure_minimum_arity_x): New function, allows a user to override a function's arity. (scm_i_procedure_arity): Look up in the overrides table first. * libguile/procprop.h: Add scm_set_procedure_minimum_arity_x. * module/ice-9/eval.scm (primitive-eval): Override arity of "general closures". * test-suite/tests/procprop.test ("procedure-arity"): Add tests. Based on a patch from Stefan Israelsson Tampe. Test based on work by Patrick Bernaud. 2011-11-11 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' update letrec compilation test * test-suite/tests/tree-il.test ("letrec"): Update to clear the temporary `let' bindings. Merge remote-tracking branch 'origin/stable-2.0' 2011-11-10 Andy Wingo fix bit-set*! bug (!) * libguile/bitvectors.c (scm_bit_set_star_x): Fix a long-standing (since 2005) bug in which instead of using the kv bitvector, we actually use the `v' bitvector. Also, change to allow `kv' being shorter than `v'. * test-suite/tests/bitvectors.test ("bit-set*!"): Add tests. 2011-11-09 Andy Wingo when leaving a non-tail let, allow bound vals to be collected * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Clear lexical stack slots at the end of a non-tail let, letrec, or fix. Fixes http://debbugs.gnu.org/9900. * test-suite/tests/gc.test ("gc"): Add test. 2011-11-09 Andy Wingo disable port locking * libguile/ports.h (scm_c_lock_port, scm_c_try_lock_port) (scm_c_unlock_port): Disable port locking until I have time to sort out the bugs that are coming up. 2011-11-09 Andy Wingo inline dynwind guards for normal control flow * module/language/tree-il.scm (): Add `pre' and `post' fields to , so that we can inline the guard bodies in the normal control-flow case. It also avoids duplicating code in compile-glil, which probably hides more bugs in 2.0. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold) (make-tree-il-folder, post-order!, pre-order!): Update. * module/language/tree-il/analyze.scm (analyze-lexicals): Update. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update to use `pre' and `post' instead of compiling code twice. * module/language/tree-il/debug.scm (verify-tree-il): Update. * module/language/tree-il/peval.scm (peval): Update. Instead of doing complicated things in , handle 'dynamic-wind primcalls. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove 'dynamic-wind mess. Adapt '@dynamic-wind. * test-suite/tests/tree-il.test ("partial evaluation"): Update tests. 2011-11-09 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test simplify primitives.scm for dynwind * module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove a dynwind hack, as we have a good inliner now. 2011-11-09 Andy Wingo peval: fix dynwind bug. * module/language/tree-il/peval.scm (peval): The compiler will copy the winder and unwinder values, so make sure that they are constant, and if not, create lexical bindings. Fixes http://debbugs.gnu.org/9844. * test-suite/tests/tree-il.test ("partial evaluation"): Add a couple tests. 2011-11-09 Andy Wingo fix serialization. * module/language/tree-il.scm (unparse-tree-il): Fix serialization. peval: don't copy assigned lexical bindings * module/language/tree-il/peval.scm (peval): Since constant-expression? is used to determine whether to copy values, return #f if any lexical is assigned. 2011-11-08 Andy Wingo lock ports in `write' and `display' * libguile/print.c (scm_write, scm_display): Lock the port during `display' and `write' calls. Fixes https://savannah.gnu.org/bugs/?33996. add scm_dynwind_lock_port * libguile/ports.h: * libguile/ports.c (scm_dynwind_lock_port): New function. locking for write, lfwrite * libguile/ports.c (scm_c_write_unlocked, scm_c_write) (scm_lfwrite_unlocked, scm_lfwrite): Add locking and _unlocked variants. Change uses to _unlocked. locking for putc, puts * libguile/ports.c (scm_putc, scm_puts): * libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into _unlocked and locked variants. Change all callers to use the _unlocked versions. 2011-11-08 Andy Wingo locking on port buffering operations * libguile/ports.c (scm_fill_input_unlocked, scm_fill_input) (scm_end_input, scm_end_input_unlocked, scm_flush) (scm_flush_unlocked): Add locking and _unlocked variants. * libguile/filesys.c: * libguile/fports.c: * libguile/gdbint.c: * libguile/r6rs-ports.c: * libguile/read.c: * libguile/rw.c: Adapt callers to use _unlocked variants. 2011-11-08 Andy Wingo locking on unget_byte, ungetc, ungets * libguile/ports.h: * libguile/ports.c (scm_unget_byte_unlocked, scm_unget_byte) (scm_ungetc_unlocked, scm_ungetc, scm_ungets_unlocked, scm_ungets): Add locking and _unlocked variants. * libguile/arrays.c: * libguile/rdelim.c: * libguile/read.c: * libguile/vports.c: Adapt callers to use the _unlocked variants. 2011-11-08 Andy Wingo locking on scm_c_read, scm_getc * libguile/ports.c (scm_c_read_unlocked, scm_c_read, scm_getc_unlocked) (scm_getc): Split getc and read operations into locked and unlocked variants. Change most uses to use the _unlocked version. 2011-11-08 Andy Wingo threadsafe get-byte-or-eof, peek-byte-or-eof * libguile/ports.h (scm_get_byte_or_eof_unlocked): (scm_peek_byte_or_eof_unlocked): Rename, adding _unlocked. * libguile/ports.c (scm_get_byte_or_eof, scm_peek_byte_or_eof): Add locking implementations. Adapt callers to use _unlocked variants; they will do locking. * libguile/read.c (read_token, scm_read_semicolon_comment) (scm_read_shebang): Use unlocked variants. We will add locking later. 2011-11-08 Andy Wingo threadsafe port revealed counts * libguile/ports.h: * libguile/ports.c (scm_revealed_count, scm_set_port_revealed_x): Make threadsafe. (scm_adjust_port_revealed_x): New function, to adjust a port's revealed count in a threadsafe way. scm_c_lock_port takes a port * libguile/ports.h (scm_c_lock_port, scm_c_try_lock_port) (scm_c_unlock_port): Take a port instead of an entry. 2011-11-07 Andy Wingo ports implementation reordering * libguile/ports.h: Slight reorder. * libguile/ports.c: Reorder ports implementation to match the header file. This will make it easier to add locking and _unlocked variants. 2011-11-07 Andy Wingo threadsafe access to scm_ptobs * libguile/ports.h (SCM_PORT_DESCRIPTOR): New macro, to get at a port descriptor in the third word of a port instead of looking it up in a table. (scm_c_port_type_ref, scm_c_port_type_add_x): New API for working with numbered ptob descriptors. (SCM_PTOBNAME): Implement in terms of scm_c_port_type_ref. (scm_get_byte_or_eof, scm_peek_byte_or_eof): Use SCM_PORT_DESCRIPTOR. * libguile/ports.c (scm_c_num_port_types, scm_c_port_type_ref) (scm_c_port_type_add_x, scm_make_port_type): Protect scm_ptobs access with a mutex. Have it be an array of pointers instead of an array of structures. Adapt users to the new APIs. (scm_c_make_port_with_encoding): Allocate ports with three words. The third word is the ptob descriptor. * libguile/backtrace.c: * libguile/goops.c: * libguile/ioext.c: * libguile/print.c: Adapt to use scm_c_port_type_ref and SCM_PORT_DESCRIPTOR. 2011-11-07 Andy Wingo reorder ports.h declarations * libguile/ports.h: Reorder declarations. remove scm_markstream * libguile/ports.h: * libguile/ports.c (scm_markstream): Remove obsolete definition. Moved around a couple of other declarations. ports.h: remove unimplemented declarations * libguile/ports.h (scm_grow_port_cbuf, scm_pt_size, scm_pt_member): Remove declarations of unimplemented functions. Move a couple of other definitions around. inlined port functions to ports.h * libguile/inline.h: * libguile/ports.h (scm_get_byte_or_eof, scm_peek_byte_or_eof) (scm_putc, scm_puts): Move definitions here, from inline.h. 2011-11-07 Andy Wingo add lock to scm_t_port * libguile/ports.h (scm_c_lock_port, scm_c_try_lock_port) (scm_c_unlock_port): New inline functions. (scm_t_port): Add a lock field, if threads are enabled. This is a first step towards threadsafe ports. * libguile/ports.c (scm_c_make_port_with_encoding): Init the port's lock. * libguile/inline.c: Residualize the inline functions from ports.h. 2011-11-07 Andy Wingo regenerate psyntax-pp * module/ice-9/psyntax-pp.scm: Regenerate. add tests for hygienic name introduction * test-suite/tests/syntax.test ("top-level define"): Add tests for hygienic introduction of names. hygienically rename macro-introduced bindings, reproducibly * module/ice-9/psyntax.scm (chi-top-sequence): Detect bindings to identifiers introduced by macros. In that case, in order to preserve hygiene, uniquify the variable's name, but in a way that is reproduceable (i.e., yields the same uniquified name after a recompile). fix scope bug in definition in boot-9 * module/ice-9/boot-9.scm (define-record-type): Fix scope bug when generating identifiers. another scoping test * test-suite/tests/syntax.test ("top-level define"): Add another test for scoping. resolve-identifier for toplevel definitions resolves by module * module/ice-9/psyntax.scm (id-var-name): For mapping identifiers to toplevel definitions, also compare against the module. (resolve-identifier): Pass the module to id-var-name when looking up identifiers. (free-id=?): Adapt to id-var-name change. (chi-top-sequence): When adding a mapping from the given identifier to a toplevel definition, make the name be a pair. add scoping test * test-suite/tests/syntax.test ("top-level define"): Add a test for module scoping of introduced identifiers. defined identifiers scoped in the current module * ice-9/psyntax.scm (chi-top-sequence): Wrap defined identifiers with the current module. Fixes http://savannah.gnu.org/bugs/?31472. syntax parameters implemented properly * module/ice-9/psyntax.scm (resolve-identifier): Take an additional argument, indicating whether syntax parameters should be resolved or not. Just return three values: the binding type and value, and the module for resolving toplevels. (chi-install-global): Take an extra arg, the type. If we are defining a syntax parameter, construct a pair for the binding. (chi-body): Syntax parameters now use a per-parameter unique value (a pair) as a key in the expansion-time environment `r'. (syntax-parameterize): Don't allow parameterization of non-parameters. This is an incompatible change, but it is for the better; you don't want to allow users to parameterize `lambda', after all. 2011-11-07 Andy Wingo syntax-parameterize, not fluid-let-syntax * module/ice-9/psyntax.scm (syntax-parameterize): Rename from fluid-let-syntax. * module/ice-9/boot-9.scm (define-inlinable): Use syntax-parameterize (and define-syntax-parameter). 2011-11-07 Andy Wingo add define-syntax-parameter, same as define-syntax * module/ice-9/psyntax.scm (define-syntax-parameter): New toplevel form. Will be used to implement syntax parameters, following Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper, "Keeping it Clean with syntax-parameterize". Adds a new binding type and definition form. psyntax: resolve-identifier refactor * module/ice-9/psyntax.scm (id-var-name): Add a nice long comment. (lookup): Remove, as it is no longer used. (resolve-identifier): New helper, replaces most uses of id-var-name then `lookup'. (syntax-type, syntax, set!, fluid-let-syntax): Adapt to use resolve-identifier. (free-id=?): Adapt to id-var-name returning syntax objects. 2011-11-04 Andy Wingo chi-top-sequence refactor * module/ice-9/psyntax.scm (chi-top-sequence): Reimplement, more like chi-body. Instead of adding empty definitions to the toplevel, add toplevel definitions to the wrap shared by all forms in the sequence. 2011-11-04 Andy Wingo minor psyntax refactors * module/ice-9/psyntax.scm (syntax-type): Remove redundant lexical case. (syntax-rules, define-syntax-rule): Use `_' instead of `dummy' for the keyword. * module/ice-9/boot-9.scm (define-syntax-rule): Remove redundant definition. 2011-11-04 Andy Wingo peval doesn't resolve primitives * module/language/tree-il/peval.scm (peval): Don't resolve primitives, as resolve-primitives! handles that already. * test-suite/tests/tree-il.test (pass-if-peval): Always resolve and expand primitives. ("partial evaluation"): Update tests to assume expanded primitives. 2011-11-04 Andy Wingo resolve-primitives! does not primitivize local definitions * module/language/tree-il/primitives.scm (resolve-primitives!): Don't resolve toplevels defined in the same compilation unit to primitives, as it could be that the module doesn't have those bindings yet. more robust scm_exit_status * libguile/throw.c (scm_exit_status): In one of my bogus patches, I managed to make # reach this function, causing a segfault on SCM_CAR. Refactor to be more robust. 2011-11-01 Ian Price Fix R6RS `fold-left' so the accumulator is the first argument. * module/rnrs/lists.scm (fold-left): New procedure. * module/rnrs/records/syntactic.scm (define-record-type): Fix to use corrected `fold-left'. * test-suite/tests/r6rs-lists.test: Add tests. 2011-10-28 Andy Wingo refactor chi-top-sequence * module/ice-9/psyntax.scm (chi-top-sequence): Refactor slightly. * module/ice-9/psyntax-pp.scm: Regenerate. regenerate psyntax-pp * module/ice-9/psyntax-pp.scm: Regenerate. 2011-10-28 Andy Wingo add string-length, string-ref, vector-length instructions * libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump the major version, indicating the first incompatibility between 2.0 and 2.2. * libguile/vm-i-scheme.c (string-length, string-ref, vector-length): New instructions. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add primcall ops for the new instructions. 2011-10-28 Andy Wingo add vector-length primitive * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Recognize vector-length as an effect-free primitive. simplify primitives.scm * module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove a hack to compensate for the lack of a good inliner, now that we do have a good inliner. 2011-10-27 Andy Wingo fix the peval merge and a test * module/language/tree-il/peval.scm (peval): Accessor primitives applied to constants are pure if the call type-checks. Also, fold constants in accessor primcalls. * test-suite/tests/tree-il.test ("partial evaluation"): Fix the "yo" test. 2011-10-27 Andy Wingo fix hash of zero-length vectors * libguile/hash.c (scm_raw_ihash): Fix for zero-length vectors. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION libguile/deprecated.c libguile/gc-malloc.c module/language/tree-il/peval.scm 2011-10-26 Andy Wingo update `hash' * libguile/hash.c (scm_raw_ihash): Rename from `hasher'. Remove the modulo argument; we expect the caller to deal with that. Use scm_i_hashq for immediates and non-immediate integers. Use scm_raw_ihashq on pointers too. Update the vector and pairs hashing code. There is still some work to do here. (scm_ihashv, scm_ihash): Adapt. don't downcase characters before hashing them * libguile/hash.c (hasher, scm_ihashv): Don't downcase characters before hashing them. That is silly. scm_hasher is static * libguile/hash.c (hasher): Make static. * libguile/hash.h: Remove scm_hasher. add thomas wang's integer hash function; use it for hashq, hashv * libguile/hash.c (scm_raw_ihashq): Add Thomas Wang's integer hash function, from http://www.cris.com/~Ttwang/tech/inthash.htm. (scm_ihashq, scm_ihashv): Use it here. symbols.h reindent * libguile/symbols.h: Reindent. use bob jenkins' hashword2 hash from lookup3.c for our string hash * libguile/hash.c (JENKINS_LOOKUP3_HASHWORD2, narrow_string_hash) (wide_string_hash, scm_string_hash, scm_i_string_hash) (scm_i_latin1_string_hash): Replace our lame string hash with Bob Jenkins' hash, treating each codepoint as a word, for the purposes of the algorithm. There are probably more optimal hashes for our use cases. (scm_i_locale_string_hash): Remove optimization, as it wasn't used. (scm_i_utf8_string_hash): Add a specialized implementation for utf8. It's tricky but mostly just cut-and-paste. fix a vhash test * test-suite/tests/vlist.test ("vhash"): As far as I can tell this test was not testing the right thing. 2011-10-25 Andy Wingo optimize scm_from_utf8_stringn * libguile/strings.c (decoding_error): Factor out of scm_from_stringn, properly handling errno. (scm_from_stringn): Adapt. (scm_from_utf8_stringn): Inline the conversion here, to avoid going through iconv. most uses of scm_from_locale_symbol become scm_from_utf8_symbol * libguile/array-handle.c: * libguile/chars.c: * libguile/expand.c: * libguile/feature.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/instructions.c: * libguile/load.c: * libguile/macros.c: * libguile/memoize.c: * libguile/modules.c: * libguile/options.c: * libguile/print.c: * libguile/smob.c: * libguile/snarf.h: Change most uses of scm_from_locale_symbol to scm_from_utf8_symbol, as the symbols really are not locale-dependent. optimize utf8 symbol lookup * libguile/symbols.c (utf8_string_equals_wide_string) (utf8_lookup_predicate_fn, lookup_interned_utf8_symbol): Optimize utf8 symbol lookup. 2011-10-24 Andy Wingo slight scm_procedure_p, scm_i_procedure_arity refactor * libguile/procs.c (scm_procedure_p): * libguile/procprop.c (scm_i_procedure_arity): Refactor. remove CELL_P macro * libguile/private-gc.h: Remove private CELL_P macro. 2011-10-24 Andy Wingo add SCM_HEAP_OBJECT_BASE * libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM, returns a pointer to the start of its memory area on the heap. * libguile/bytevectors.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/numbers.h: * libguile/ports.c: * libguile/smob.c: * libguile/struct.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Use it. 2011-10-24 Andy Wingo add SCM_HEAP_OBJECT_P * libguile/tags.h (SCM_HEAP_OBJECT_P): New macro, an alias for SCM_NIMP. * libguile/arrays.c: * libguile/debug.c: * libguile/foreign.c: * libguile/gdbint.c: * libguile/guardians.c: * libguile/list.c: * libguile/modules.c: * libguile/options.c: * libguile/smob.c: * libguile/validate.h: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Use it instead of SCM_NIMP or !SCM_IMP. 2011-10-24 Andy Wingo boot_closure_print cleanup * libguile/eval.c (boot_closure_print): Get at the bits directly. 2011-10-24 Andy Wingo add SCM_{PACK,UNPACK}_POINTER * libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros. The old SCM2PTR and PTR2SCM were defined in such a way that round-tripping through a pointer could lose precision, even in the case in which you weren't interested in actually dereferencing the pointer, it was simply that you needed to plumb a SCM through APIs that take pointers. These new macros are more like SCM_PACK and SCM_UNPACK, but for pointer types. The bit representation of the pointer should be the same as the scm_t_bits representation. * libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS pointers. We are going to try tagging the SCM object itself in the future, and I don't think that keeping this support is worth its cost. It probably doesn't work anyway. * libguile/backtrace.c: * libguile/bytevectors.c: * libguile/continuations.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/hashtab.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/smob.c: * libguile/strings.c: * libguile/symbols.c: * libguile/vm.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Update many sites to use the new macros. 2011-10-24 Andy Wingo refactor tc7 and tc16 checks * libguile/tags.h (SCM_HAS_TYP7, SCM_HAS_TYP7S, SCM_HAS_TYP16): New macros. * libguile/bytevectors.h (SCM_BYTEVECTOR_P): * libguile/control.h (SCM_PROMPT_P): * libguile/filesys.h (SCM_DIRP): * libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_FLUID_P) (SCM_I_DYNAMIC_STATE_P): * libguile/foreign.h (SCM_POINTER_P): * libguile/fports.h (SCM_FPORTP): * libguile/frames.h (SCM_VM_FRAME_P): * libguile/hashtab.h (SCM_HASHTABLE_P): * libguile/inline.h (scm_get_byte_or_eof): * libguile/numbers.h (SCM_REALP, SCM_BIGP, SCM_COMPLEXP, SCM_FRACTIONP): * libguile/objcodes.h (SCM_OBJCODE_P): * libguile/ports.h (SCM_OUTPUT_PORT_P): * libguile/programs.h (SCM_PROGRAM_P): * libguile/smob.h (SCM_SMOB_PREDICATE): * libguile/srfi-14.h (SCM_CHARSETP): * libguile/strings.c (IS_STRING): * libguile/strports.h (SCM_STRPORTP): * libguile/symbols.h (scm_is_symbol): * libguile/variable.h (SCM_VARIABLEP): * libguile/vectors.h (SCM_I_IS_VECTOR, SCM_I_IS_NONWEAK_VECTOR): * libguile/vm-i-system.c (call, tail-call, mv-call) * libguile/vm.h (SCM_VM_P, SCM_VM_CONT_P): * libguile/weak-set.c (SCM_WEAK_SET_P): * libguile/weak-table.c (SCM_WEAK_TABLE_P): * libguile/weak-vector.h (SCM_I_WVECTP): Use them. 2011-10-24 Andy Wingo check for pairs with scm_is_pair, not scm_nimp * libguile/array-map.c (scm_ra_matchp, scm_ramapc): * libguile/dynwind.c (scm_swap_bindings): * libguile/hooks.c (hook_print, scm_c_run_hook, scm_c_run_hookn): * libguile/objprop.c (scm_object_property, scm_set_object_property_x): Use !scm_is_pair as the termination condition, not scm_imp. de-inline cons in scm_acons * libguile/alist.c (scm_acons): Don't inline the conses. remove mutex in make-object-property * module/ice-9/boot-9.scm (make-object-property): Remove the mutex; weak tables are now threadsafe. 2011-10-24 Andy Wingo remove weak pairs, rewrite weak vectors * libguile/weak-vector.c: * libguile/weak-vector.h: Renamed from weaks.[ch]. Remove weak pairs. They were not safe to access with `car' and `cdr'. Remove weak alist vectors, as we have weak tables and sets. Reimplement weak vectors, moving the implementation here. * libguile/vectors.c: * libguile/vectors.h: Remove the extra header word. Use scm_c_weak_vector_ref / scm_c_weak_vector_set_x to access weak vectors. * libguile/snarf.h: Remove the extra header word in vectors. * libguile/threads.c (do_thread_exit, fat_mutex_lock, fat_mutex_unlock): Instead of weak pairs, store thread-owned mutexes in a list of one-element weak vectors. * libguile/guardians.c (finalize_guarded): Similarly, store object guardians in a list of one-element weak vectors. * libguile/modules.c (scm_module_reverse_lookup): We no longer need to handle the case of weak references. * libguile/print.c (iprin1): Use the standard vector accessor to print vectors. * libguile.h: * libguile/Makefile.am: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/goops.c: * libguile/init.c: * libguile/objprop.c: * libguile/struct.c: Update includes. * module/ice-9/weak-vector.scm: Load weak vector definitions using an extension instead of %init-weaks-builtins. * test-suite/tests/weaks.test: Use the make-...-hash-table names instead of the old alist vector names. 2011-10-24 Andy Wingo remove a stale comment * module/system/foreign.scm (define-wrapped-pointer-type): Remove stale comment. 2011-10-24 Andy Wingo convert internal weak hash table users to use the weak table api The weak table API isn't public yet. It could be after some review. But we can go ahead and use it now internally. * libguile/foreign.c: * libguile/goops.c: * libguile/objprop.c: * libguile/procprop.c: * libguile/smob.c: * libguile/srcprop.c: Update weak table users to new API. No locking needed! 2011-10-24 Andy Wingo reimplement hashtab.c's weak hash tables in terms of weak-table.c * libguile/hashtab.c: * libguile/hashtab.h: Reimplement the weak hash table implementation in terms of weak tables. All is well except for the horrific hack for hashx tables. * libguile/weak-table.h: * libguile/weak-table.c (scm_make_weak_key_hash_table) (scm_make_weak_value_hash_table, scm_make_doubly_weak_hash_table) (scm_weak_key_hash_table_p, scm_weak_value_hash_table_p) (scm_doubly_weak_hash_table_p): Move these definitions here. 2011-10-24 Andy Wingo add weak table implementation * libguile/weak-table.c: * libguile/weak-table.h: New files, implementing open-addressed weak hash tables, similar to the implementation of weak sets. This will let us remove weak pairs. * libguile.h: * libguile/Makefile.am: * libguile/evalext.c: * libguile/gc.c: * libguile/init.c: * libguile/print.c: * libguile/tags.h: Update all the pieces for the new files and tc7. 2011-10-23 Andy Wingo add scm_c_make_port; the port table is now a weak set * libguile/ports.c (scm_c_make_port_with_encoding, scm_c_make_port): New functions, to replace scm_new_port_table_entry. Use a weak set instead of a weak table. (scm_i_remove_port): (scm_c_port_for_each, scm_port_for_each): Adapt to use weak set. (scm_i_void_port): Use scm_c_make_port. (scm_init_ports): Make a weak set. * libguile/fports.c: * libguile/ioext.c: * libguile/r6rs-ports.c: * libguile/strports.c: * libguile/vports.c: Adapt to use the new scm_c_make_port API. 2011-10-23 Andy Wingo symbols.c uses weak sets * libguile/symbols.c (lookup_interned_symbol) (lookup_interned_latin1_symbol, intern_symbol): Adapt to use weak sets instead of weak-key hash tables. 2011-10-23 Andy Wingo add weak sets * libguile/weak-set.c: * libguile/weak-set.h: New files, implementing weak sets, for use in the symbol table and port set. Eventually we will be able to remove weak pairs. * libguile.h: * libguile/Makefile.am: Add new files. * libguile/evalext.c: * libguile/gc.c: * libguile/init.c: * libguile/print.c: * libguile/tags.h: Add support for the new types. 2011-10-22 Ludovic Courtès Update `NEWS'. Fix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2. * libguile/deprecated.c (init_module_stuff, scm_primitive_make_property): Use `scm_is_false' instead of direct comparison to SCM_BOOL_F'. (maybe_close_port, scm_close_all_ports_except): Use `SCM2PTR' and `PTR2SCM' instead of wild casts. Bump version number for 2.0.3. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions `scm_is_exact' etc. (LIBGUILE_INTERFACE_AGE): Increment. Update Gnulib to v0.0-6523-gb3609c1. doc: Document the `sitedir' and `extensiondir' pkg-config variables. * doc/ref/libguile-parallel.texi (Parallel Installations): Document the `sitedir' and `extensiondir' pkg-config variables. This fixes , reported by Dale. P. Smith. 2011-10-22 Bake Timmons Fix compilation with `--enable-debug-malloc'. * libguile/gc-malloc.c (scm_gc_register_collectable_memory): Add the missing second argument in the call to scm_malloc_register. 2011-10-22 Ludovic Courtès Initialize `get_internal_run_time' before it is used. * libguile/init.c (scm_i_init_guile): Call `scm_init_stime' before `scm_init_gc'. Fixes reported by Bake Timmons. 2011-10-22 BT Templeton set width for `,trace' command * module/system/repl/command.scm (trace): Set trace width to terminal width by default. 2011-10-21 Andy Wingo fix segfault in goops if class fields are redefined * libguile/goops.c (map, filter_cpl, remove_duplicate_slots): Use scm_is_pair instead of !scm_is_null, given that we use accessor macros. (check_cpl, build_slots_list): Check that descendents of can't redefine slots of . * test-suite/tests/goops.test ("defining classes"): Add a test. Patch originally by Stefan Israelsson Tampe. 2011-10-20 Andy Wingo fix misallocation of some procedures * module/language/tree-il/analyze.scm (analyze-lexicals): When stepping into a non-tail form, we know that labels allocation will be invalid, so use an empty labels set. Fixes http://debbugs.gnu.org/9769. * test-suite/tests/tree-il.test ("labels allocation"): Add a test. 2011-10-19 Andy Wingo slight frames.h refactor * libguile/frames.h: Instead of doing a lot of nasty pointer match and casts here, simply define a struct that aliases the contents of a stack frame. There are some naming issues here, that the SCM_FRAME macros access the scm_vm_frame structure, but SCM_VM_FRAME macros access scm_frame; oh well. 2011-10-18 Ludovic Courtès doc: Add `libguile-parallel.texi' to the distribution. This is a followup to d32df1325dfe5f550cf1262dc7e90ba86b526a7c ("manual: reorganize autoconf, pkg-config info"). * doc/ref/Makefile.am (guile_TEXINFOS): Add `libguile-parallel.texi'. 2011-10-17 Andy Wingo fix (web http) write-date for mondays * module/web/http.scm (write-date): Fix bug on Mondays. Jeez! 2011-10-16 Ludovic Courtès doc: Complete renaming of `autoconf.texi'. This is a followup to d32df1325dfe5f550cf1262dc7e90ba86b526a7c ("manual: reorganize autoconf, pkg-config info"). * doc/ref/Makefile.am: Replace references to `autoconf.texi' by `libguile-autoconf.texi'. 2011-10-16 Ludovic Courtès Update (ice-9 match) from Chibi-Scheme. * module/ice-9/match.scm (match): Remove macro. * module/ice-9/match.upstream.scm: Update from Chibi-Scheme, which fixes . * test-suite/tests/match.test.upstream: Likewise. 2011-10-15 Ludovic Courtès coverage: Add tests for `case-lambda'. * test-suite/tests/coverage.test ("line-execution-counts")["case-lambda"]: New test. ("procedure-execution-count")["case-lambda"]: New test. doc: Mention the partial evaluator next to `define-inlinable'. * doc/ref/api-procedures.texi (Inlinable Procedures): Mention inlining performed by the partial evaluator. coverage: Add test with `eval'. * test-suite/tests/coverage.test (test-procedure): New procedure. ("procedure-execution-count")["called from eval"]: New test. 2011-10-15 Cedric Cellier Default to using poll(2) in `fport_input_waiting'. * libguile/fports.c (fport_input_waiting): Use poll(2) instead of select(2) when possible. Cosmetic changes by Ludovic Courtès. 2011-10-15 Andy Wingo revise comments in libguile/tags.h * libguile/tags.h: Revise the comments to reflect libgc reality. 2011-10-12 Andy Wingo update NEWS for 2.0.3 * NEWS: Update. 2011-10-12 Andy Wingo add "Installing Site Packages" * doc/ref/scheme-using.texi (Installing Site Packages): Add a new section about where to install .scm, .go, and .so files. * doc/ref/tour.texi: Reference it here. * doc/ref/guile.texi: Add new section. 2011-10-12 Andy Wingo update tour.texi for site modules and extensions * doc/ref/tour.texi (Putting Extensions into Modules) (Writing new Modules): In the examples, show the files as being in the "site" dirs. 2011-10-12 Andy Wingo manual: reorganize autoconf, pkg-config info * doc/ref/libguile-parallel.texi: New file, documenting parallel installation and the use of pkg-config. * doc/ref/libguile-linking.texi: Adapt. * doc/ref/libguile-autoconf.texi: Rename from autoconf.texi. Lower sections, and integrate in the "Programming in C" chapter. * doc/ref/guile.texi: Adapt. 2011-10-12 Andy Wingo remove documentation on autofrisk foo * doc/ref/autoconf.texi: Remove documentation on autofrisk facility, given that we do not ship those macros, and to my knowledge, never have. add (web client) docs * doc/ref/web.texi (Web Client): New doc section. 2011-10-10 Andy Wingo fold constants with accessors * module/language/tree-il/peval.scm (peval): Factor constant folding out to a helper. Use it in the accessor case in addition to the normal effect-free-primitive case. * test-suite/tests/tree-il.test: Add a test. 2011-10-10 Andy Wingo recognize string primitives * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add string?, string-length, and ref and set. (*primitive-accessors*): Add string-ref. (*effect-free-primitives*): Add string-length and string? (*effect+exception-free-primitives*): Add string?. (*singly-valued-primitives*): Add string-length and ref and set. 2011-10-10 Andy Wingo add ,expand and ,optimize * module/system/repl/command.scm (*command-table*, expand, optimize): New meta-commands. * module/system/repl/common.scm (repl-expand, repl-optimize): New helpers. * doc/ref/scheme-using.texi (Compile Commands): Document. 2011-10-10 Andy Wingo regenerate psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate, now with optimizations. 2011-10-10 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Does not include psyntax regeneration. Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il/peval.scm test-suite/tests/tree-il.test 2011-10-10 Andy Wingo regenerate psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate, now with inlined letrec bindings. Whee!! 2011-10-10 Andy Wingo peval support for memq and memv * module/language/tree-il/peval.scm (peval): Add special handlers for memq and memv, as inline.scm used to have. This is important for `case' clauses. It is very ugly, though. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests. 2011-10-10 Andy Wingo add accessor-primitive?, peval uses it * module/language/tree-il/primitives.scm (*primitive-accessors*): New set of primitives: those that access mutable memory, but are otherwise pure. Include bytevector references here. (accessor-primitive?): New public predicate. * module/language/tree-il/peval.scm (peval): Refactor to distinguish constructor-primitive? from accessor-primitive?. 2011-10-10 Andy Wingo peval: visit operands on-demand, to inline mutually recursive bindings This commit changes to use structures to hold the context needed to visit lexical bindings lazily, in context, instead of eagerly visiting them for value. This laziness enables inlining of mutually recursive bindings. * module/language/tree-il/peval.scm (): Remove comment about copy propagation having to run build-var-table; things don't work like that any more. (build-var-table): Build entries for all variables, even unreferenced variables. (alpha-rename): Remove. We will rename bindings on-demand now. (peval lookup-var): New helper, to fetch the of a gensym. (peval fresh-gensyms): Fold here, under peval, and in it, handle updating the store to record a mapping between new names and entries from the source program. (peval record-source-expression): Don't call build-var-table on the new expression, as alpha-renaming happens on-demand now. (peval prune-bindings): Rewrite to work with mutually-recursive bindings, while optionally preserving binding order. (peval extend-env): New helper. (peval loop): OK, here goes... Remove the `operand' context, as now we visit operands lazily. Add a `call' context, which does not copy-propagate lambda expressions, used to residualize a call after aborting an inlining attempt. Change the `env' to be a mapping of gensym to . Instead of looking up the operand's binding then alpha-renaming it, just rely on the fact that visiting the operand will rename it if necessary. If we residualize a lexical, do so with the fresh name from the environment. If we visit an operand and it doesn't turn out to be constant, we will never be able to copy it, and so cache that fact in the operand. If we residualize a binding and we know what the value should be, record that binding so that prune-bindings won't have to visit it again. If the operand folds to a constant, cache that too, to save effort when unrolling loops. For let, letrec, fix, and lambda-case, instead of visiting the bindings eagerly for value, simply record the source expressions and environments in an and rely on copy-propagation to visit them later in the right context. In the case of letrec and fix, this allows mutually-recursive bindings to be inlined. Refactor folding of "constructors" (which still need renaming) to avoid visiting operands twice in some contexts. For applications, if we have to abort, process the procedure in call context, which allows some folding but avoids copying lambdas. If we find a recursive procedure, mark intervening counters as recursive too, to allow for mutual recursion at the top level. For lambdas, if we are processing for value, record the source expression so we can detect recursion. This was previously done in the lexical-ref copy propagator. * test-suite/tests/tree-il.test ("partial evaluation"): Remove unused recursive lexicals in a couple of cases. Add a couple test cases for pruning. Add a few recursive binding cases. 2011-10-10 Andy Wingo peval: add operand structure * module/language/tree-il/peval.scm (): Add operand structure, to be used by peval. peval: refactor logging * module/language/tree-il/peval.scm: Make it easier to turn on logging. 2011-10-10 Mike Gran New functions scm_is_exact and scm_is_inexact * doc/ref/api-data.texi (Exact and Inexact Numbers): doc for scm_is_exact and scm_is_inexact * libguile/numbers.c (scm_is_exact, scm_is_inexact): new functions * libguile/numbers.h: declarations for scm_is_exact and scm_is_inexact * test/suite/standalone/test-conversion.c (test_is_exact, test_is_inexact): new tests 2011-10-09 Mike Gran Document SCM_ASSERT_TYPE and SCM_ASRTGO macros * doc/ref/api-control.texi (Signalling Type Errors): document macros 2011-10-08 Andy Wingo peval: logging * module/language/tree-il/peval.scm: Define a quick and dirty infrastructure for logging. Use it in peval. 2011-10-07 Andy Wingo peval: bugfix in constant-expression? * module/language/tree-il/peval.scm (constant-expression?): Correctly handle lambda-case alternates. optimizer verifies its output * module/language/tree-il/optimize.scm: Verify the result of partial evaluation. add tree-il verifier * module/Makefile.am: Add debug.scm. * module/language/tree-il/debug.scm: New file, a verifier for tree-il. 2011-10-06 Andy Wingo peval refactor * module/language/tree-il/peval.scm (peval): Refactor the for-value, etc helpers. comment peval.scm * module/language/tree-il/peval.scm: Add comments. Move alpha-rename later in the file. 2011-10-05 Andy Wingo fix reading of #||||# * libguile/read.c (scm_read_r6rs_block_comment): * test-suite/tests/reader.test ("reading"): Fix reading of #||||#, originally reported in bug debbugs.gnu.org/9672, by Bruno Haible. Thanks, Bruno! 2011-09-30 Ludovic Courtès peval: Add test for possible infinite recursion. * test-suite/tests/tree-il.test ("partial evaluation"): Add test. Add link to the (ice-9 match) bug. * module/ice-9/match.scm: Add comment. 2011-09-30 Ludovic Courtès peval: Recognize module-refs to primitives. * module/language/tree-il/optimize.scm (peval): Handle module-refs to primitives. * test-suite/tests/tree-il.test ("partial evaluation"): Add test, using `pmatch'. 2011-09-29 Andy Wingo regenerate psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate. 2011-09-29 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' This was a pretty big merge involving a fair amount of porting, especially to peval and its tests. I did not update psyntax-pp.scm, that comes in the next commit. Conflicts: module/ice-9/boot-9.scm module/ice-9/psyntax-pp.scm module/language/ecmascript/compile-tree-il.scm module/language/tree-il.scm module/language/tree-il/analyze.scm module/language/tree-il/inline.scm test-suite/tests/tree-il.test 2011-09-28 Andy Wingo generate psyntax-pp in canonical form * module/ice-9/compile-psyntax.scm (source): Canonicalize after optimizing. The optimizer should be a little more clever, but currently fix-letrec outputs some non-canonical forms. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-09-28 Andy Wingo separate peval and a new canonicalization pass into their own modules * module/language/tree-il/peval.scm: Move to its own file. Remove the bits about thunk-application bodies, as they are not optimizations, simply expectations of the compiler. `canonicalize' handles that now. * module/language/tree-il/optimize.scm: Use peval from its module. Don't call `inline!', as that's useless now. * module/language/tree-il/canonicalize.scm: New file, implementing a pass that `compile-tree-il' runs on the result from the optimizer. The compiler currently expects a form to have bindings, for example, and this pass turns a without bindings into its body. * module/language/tree-il/inline.scm: Deprecate, as `peval' does everything this function ever did. * module/language/tree-il/compile-glil.scm: Canonicalize after optimizing. This should allow us to skip the optimizer entirely, if we want. * module/Makefile.am: Update and reorder a little bit. 2011-09-28 Andy Wingo regenerate psyntax-pp.scm, with optimizations * module/ice-9/psyntax-pp.scm: Regenerate. ((lambda ...) ...) fix * module/language/tree-il/optimize.scm (peval): If it's a lambda in the operator position, inline without a nested counter, as it's not possible to increase code size. peval: more effective binding pruning * module/language/tree-il/optimize.scm (peval): Factor prune-bindings out of `let' and company. Have it process unreferenced bindings in effect context instead of always residualizing non-constant expressions. don't propagate pure primcalls that might not type-check * module/language/tree-il/optimize.scm (types-check?): New helper, to determine if a primcall will apply without throwing an exception. (peval): constant-expression? returns #f for expressions that don't types-check?. Effect-free primitives that type-check are void. fix unparse-tree-il of * module/language/tree-il.scm (unparse-tree-il): Fix printing of `dynset'. peval works on all expressions * module/language/tree-il/optimize.scm (alpha-rename, peval): Add cases. Allow any kind of . Remove the `catch' wrapper as now peval handles all kinds of expressions. 2011-09-28 Andy Wingo peval: elide make-prompt-tag in effect context * module/language/tree-il/optimize.scm (peval): Fix a duplicate traversal for constructors in effect or test context. Add support for eliding make-prompt-tag. * test-suite/tests/tree-il.test ("partial evaluation"): Update the test for make-prompt-tag elision. 2011-09-28 Andy Wingo peval: add support for and * module/language/tree-il/optimize.scm (alpha-rename, peval): Handle and . Attempt to remove the prompt if the tag is otherwise unreferenced. * module/language/tree-il/primitives.scm (*primitive-constructors*): Add make-prompt-tag as a constructor. * test-suite/tests/tree-il.test ("partial evaluation"): Add a test that an prompt whose tag is unreferenced is removed. 2011-09-28 Andy Wingo peval: fix algorithmic behavior of `cons' * module/language/tree-il/optimize.scm (peval): Fix treatment of `cons' to not process the value twice, leading to n^2 work. This prevented primitives.scm from compiling in a reasonable amount of time, because it contained a `(foo ... ,@bar) form that resulted in a long sequence of nested conses, and no effort counter was in place as it was not within an inlining attempt. 2011-09-27 Ludovic Courtès doc: (ice-9 match) doesn't have `__1'. * doc/ref/match.texi (Pattern Matching): Remove `__1', which doesn't exist. Thanks to Chris K. Jester-Young. doc: Update (ice-9 match) reference. * doc/ref/match.texi (Pattern Matching): Document `***', `..1', and `__1'; remove `..k' and `__k'. Reported by Chris K. Jester-Young. doc: Fix typesetting of function definitions in "Accessing Modules from C". * doc/ref/api-modules.texi (Accessing Modules from C): Use the phrase "C Function" instead of "C Procedure". Enclose multiple-word type names in braces. Reported by Dale P. Smith. 2011-09-27 Andy Wingo peval: more strict accounting * module/language/tree-il/optimize.scm (transfer!, make-nested-counter): (make-recursive-counter, peval): Limit the algorithm's time to be strictly O(N) by transferring effort and size counters of recursive inlining attempts from containing counters. * test-suite/tests/tree-il.test ("partial evaluation"): Update expectations for the ((lambda (x) (x x)) (lambda (x) (x x))) case, as the new accounting policy will cause the entire inlining attempt to abort. 2011-09-26 Andy Wingo peval: fix inlining of lambda* with #:optional * module/language/tree-il/optimize.scm (peval): Fix calculation of how many init expressions to drop when inlining lambdas. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests. 2011-09-26 Andy Wingo remove unused peval helpers * module/language/tree-il/optimize.scm (peval): Remove a couple unused helpers. 2011-09-25 Andy Wingo peval: simpler and more precise treatment of mutability * module/language/tree-il/optimize.scm (peval): The old approach of optimistically producing constants and then de-constifying them at their uses was not only cumbersome but incorrect: it both failed to preserve identity in some cases and failed to retain immutable constant values. Instead, now we only produce constants if they really are constant and immutable. The constant folder has to have a few more algebraic cases to be as effective as it was, to destructure (car (cons _ _)) appropriately. On the plus side, now constructors and deconstructors can handle impure cases more generally. * test-suite/tests/tree-il.test ("partial evaluation"): Add constructor and destructuring tests. Adapt other tests to new expectations. 2011-09-25 Andy Wingo peval: add a bunch of missing maybe-unconst calls * module/language/tree-il/optimize.scm (peval): Add missing maybe-unconst calls. Things are getting ugly. They will get better in the next commit though. 2011-09-25 Andy Wingo peval uses effort counters, propagates lambdas more effectively * module/language/tree-il/optimize.scm (code-contains-calls?): Remove this helper, we will deal with recursion when it happens, not after the fact. (peval): Add keyword args for various size and effort limits. Instead of keeping a call stack, keep a chain of records, each with an abort continuation. If ever an inlining attempt is taking too long, measured in terms of number of trips through the main loop, the counter will abort. Add new contexts, `operator' and `operand'. They have different default size limits. In the future we should actually use the size counter, instead of these heuristics. The case is smarter now, and tries to avoid propagating too much data. Perhaps it should be dumber though, and use a counter. That would require changes to the environment structure. Inline applications to , so that we allow residual lexical references to have bindings. Add a `for-operand' helper, and use it for the RHS of `let' expressions. A `let' is an inlined `lambda'. `Let' and company no longer elide bindings if the result is a constant, as the arguments could have effects. Peval will still do as much as it can, though. * test-suite/tests/tree-il.test ("partial evaluation"): Update the tests for the new expectations. They are uniformly awesomer, with the exception of two cases in which pure but not constant data is not propagated. 2011-09-24 Andy Wingo prune unused letrec bindings * module/language/tree-il/optimize.scm (peval): Prune unused `letrec' bindings. more peval refactoring * module/language/tree-il/optimize.scm (peval): Rename `var-table' to `store', as we're going to put some more things in it. Rename `record-lexical-bindings' to `record-source-expression', which also takes the original, pre-renaming expression. Keep a mapping from new expressions to original expressions, available using the `source-expression' helper. add helpers for effort counters * module/language/tree-il/optimize.scm (, abort-counter) (record-effort!, record-size!, find-counter, make-top-counter) (make-nested-counter, make-recursive-counter): New helpers, as yet unused, but which will implement fixed effort bounds on the inlining algorithm. peval refactor * module/language/tree-il/optimize.scm (peval): Add for-value, for-test, for-effect, and for-tail helpers. Use them. 2011-09-24 Andy Wingo attempt to prune unreferenced bindings * module/language/tree-il/optimize.scm (peval): Rename `record-lexicals' to `record-lexical-bindings'. Record residualized lexical references. Record lexical references in maybe-unlambda. Unfortunately this has the disadvantage that the speculative mapping of lambda expressions to lexical references records that reference, even if we are not going to residualize it. After processing a `let', prune pure unreferenced bindings. (We can do better than this in the future: we can simply process them for effect.) * test-suite/tests/tree-il.test (pass-if-peval): More debugging. ("partial evaluation"): Update to reflect the fact that the `y' binding won't be emitted. 2011-09-24 Andy Wingo peval handles lexical-set * module/language/tree-il/optimize.scm (alpha-rename, peval): Add support for lexical-set, while avoiding copy propagation and pruning of assigned variables. peval: pre-analyze mutated or reffed-once lexicals * module/language/tree-il/optimize.scm (, build-var-table, peval): Before going into peval, build a table indicating refcounts and a set? flag for all lexicals. Add to the table when introducing new bindings (via alpha-renaming). 2011-09-24 Andy Wingo peval: don't propagate expressions that access memory * module/language/tree-il/optimize.scm (peval): Rename `pure-expression?' to `constant-expression?', in the sense of GCC's `pure' and `const'. A is not constant, because it can be mutated. A isn't constant either, for the same reason. * test-suite/tests/tree-il.test ("partial evaluation"): Add a test, and update existing tests that assumed that toplevel-ref would propagate. 2011-09-24 Andy Wingo context-specific folding for peval in test and effect contexts * module/language/tree-il/optimize.scm (peval): Add a "test" context, which folds statically decidable values to . Fold pure expressions to in "effect" contexts. Adapt the and tests to simply look for or expressions, respectively. thread a context through peval * module/language/tree-il/optimize.scm (peval): Thread a "context" through the evaluator. 2011-09-24 Andy Wingo paper around `match' bug * module/ice-9/match.scm (match): Always introduce a lexical binding, to avoid http://debbugs.gnu.org/9567. Real fix ongoing. Patch and original report by Stefan Israelsson Tampe. * test-suite/tests/match.test: Add test. 2011-09-24 Andy Wingo peval: various bugfixes * module/language/tree-il/optimize.scm (alpha-rename): Rename the init expressions of a . (peval): Coalesce the clauses. Fix pure-expression? matching of clauses. Loop over and maybe-unconst the inits of a . tree-il-any bugfix * module/language/tree-il/optimize.scm (tree-il-any): Fix to be called on all values, including leaves. It didn't matter for the use case, though. minor peval style tweak * module/language/tree-il/optimize.scm (peval): Minor refactor to copy propagation. fix alpha-rename for kwargs * module/language/tree-il/optimize.scm (alpha-rename): Fix alpha-renaming of keyword arguments. 2011-09-23 Ludovic Courtès peval: Add test for multiple-value returns. * test-suite/tests/tree-il.test (pass-if-peval): Support the `resolve-primitives' keyword. ("partial evaluation"): Add test for `call-with-values'. peval: Rectify style. * module/language/tree-il/optimize.scm (peval): Rename `src' to `lv-src', and `src2' to `src'; pass `make-let-values' the right source locations. Reindent `let*'. 2011-09-23 Andy Wingo prevent propagation for memory-dependent operations like `car' * module/language/tree-il/primitives.scm (*primitive-constructors*): Record car, cdr, vector-ref, and struct-ref as "constructors". Comment to come later. (*effect-free-primitives*): Update. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests. 2011-09-21 Andy Wingo peval comment & reindentation * module/language/tree-il/optimize.scm (peval): Add a comment regarding failure modes, and reindent one clause. fix comment regarding alpha-renaming * module/language/tree-il/optimize.scm (peval): Fix comment regarding alpha-renaming: it's not simply the allocator that needs unique names; rather, all transformations depend on it. better pure-expression? * module/language/tree-il/optimize.scm (peval): Allow dynref, fix, and let-values to be pure expressions. more alpha-rename robustness * module/language/tree-il/optimize.scm (alpha-rename): Handle all kinds of tree-il, with the current exceptions of lexical set!, prompt, and abort. more robust alpha-renaming * module/language/tree-il/optimize.scm (fresh-gensyms): New helper. (alpha-rename): Name the new gensyms using the old names as templates, not the old gensyms. This prevents accidental collisions between gensyms, if #{x 1}# becomes #{x 12}# instead of #{x 2}#. peval: inlining of let-values * module/language/tree-il/optimize.scm (peval): Add support for let-values. Try to inline the consumer into the body of the producer, if there is only one return point, and we can figure out how many values are being returned, and that number is compatible with the consumer. peval support for more forms * module/language/tree-il/optimize.scm (peval): Add support for fix, dynwind, dynlet, dynref, module-set, and toplevel-set. (Mutating a variable directly is similar to calling a function that does so behind our backs, so this presents no additional problem.) add singly-valued-primitive? * module/language/tree-il/primitives.scm (singly-valued-primitive?): New predicate, for primitives that return exactly one value. more optimize.scm factoring * module/language/tree-il/optimize.scm (vlist-any): New helper. (peval): Use it here. optimize.scm refactor * module/language/tree-il/optimize.scm (let/ec, tree-il-any): New helpers. (code-contains-calls?): Use them here. 2011-09-21 Daniel Llorens Fix compilation of untyped arrays of rank not 1 * module/language/glil/compile-assembly.scm: vector-fold2 expects vector. 2011-09-19 Julian Graham Remove extraneous semicolon from `SCM_STATIC_SUBR_OBJVECT' to prevent ISO C90 warning. * snarf.h (SCM_STATIC_SUBR_OBJVECT): Remove semicolon at end of macro definition. 2011-09-18 Ludovic Courtès peval: Abort inlining when the residual code contains recursive calls. * module/language/tree-il/optimize.scm (code-contains-calls?): New procedure. (peval): Use it and abort inlining if the residual code of a procedure application contains recursive calls. Suggested by Wingo, Waddell, and Dybvig. Fixes . * test-suite/tests/tree-il.test ("partial evaluation"): Update 2 tests that relied on the previous behavior. Add 1 another test. 2011-09-18 Ludovic Courtès peval: Improve alpha-renaming test. * test-suite/tests/tree-il.test ("partial evaluation")["inlined lambdas are alpha-renamed"]: Rewrite. 2011-09-18 Ludovic Courtès Arrange so that stack-cleaning loops in GC tests are not optimized out. * test-suite/tests/gc.test (stack-cleanup): New procedure. ("Unused modules are removed"): Use it. * test-suite/tests/threads.test (stack-cleanup): Likewise. ("mutex with owner not retained (bug #27450)"): Use it. 2011-09-17 Ludovic Courtès peval: Typo. * module/language/tree-il/optimize.scm (peval)[maybe-unlambda]: Fix typo in comment. 2011-09-17 Ludovic Courtès peval: Alpha-rename anonymous lambdas that are duplicated. * module/language/tree-il/optimize.scm (alpha-rename): New procedure. (peval)[maybe-unlambda]: Use it. * test-suite/tests/tree-il.test ("partial evaluation"): Add two test cases for . 2011-09-15 Andy Wingo Revert "SCM is a union" This reverts commit 8787d7a17029a8add20bb8e652ec744bc5d4e6c4. 2011-09-15 Andy Wingo Revert "SCM is either a union or scm_t_bits" This reverts commit 80125469ef95f6d8d46a26619fb2f85151f32719. Conflicts: libguile/__scm.h 2011-09-13 Ludovic Courtès peval: Use `resolve-primitives!'. * module/language/tree-il/optimize.scm (peval): Add `cenv' optional argument; caller updated. Use `resolve-primitives!' to resolve expressions. peval: Clarify `pure-expression?'. * module/language/tree-il/optimize.scm (peval)[pure-expression?]: Clarify the comment. 2011-09-13 Ludovic Courtès peval: Inline thunks. * module/language/tree-il/optimize.scm (peval): Inline thunks. * test-suite/tests/tree-il.test ("partial evaluation"): Add test. 2011-09-13 Ludovic Courtès peval: Use the right scope when replacing a lambda by a lexical-ref. * module/language/tree-il/optimize.scm (peval)[maybe-unlambda]: New procedures. Use it to de-duplicate named lambdas. This fixes the scoping bug described at . * test-suite/tests/tree-il.test ("partial evaluation"): Add tests to reproduce the bug. 2011-09-13 Ludovic Courtès peval: Add tests for inlining with both static & dynamic arguments. * module/language/tree-il/optimize.scm (peval): Improve comment on the inlining heuristics. * test-suite/tests/tree-il.test ("partial evaluation"): Add two tests. 2011-09-11 Ludovic Courtès peval: Propagate only pure expressions to lambdas. * module/language/tree-il/optimize.scm (peval): Propagate ARGS to BODY only when all of ARGS are pure. Change APP to use `maybe-unconst' for its arguments. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests for mutability preservation and non-propagation of non-constant arguments to lambdas. 2011-09-11 Ludovic Courtès peval: Try hard to preserve mutability. * module/language/tree-il/optimize.scm (peval)[make-values]: Distinguish between 1 or another number of values. [mutable?, make-value-construction, maybe-unconst]: New procedures. Use it in , , , and . * test-suite/tests/tree-il.test ("partial evaluation"): Add tests for mutability preservation. 2011-09-11 Ludovic Courtès doc: Fix typo regarding vhashes. * doc/ref/api-compound.texi (VHashes): s/vlist-/alist-/. 2011-09-10 Andy Wingo fix scm_to_latin1_stringn for substrings * libguile/strings.c (scm_to_latin1_stringn): Fix for substrings. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-scm-to-latin1-string.c: Add test case. Thanks to David Hansen for the bug report and test case, and Stefan Israelsson Tampe for the fix. 2011-09-10 Ian Price RFC 822 allows single digit days of the month * module/web/http.scm (parse-rfc-822-date): Add single digit day conditional. * test-suite/tests/web-http.test("general headers"): Add test. Fix --listen option to allow other ports * module/ice-9/command-line.scm (compile-shell-switches): Fix off-by-one error in 'substring', and swap branches of conditional. 2011-09-09 Ludovic Courtès Unoptimize the busy loop of `statprof.test'. This is a followup to f9c1b8278dbf1992d83f91f91391ee39e714d364 ("Tweak `statprof.test' for faster machines."). * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Compile with `#:partial-eval? #f'. 2011-09-09 Ludovic Courtès Remove unused macro in `tree-il.test'. * test-suite/tests/tree-il.test (assert-scheme->glil): Remove. doc: Use fashionable terminology for macros. * doc/ref/api-macros.texi (Macros): Mention EDSLs. 2011-09-09 Ludovic Courtès Clarify `--debug' vs. `--no-debug'. * module/ice-9/command-line.scm (*usage*): Attempt to suggest that `--no-debug' doesn't inhibit debugging support. * doc/ref/guile-invoke.texi (Command-line Options): Make it clear that `--no-debug' doesn't inhibit debugging support. Reported by Manuel Serrano. 2011-09-09 Ludovic Courtès Tweak `statprof.test' for faster machines. * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Increase NUM-CALLS and the frequency so that they are at least a few samples on my new 2.6 GHz laptop. 2011-09-09 Ludovic Courtès Add a partial evaluator for use in the compiler. Thanks to William R. Cook for his excellent tutorial, . * module/language/tree-il/optimize.scm (optimize!): Call `peval' unless the #:partial-eval? option asks otherwise. (peval): New procedure. * module/language/tree-il/inline.scm: Add comment. * module/language/tree-il/primitives.scm (*primitive-constructors*): New variable. (*effect-free-primitives*): Use it. (constructor-primitive?): New primitive. * test-suite/tests/tree-il.test (assert-tree-il->glil): Extend to support `with-partial-evaluation', `without-partial-evaluation', and `with-options'. (peval): New binding. (pass-if-peval): New macro. ("lexical refs"): Run tests without partial evaluation. ("letrec"): Likewise. ("the or hack"): Likewise. ("conditional"): Likewise, for some tests. ("sequence"): Adjust to new generated code. ("partial evaluation"): New test prefix. 2011-09-06 Ludovic Courtès Use (ice-9 match) instead of `record-case' where it improves readability. * module/language/tree-il/analyze.scm (goops-toplevel-definition, const-fmt): Replace `record-case' by `match'. (format-analysis): Likewise, partially. 2011-09-03 Ludovic Courtès Fix misdiagnoses of deprecated `+nan.[^0]' forms. * libguile/numbers.c (mem2ureal): Check the result of `mem2uinteger' against `SCM_INUM0', not 0. (mem2uinteger): Add comment. doc: Augment "Pattern Matching" section. * doc/ref/match.texi (Pattern Matching): Mention records. Add an example showing record matching and the `=' pattern. Point users to `match.upstream.scm'. 2011-09-03 Ludovic Courtès Update (ice-9 match) from Chibi-Scheme. * module/ice-9/match.scm (slot-ref, slot-set!, is-a?): New macros. * module/ice-9/match.upstream.scm: Update from Chibi-Scheme. * test-suite/Makefile.am (SCM_TESTS): Add `tests/match.test.upstream'. * test-suite/tests/match.test (rtd-2-slots, rtd-3-slots): New record types. ("matches")["records"]: New test prefix. ("doesn't match")["records"]: New test prefix. Include `match.test.upstream'. * test-suite/vm/t-match.scm (matches?): Fix `$' example. 2011-09-03 Ludovic Courtès Remove Front-Cover and Back-Cover text from the manual. * doc/ref/guile.texi: Remove Front-Cover and Back-Cover text. 2011-09-03 Andy Wingo deprecate +nan.1 * libguile/numbers.c (mem2ureal): Deprecate nan values that are not "+nan.0". 2011-09-02 Andy Wingo fix srfi-67 compilation * module/srfi/srfi-67/compare.scm: Fix define-syntax-rule conversion. fix some cache consistency issues with goops and extended generics * module/oop/goops.scm (extended-by!, not-extended-by!) (upgrade-accessor, merge-generics): Invalidate the method cache after munging "extends" or "methods" fields. (invalidate-method-cache!): A new wrapper around %invalidate-method-cache!, that will also invalidate the caches of "extended-by" generics. (internal-add-method!, remove-class-accessors!): Use the new invalidate-method-cache!. document define-syntax-rule * doc/ref/api-macros.texi (Syntax Rules): Add define-syntax-rule. more define-syntax-rule usage * module/ice-9/boot-9.scm: * module/ice-9/control.scm: * module/ice-9/futures.scm: * module/ice-9/optargs.scm: * module/ice-9/poll.scm: * module/ice-9/receive.scm: * module/ice-9/threads.scm: * module/ice-9/vlist.scm: * module/language/assembly/compile-bytecode.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/tree-il.scm: * module/oop/goops.scm: * module/oop/goops/simple.scm: * module/oop/goops/stklos.scm: * module/srfi/srfi-1.scm: * module/srfi/srfi-35.scm: * module/srfi/srfi-39.scm: * module/srfi/srfi-45.scm: * module/srfi/srfi-67/compare.scm: * module/sxml/match.scm: * module/system/repl/error-handling.scm: * module/system/repl/repl.scm: * module/system/vm/inspect.scm: * module/texinfo.scm: * module/web/server.scm: Use define-syntax-rule, where it makes sense. 2011-09-02 Andy Wingo psyntax uses define-syntax-rule * module/ice-9/psyntax.scm: Use define-syntax-rule. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-09-02 Andy Wingo add define-syntax-rule * module/ice-9/psyntax.scm (define-syntax-rule): Add this new helper macro, to define a syntax-rules macro with one clause. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-08-31 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/bytevectors.c libguile/bytevectors.h libguile/objcodes.c libguile/r6rs-ports.c libguile/strings.c libguile/vm.c 2011-08-29 Andy Wingo fix scm_gc_strdup invocation * libguile/i18n.c (get_current_locale): Fix scm_gc_strdup invocation. texinfo: add paragraphindent * module/texinfo.scm (texi-command-specs): Add paragraphindent. 2011-08-23 Andy Wingo module-stexi-documentation #:docs-resolver keyword arg * module/texinfo/reflection.scm (module-stexi-documentation): Make #:docs-resolver a keyword argument. Provide back compat with docs-resolver as an optional argument, though. 2011-08-23 Andy Wingo texinfo: alias `url' to `uref'. * module/texinfo.scm (texi-command-specs, complete-start-command): Upstream texinfo has aliased `url' to `uref'. Let's do the same. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test. 2011-08-19 Andy Wingo better guild help FOO * module/scripts/help.scm (show-help, show-summary, show-usage): Grovel for %synopsis and %help variables as well, and show them appropriately. Export these routines for other script modules to use. Needs documentation. 2011-08-18 Andy Wingo fix order of importing modules and resolving duplicates handlers * module/ice-9/boot-9.scm (define-module*): Resolve duplicates handlers only after importing modules. Fixes a bug in which a module with #:use-module (oop goops) but whose merge-generics handler got resolved to noop instead of the real merge-generics handler. I can't think of an easy way to test this, though. Thanks to David Pirotte for the report! 2011-08-18 Andy Wingo fix a couple of leaks * libguile/bytevectors.h: * libguile/bytevectors.c (scm_c_take_gc_bytevector): Rename this internal function, from scm_c_take_bytevector. This indicates that unlike the other scm_take_* functions, this one takes GC-managed memory. * libguile/objcodes.c (scm_objcode_to_bytecode): * libguile/vm.c (really_make_boot_program): Use scm_gc_malloc_pointerless, not scm_malloc. Thanks to Stefan Israelsson Tampe! * libguile/r6rs-ports.c: * libguile/strings.c: Adapt to renames. 2011-08-18 Andy Wingo reword open-file docs * doc/ref/api-io.texi (File Ports): Refactor open-file docs. Thanks to Bake Timmons for the report. 2011-08-17 Andy Wingo fix scm_tmpfile leak * libguile/posix.c (scm_tmpfile): Fix to actually close the new tmpfile, causing its deletion, while keeping an fd to the file open. Fixes a leak both in memory and disk space on POSIX systems; MINGW systems will leak however. A FIXME for later. fix r6rs `map' * module/rnrs/base.scm (map): Define a version of map that is safe for multiple returns, though slower. check that srfi-1 procedure arguments are procedures * module/srfi/srfi-1.scm (check-arg, wrong-type-arg): Refactor arg type checkers to be macros, and do the minimal amount of work in the functions themselves. Use these checkers consistently for all procedure arguments in this module. This catches user errors early; see bug 33628. fix recursive define-inlinable expansions * module/ice-9/boot-9.scm (define-inlinable): Prevent expansion from diverging by using fluid-let-syntax, as Dybvig suggests. srfi-9 record compatibility with boot-9 records * module/srfi/srfi-9.scm (define-record-type): Instead of defining the RTD using make-vtable, use make-struct with the record-type-vtable, and record the type name and fields names in the vtable. This way SRFI-9 records are compatible with boot-9 records. Also we use a generic printer, instead of generating one anew. 2011-08-16 Andy Wingo fix leak in get_current_locale() * libguile/i18n.c (get_current_locale): Hold the locale name in a GC-managed string, not a mallocated string. Thanks to Stefan Israelsson Tampe for the report. 2011-08-12 Andy Wingo fix take-right and drop-right for improper lists * libguile/srfi-1.h: * libguile/srfi-1.c (scm_srfi1_drop_right, scm_srfi1_take_right): Remove these internal functions, replacing with Scheme implementations. * module/srfi/srfi-1.scm (take-right, drop-right): Add these impls from the reference code. They do the right thing for improper lists, according to the spec, but they diverge for circular lists. Oh well. * test-suite/tests/srfi-1.test ("drop-right", "take-right"): Add more tests. 2011-08-04 Andy Wingo fix tree-il->scheme test * module/language/tree-il.scm (tree-il->scheme): Fix incorporation of `lambda' in a `case-lambda'. * test-suite/tests/tree-il.test ("tree-il->scheme"): Add a test. 2011-08-04 Andy Wingo (web http): locale-independent parsing and serialization of dates * module/web/http.scm (parse-month, parse-rfc-822-date): (parse-rfc-850-date, parse-asctime-date, parse-date): (write-date): Parse and write dates without regard to the current locale, using a custom parser. Also permits parsing of the deprecated RFC 850 and asctime() date formats. 2011-08-04 Andy Wingo srfi-19 refactor * module/srfi/srfi-19.scm (priv:locale-number-separator, priv:locale-am) (priv:locale-am): Inline definitions. Strip priv: prefix from module vars, as it's unnecessary, except for in a couple cases. 2011-08-03 Andy Wingo avoid duplicate stats when searching for files in a path * libguile/load.c (search_path): Extract from scm_search_path, to give the caller the stat buffer of the found path. (scm_search_path, scm_sys_search_load_path): Adapt accordingly. (compiled_is_fresh): Take the stat buffers directly. (scm_primitive_load_path, scm_init_eval_in_scheme): Adapt to search_path / compiled_is_fresh changes to avoid duplicate states in search-path. fix unnecessary call to canonicalize_path in load-path fast case * libguile/load.c (scm_primitive_load_path): Don't canonicalize the filename unless we need to look in the fallback path. Fixes a stat explosion; see http://savannah.gnu.org/bugs/?33815. 2011-07-29 Andy Wingo simplify narrow_stack. * libguile/stacks.c (narrow_stack): Simplify outer narrowing by a number of frames. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. style fix in read.c * libguile/read.c (scm_read_sexp): No need to assign to tmp here. minor style fix in bytevectors.c * libguile/bytevectors.c (SCM_BYTEVECTOR_HEADER_BYTES): Use sizeof scm_t_bits, not sizeof SCM. It's the same, but it seems like the right thing. fix a leak on startup from script.c * libguile/script.c (scm_get_meta_args): Free nargv. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. We leak narg though. 2011-07-28 Andy Wingo fix read beyond end of hashtable size array in hashtab.c * libguile/hashtab.c (make_hash_table): Fix read beyond end of hashtable_size array. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. fix write beyond array end in arrays.c * libguile/arrays.c (scm_i_read_array): Fix write past end of array while reading array type tag. Fix non-ascii type tag elements. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. fix list validation bug in @abort * libguile/control.c (scm_at_abort): Fix to ensure that we store the return of scm_ilength in a signed integer, even if later we copy it to an unsigned. See http://article.gmane.org/gmane.lisp.guile.devel/12685. remove dead code in scm_ceiling_quotient * libguile/numbers.c (scm_ceiling_quotient): Remove dead code. See http://article.gmane.org/gmane.lisp.guile.devel/12685. fix scm_i_tag_name * libguile/gc.c (scm_i_tag_name): Fix to work as intended, though it was not called. See http://article.gmane.org/gmane.lisp.guile.devel/12685. 2011-07-26 Andy Wingo export from goops, to appease texinfo reflection * module/oop/goops.scm (): Actually define this class. Also, group the export with the other SMOB types. 2011-07-25 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION test-suite/tests/srfi-4.test fix GC_get_suspend_signal on Mac OS * libguile/scmsigs.c (GC_get_suspend_signal): Fix the back-compatibility shim for this function to work on some other cases; I hadn't realized that gcconfig.h could set SIG_SUSPEND. Thanks to Aleix Conchillo Flaqué for the report. 2011-07-23 Ludovic Courtès guild: Close over `$bindir/guile'. * configure.ac: Substitute `guile_program_name'. * meta/guild.in: Use `@bindir@/@guile_program_name@' by default. * meta/uninstalled-env.in: Define $GUILE. 2011-07-23 Ludovic Courtès Change `guild --help' and `--version' output to be more GNUish. * meta/guild.in (display-version): Display the version, not the effective version. * module/scripts/help.scm (list-commands)[help]: Add proper footer, as per the GCS. 2011-07-23 Ludovic Courtès doc: Remove redundant footnote about the former name of `guild'. * doc/ref/scheme-using.texi (Using Guile Tools): Remove redundant footnote introduced in e108c961fed2ffdedddcd10bad9c6aae44491b1e. Mention the version where the new name was introduced. Export `main' from (scripts help). * module/scripts/help.scm: Export `main'. 2011-07-23 Andy Wingo add support for guild help FOO * module/scripts/help.scm (main): Add support for guild help FOO. 2011-07-23 Andy Wingo add (scripts help) * meta/guild.in (display-version): Use (ice-9 command-line)'s version-etc. (main): Dispatch --help to guild help. * module/scripts/help.scm: New file, a copy of list.scm, but with a better name. * module/Makefile.am: Add help.scm to the list. * module/scripts/list.scm: Change to be an alias to "help". (list-scripts): Restore this API. 2011-07-23 Andy Wingo more work on "guild list" * module/scripts/: Add %summary entries, and in many cases, %include-in-guild-list entries to inhibit a script from appearing in "guild list". Update list.scm to respect this new variable. 2011-07-23 Andy Wingo remove scripts PROGRAM * module/scripts/PROGRAM.scm: Remove this useless template, which was cluttering `guild list'. We'll perhaps cull the list a bit more in 2.2. * module/Makefile.am: Adapt. 2011-07-23 Andy Wingo a prettier `guild list' * module/scripts/list.scm (strip-extensions): Don't list programs without extensions. (main): Be prettier. Parse out a %summary from modules, for a brief synopsis. 2011-07-21 Andy Wingo add a site dir to %load-compiled-path * libguile/Makefile.am (libpath.h): Define SCM_SITE_CCACHE_DIR. Defined as site-ccache/ instead of site/ccache/ to indicate that we don't expect further subdirectories, and also to avoid confusion about whether extensions/ is a site-specific or not. * libguile/load.c (scm_init_load_path): Add SCM_SITE_CCACHE_DIR to the default load-compiled path. 2011-07-21 Andy Wingo open-socket-for-url returns port in latin1 encoding * module/web/client.scm (open-socket-for-uri): Set port encoding to latin1, to see if this fixes Nalin Garut's problems. 2011-07-18 Andy Wingo fix web-request.test * test-suite/tests/web-request.test ("example-1"): Fix expected format of `host' header. 2011-07-15 Andy Wingo ensure presence of Host header in HTTP/1.1 requests * module/web/request.scm (build-request): Make sure that HTTP/1.1 requests have the Host header set, per RFC 2616 section 9. * test-suite/tests/web-request.test ("example-1"): Add test. 2011-07-15 Andy Wingo add (web client) * module/web/client.scm: New module, a simple synchronous web client. * module/Makefile.am (WEB_SOURCES): Add to the build. 2011-07-13 Ludovic Courtès Fix `open' mode bits on GNU/Hurd. * libguile/filesys.c (scm_open): Fix check for read-write flags for systems such as GNU/Hurd, where O_RDWR == (O_WRONLY | O_RDONLY) and O_RDONLY != 0. Define `O_NOTRANS' on GNU/Hurd. * libguile/filesys.c (scm_init_filesys): Define `O_NOTRANS' when available. Disable TLS on NetBSD up to 5.x included. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Disable TLS on `x86_64-unknown-netbsd5.1' too. Add document describing the release process. * doc/release.org: New file. 2011-07-07 Andy Wingo fix CPL of and * libguile/goops.c (fix_cpl): Fix bug in placement of debug assertion. (create_standard_classes): Put before in 's direct supers, so that the slot allocation is a superset of , which results in the `setter' being allocated in the same place. Likewise fix to place before , not just . 2011-07-07 Andy Wingo fix invocation of duplicate handlers for merge-generics * libguile/modules.c (resolve_duplicate_binding): Fix unbound -> #f conversion for the imported bindings. Pass the existing entry in the import obarray as the resolved var (7th arg), and properly pass #f as the value (8th arg) if there is no such binding. Fixes merge-generics; before, the type test (indicating no previous value) was not being triggered. This bug has been present since 2007 at least, though it was not in 1.8. * test-suite/tests/modules.test ("duplicate bindings"): Add a test that the var and val are both #f. These types are used by GOOPS. 2011-07-07 Andy Wingo goops.scm cleanups * module/oop/goops.scm (make-generic, make-extended-generic): (ensure-generic, make-accessor, ensure-accessor): Use optional arguments for #:name. `make-extended-generic' also accepts empty extension lists. more precision for ,time * module/system/repl/command.scm (time): Use the high-precision timers instead of stime(2). Changes the output format of `,time' too; perhaps there is a better way. 2011-07-07 Ludovic Courtès Fix typo in (language tree-il spec). * module/language/tree-il/spec.scm (join): Use EXPS in the error case. Export `' from (oop goops). * module/oop/goops.scm: Export `'. 2011-07-06 Ludovic Courtès doc: Fix `merge-generics' example. * doc/ref/goops.texi (Merging Generics): Change (my-module) example to use (oop goops) and use the right syntax for #:duplicates. Reported by David Pirotte . configure: Build a `tar.xz' in addition to `tar.gz'. * configure.ac: Explicitly require Automake 1.11. Add Automake option `dist-xz'. 2011-07-06 Ludovic Courtès VM: Keep jump table address in a register. * libguile/vm-engine.c (VM_NAME)[HAVE_LABELS_AS_VALUES]: Rename `jump_table' to `jump_table_pointer'. Add `jump_table' as a local variable, initialize it. * libguile/vm-engine.h (JT_REG): New macro. 2011-07-01 Ludovic Courtès Bump version number for 2.0.2. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C function `scm_peek_byte_or_eof'. (LIBGUILE_INTERFACE_AGE): Increment. Update `NEWS'. Revert "Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'." This reverts commit ccb80964cd7cd112e300c34d32f67125a6d6da9a, which introduced a race condition, with a small window during which a mutex could be held by a thread without being part of its `mutexes' list, thereby violating the invariant tested at line 667. Update Gnulib to v0.0-5874-g7170ee0. Type-check the OWNER argument of `lock-mutex'. * libguile/threads.c (scm_lock_mutex_timed): Type-check OWNER. 2011-07-01 Ludovic Courtès Add type and range checks to the complex generalized vector accessors. * libguile/bytevectors.c (COMPLEX_ACCESSOR_PROLOGUE, COMPLEX_NATIVE_REF, COMPLEX_NATIVE_SET): New macros. (bytevector_ref_c32, bytevector_ref_c64): Defined in terms of `COMPLEX_NATIVE_REF'. (bytevector_set_c32, bytevector_set_c64): Defined in terms of `COMPLEX_NATIVE_SET'. (bytevector_ref_fns): Make `static'. * test-suite/tests/srfi-4.test ("c32 vectors")["generalized-vector-ref", "generalized-vector-set!", "generalized-vector-ref, out-of-range", "generalized-vector-set!, out-of-range"]: New tests. ("c64 vectors")["generalized-vector-ref", "generalized-vector-set!", "generalized-vector-ref, out-of-range", "generalized-vector-set!, out-of-range"]: New tests. 2011-07-01 Ludovic Courtès Fix unaligned accesses for bytevectors of complex numbers. * libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64, bytevector_set_c32, bytevector_set_c64): Use `memcpy' to avoid unaligned accesses. This fixes SIGBUS on SPARC and possibly other alignment-sensitive platforms. i18n: Don't use `!=' to compare SCMs. * libguile/i18n.c (install_locale)[!USE_GNU_LOCALE_API]: Use `SCM_UNBNDP' instead of `!='. 2011-07-01 Andy Wingo fix '(a #{.} b) * libguile/read.c (scm_read_sexp): Don't confuse `#{.}#' with `.' for the purpose of reading dotted pairs. Thanks to CRLF0710 for the report. * test-suite/tests/reader.test ("#{}#"): Add test. 2011-07-01 Andy Wingo fix r6rs-records-syntactic.test to not shadow a literal * test-suite/tests/r6rs-records-syntactic.test (*parent-rtd): Fix test to not shadow a literal. 2011-07-01 Andy Wingo defining a smob or port type no longer mucks exports of (oop goops) * libguile/goops.c (DEFVAR): Remove this helper macro, replacing its uses with scm_module_define, but without scm_module_export. (create_basic_classes, scm_init_goops_builtins): Update callers. (make_class_from_template, make_class_from_symbol): Change to not define variables for classes. This affects ports, struct classes, and smob classes. * module/oop/goops.scm: Explicitly list our exports, so there is no more trickery happening in C. (find-subclass): Private helper to grub the class hierarchy, so we can define bindings for smobs, ports, etc. Use to define the classes that goops.c used to define -- probably a subset, but it's better to have them listed. 2011-06-30 Ludovic Courtès Fix `on_thread_exit' for canceled threads. * libguile/threads.c (on_thread_exit): Clear `t->guile_mode' upon entry. This fixes a bug whereby `t->base' would be incorrect for canceled threads, leading to a misdiagnosed VM stack overflow. See for details. (scm_leave_guile_cleanup): Remove because it's unused. Add `guile-invoke.texi' to the distribution. * doc/ref/Makefile.am (guile_TEXINFOS): Add `guile-invoke.texi'. 2011-06-30 Andy Wingo fix generation of auto-compiled file names on mingw systems * libguile/load.c (canonical_to_suffix, scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): * module/system/base/compile.scm (compiled-file-name): If the canonical path of a file is a DOS-style path with a drive letter, turn it into a path suffix it by removing the colon and prefixing a "/". Inspired by a patch from Jan Nieuwenhuizen. 2011-06-30 Andy Wingo Merge remote-tracking branch 'origin/lexical-literals' Conflicts: module/ice-9/psyntax-pp.scm Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: libguile/deprecated.c module/ice-9/psyntax-pp.scm 2011-06-30 Mark Harig better invocation documentation * doc/ref/guile.texi (Programming in Scheme): * doc/ref/scheme-scripts.texi (Guile Scripting): Moved "Invoking Guile" to its own file. * doc/ref/guile-invoke.texi (Invoking Guile): Initial revision. This file contains the former section "Invoking Guile" that was included in the chapter "Programming in Scheme" as a subsection named "Command-line Options." It also includes a new subsection "Environment Variables," which describes those variables that can be set in the operating system before Guile is started and which affect Guile's run-time behavior. 2011-06-30 Andy Wingo %load-hook not just for primitive-load * libguile/load.c (scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): Call %load-hook as needed. 2011-06-30 Andy Wingo fix --disable-modules build * configure.ac (HAVE_MODULES): Define HAVE_MODULES iff --enable-modules. * libguile/deprecated.c (scm_dynamic_args_call) * libguile/extensions.c (load_extension): * libguile/init.c (scm_i_init_guile): Use HAVE_MODULES in a few places. 2011-06-30 Andy Wingo HAVE_POSIX warning fix * libguile/filesys.c (scm_dir_free, scm_dir_print): Don't compile when not HAVE_POSIX. 2011-06-28 Ludovic Courtès Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'. Original Helgrind report: ==14160== Thread #57: lock order "0x47F6B90 before 0x7C25A28" violated ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4EFF87E: do_thread_exit (threads.c:664) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x51CA3AF: GC_call_with_gc_active (pthread_support.c:1128) ==14160== by 0x4EFF2E0: with_guile_and_parent (threads.c:206) ==14160== by 0x51C46B4: GC_call_with_stack_base (misc.c:1505) ==14160== by 0x4EFF447: scm_with_guile (threads.c:917) ==14160== by 0x51C46B4: GC_call_with_stack_base (misc.c:1505) ==14160== Required order was established by acquisition of lock at 0x47F6B90 ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4F00262: fat_mutex_lock (threads.c:1362) ==14160== by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462) ==14160== by 0x4F16C09: vm_regular_engine (vm-i-system.c:898) ==14160== by 0x4E90F4D: scm_call_3 (eval.c:499) ==14160== by 0x4EFFA4C: really_launch (threads.c:975) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x4EFF289: with_guile_and_parent (threads.c:874) ==14160== followed by a later acquisition of lock at 0x7C25A28 ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4F00352: fat_mutex_lock (threads.c:1374) ==14160== by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462) ==14160== by 0x4F16C09: vm_regular_engine (vm-i-system.c:898) ==14160== by 0x4E90F4D: scm_call_3 (eval.c:499) ==14160== by 0x4EFFA4C: really_launch (threads.c:975) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x4EFF289: with_guile_and_parent (threads.c:874) * libguile/threads.c (fat_mutex_lock): In the `m->level == 0' case, release M's lock before taking T's `admin_mutex'. 2011-06-23 Andy Wingo don't spawn the signal delivery thread in a thread-exit handler * libguile/threads.c (do_thread_exit): Remove needless spawn of the signal delivery thread. allow gc <= 7.1 to stop the signal delivery thread * configure.ac: Add a check for GC_get_suspend_signal(). * libguile/scmsigs.c (GC_get_suspend_signal): Define a fallback implementation if one isn't available. (signal_delivery_thread): Unmask the suspend signal so that GC can stop the world. Fixes test-pthread-create on libgc 7.1 and earlier. Thanks to Frank Terbeck for the report. 2011-06-21 Stefan Israelsson Tampe psyntax: enable dotted tail patterns * module/ice-9/psyntax.scm (syntax-case): enabled the use of a general last cdr instead of just '() in matching with both a ellipsis (p ...) and a last rest pattern (. q) * module/ice-9/psyntax-pp.scm: Regenerated. 2011-06-20 Andy Wingo update stack growth direction check * configure.ac: Pull stack growth direction check from upstream autoconf. See http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00035.html for a discussion. 2011-06-20 Ludovic Courtès Placate GCC in `test-ffi-lib.c'. This fixes warnings saying "this decimal constant is unsigned only in ISO C90". * test-suite/standalone/test-ffi-lib.c (test_ffi_u32_, test_ffi_u32_u8, test_ffi_u32_s64, test_ffi_s64_s64, test_ffi_u64_u8, test_ffi_u64_s64): Mark constants as unsigned. 2011-06-19 Ian Price Fix hygiene issues with `define-record-type' * module/rnrs/records/syntactic.scm (define-record-type0, process-fields): Preserve hygiene of record clauses. * test-suite/tests/r6rs-records-syntactic.test ("record hygiene"): Add tests. 2011-06-19 Ludovic Courtès Comment on the Gnulib `clock-gettime' workaround. * acinclude.m4: Remove `clock_time.m4' serial. * configure.ac: Add URL of the discussion about `clock-gettime'. 2011-06-19 Ludovic Courtès configure: Factorize code checking for `iconveh_' constants; use the cache. * configure.ac: Remove code that determines the values of the `iconveh_' constants. Use `GUILE_UNISTRING_ICONVEH_VALUES'. instead. * acinclude.m4 (GUILE_UNISTRING_CONSTANT, GUILE_UNISTRING_ICONVEH_VALUES): New macros. 2011-06-18 Andy Wingo Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm 2011-06-18 Andy Wingo fix tree-il->scheme bug for seq * module/language/tree-il.scm (tree-il->scheme): Fix bug for `seq'. * module/ice-9/psyntax-pp.scm: Regenerate correctly. 2011-06-17 Andy Wingo current-language really defaults to Scheme. * module/system/base/language.scm (current-language): Default to 'scheme here, rather than relying on *current-language* always being bound. Thanks to 亚光唐 for the report. 2011-06-17 Andy Wingo fix invalid transformation of (values x) -> x, (+ x) -> x, etc * module/language/tree-il/primitives.scm (+, *, cons*): In the case of just one argument (the identity case), expand to (values x) instead of just x. Fixes values truncation in that case. (values): Likewise remove (values x) -> x translation, as the compiler will do it for us, and this fixes (values (values 1 2)). * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Handle `values' in a push context here. * test-suite/tests/tree-il.test ("values"): Add some tests. 2011-06-17 Andy Wingo add -Wformat to %auto-compilation-options * module/ice-9/boot-9.scm (%auto-compilation-options): Add -Wformat to the default warning set. better messages on failed autocompilation * libguile/load.c (auto_compile_catch_handler): * module/ice-9/boot-9.scm (load-in-vicinity): Nicer messages when autocompilation fails. 2011-06-17 Andy Wingo fix self tail recursion to different case-lambda clauses http://savannah.gnu.org/bugs/?33362 * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Rename from flatten, as it really just takes a particular case. Instead of iteratively compiling lambda cases through `comp', tail-call through flatten-lambda-case. This allows code to see which case it's being compiled in. Take advantage of that to limit the self-tail-call optimization to self-calls to the same case -- otherwise we might be jumping to a label without having reserved the right number of locals. (flatten-lambda): Adapt the caller. * test-suite/tests/compiler.test ("case-lambda"): Add a test. 2011-06-17 Andy Wingo fix AC_LANG_SOURCE warnings * configure.ac: Fix annoying AC_LANG_SOURCE warnings. check for clock_getcpuclockid in gl_CLOCK_TIME * acinclude.m4 (gl_CLOCK_TIME): It could be that clock_gettime is in libc but clock_getcpuclockid is not, so check for that explicitly. 2011-06-17 Andreas Rottmann Silence warnings for variables created by `generate-temporaries' * module/ice-9/psyntax.scm (generate-temporaries): Give temporaries the current module, so that they may be bound at the top level. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-06-17 Andy Wingo remove win32-dirent.[ch] * libguile/win32-dirent.c: * libguile/win32-dirent.h: Remove these files. MinGW has opendir and readdir support, I hear. * configure.ac: * libguile/filesys.c: * libguile/Makefile.am: Adapt. 2011-06-17 Jan Nieuwenhuizen mingw: use $APPDATA as a possible root for cachedir. * libguile/load.c (scm_init_load_path) [MINGW32]: Fall back to using $LOCALAPPDATA or $APPDATA if $XDG_CACHE_HOME and $HOME aren't set. 2011-06-16 Andy Wingo add `rename' gnulib module This should fix `rename' on mingw32. 2011-06-16 Mark H Weaver Fix several POSIX functions to use the locale encoding * libguile/strings.c (scm_i_allocate_string_pointers): Encode strings using the current locale. Previously, Latin-1 was used. Indirectly, this affects the encoding of strings in `system*', `execl', `execlp', `execle', `environ', and `dynamic-args-call'. (scm_makfromstrs): In header comment, clarify that the C strings are interpreted according to the current locale encoding. * NEWS: Add NEWS entry. 2011-06-16 Andy Wingo Merge remote-tracking branch 'local-2.0/stable-2.0' O_CLOEXEC usage * libguile/objcodes.c (scm_load_objcode): * libguile/scmsigs.c (start_signal_delivery_thread): * libguile/threads.c (guilify_self_1): Use O_CLOEXEC. 2011-06-16 Andy Wingo gnulib update Added pipe2 and open modules, to get O_CLOEXEC. * libguile/Makefile.am (guile_filter_doc_snarfage$(EXEEXT)): Add gnulib here, in the native build case, for rpl_fflush if needed. foo 2011-06-16 Andy Wingo fix initial values of reallocated fluids * libguile/threads.h: * libguile/threads.c (scm_i_reset_fluid): New internal function, resets the binding of a fluid for all threads. Needed for fluid GC. * libguile/fluids.c (new_fluid): Call scm_i_reset_fluid here. 2011-06-16 Andy Wingo more NEWS * NEWS: More updates. update NEWS * NEWS: Update for 2.0.2. add docs for shift and reset * doc/ref/api-control.texi (Prompt Primitives): Break call-with-prompt and abort-to-prompt out into a subsubsection. (Shift and Reset): New subsubsection. fix hash-set! on weak tables * test-suite/tests/weaks.test: Add tests. * libguile/hashtab.c (scm_hash_fn_set_x): Fix updates to weak-value hash tables to not deadlock inside the alloc lock. 2011-06-09 Andreas Rottmann Fix likely crash in `stable-sort!' * libguile/sort.c (scm_stable_sort_x): Properly handle zero-length vectors. * test-suite/tests/sort.test ("stable-sort"): Add test for this case. 2011-06-08 Ludovic Courtès doc: Mention the former name of `guild'. * doc/ref/scheme-using.texi (Using Guile Tools): Add a footnote mentioning that `guild' used to be `guile-tools'. * doc/ref/tools.texi (Executable Modules): Nitpicks. 2011-06-02 Andy Wingo Merge remote-tracking branch 'local-2.0/stable-2.0' Conflicts: meta/Makefile.am 2011-06-02 Andy Wingo sequence of expressions -> seq of head and tail * libguile/expand.h: * module/language/tree-il.scm: Rename "sequence" to "seq", and instead of taking a list of expressions, take a head and a tail. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/spec.scm: * module/language/elisp/compile-tree-il.scm: * module/ice-9/psyntax.scm: * module/ice-9/psyntax-pp.scm: * module/ice-9/eval.scm: * libguile/memoize.h: * libguile/memoize.c: * libguile/expand.c: * libguile/eval.c: Adapt to the new seq format. 2011-06-02 Andy Wingo add to tree-il * libguile/expand.c: * libguile/expand.h (SCM_EXPANDED_PRIMCALL_TYPE_NAME): (SCM_EXPANDED_PRIMCALL_FIELD_NAMES): (SCM_EXPANDED_PRIMCALL_SRC): (SCM_EXPANDED_PRIMCALL_NAME): (SCM_EXPANDED_PRIMCALL_ARGS): (SCM_MAKE_EXPANDED_PRIMCALL): Add "primcall" Tree-IL type. * doc/ref/compiler.texi (Tree-IL): Update docs. * libguile/memoize.c (memoize): Memoizer for primcalls. * module/ice-9/psyntax.scm: Build primcalls, sometimes. Also change build-primref to just make a primitive-ref. * module/language/tree-il.scm: Add primcall to the exports, parsers, serializers, etc. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: * module/language/elisp/compile-tree-il.scm: Add primcall support. * test-suite/tests/tree-il.test: Use primcalls sometimes. 2011-06-02 Andy Wingo rename to * doc/ref/compiler.texi (The Scheme Compiler): Update docs. * libguile/expand.h: * libguile/expand.c: * module/language/tree-il.scm: Rename to . Change the external representation from (apply proc arg ...) to (call proc arg ...). * libguile/memoize.c: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: * module/language/brainfuck/compile-tree-il.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/elisp/compile-tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: * test-suite/tests/tree-il.test: Update all callers. 2011-05-31 Andy Wingo add guild docs * doc/ref/scheme-using.texi (Using Guile Tools): Add some optimistic guild docs. 2011-05-31 Andy Wingo rename `guile-tools' to `guild' * configure.ac: Look for ln -s. Write out `guild' instead of `guile-tools'. * meta/Makefile.am (install-data-hook): Link the installed `guild' to the backward-compatible `guile-tools' name. (bin_SCRIPTS, EXTRA_DIST): Fix up for guild change. * meta/guild.in: Moved here from `guile-tools.in'. * doc/ref/Makefile.am (autoconf-macros.texi): * doc/ref/api-evaluation.texi (Compilation): * doc/ref/autoconf.texi (Autofrisk, Using Autofrisk): * doc/ref/mod-getopt-long.texi (getopt-long Reference): * doc/ref/tools.texi (Miscellaneous Tools, Executable Modules): Minimal doc update. * .gitignore: * am/guilec (.scm.go): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.go): Update makefiles, etc. * module/scripts/README: * module/scripts/lint.scm: * module/scripts/list.scm: Update commentaries. 2011-05-31 Andy Wingo write-objcode uses target-endianness, target-word-size * libguile/_scm.h (SCM_OBJCODE_ENDIANNESS_OFFSET): (SCM_OBJCODE_WORD_SIZE_OFFSET): New defines. * libguile/objcodes.c (scm_write_objcode): Use target-endianness and target-word-size when writing the objcode cookie. compile-bytecode uses target-endianness * module/language/assembly/compile-bytecode.scm (compile-bytecode): Use target-endianness, from (system base target). add (system base target) * module/Makefile.am: * module/system/base/target.scm: Add a minimal module to parameterize the target system type and inspect properties on it like cpu, vendor, os, endianness, and word size. 2011-05-30 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2011-05-30 Andy Wingo fix subtle and bad scm_internal_hash_fold bug for weak tables * libguile/hashtab.c (scm_internal_hash_fold): Don't try to unlink deleted weak pairs. Our previous code was buggy (`prev' should have only been updated in the case of a successful traversal), but more than that, we're not in the alloc lock. Thanks very much to Michael Wells for the report, and the debugging! 2011-05-27 Andreas Rottmann Tweak R6RS transcoded ports flushing * libguile/r6rs-ports.c (tp_flush): Only operate on the underlying port when it is open. 2011-05-27 Andreas Rottmann rnrs io ports: fix port encoding when opening file ports * module/rnrs/io/ports.scm (open-file-input-port) (open-file-output-port): Ensure the resulting ports are binary when no transcoder is specified. * test-suite/tests/r6rs-ports.test: Remove superfluous global change of `%default-port-encoding' and accompanying comment. ("7.2.7 Input Ports"): Add test ensuring `open-file-input-port' opens a binary port when no transcoder is specified. ("8.2.10 Output ports"): Strengthen existing `open-file-output-port' binary-ness test by setting `%default-port-encoding' to "UTF-8". 2011-05-27 Andreas Rottmann Add some tests for the R6RS I/O libraries * test-suite/tests/r6rs-ports.test (call-with-bytevector-output-port/transcoded): New helper procedure. ("8.2.6 Input and output ports"): Use that helper procedure. (encoding-error-predicate): New helper procedure. ("8.2.12 Textual Output"): Add tests for `put-char' and `put-string' exception behavior on encoding errors. 2011-05-26 Neil Jerram Doc for getopt-long's new stop-at-first-non-option option * doc/ref/mod-getopt-long.texi (getopt-long): Mention optional keyword parameters. (getopt-long Reference): Document #:stop-at-first-non-option. 2011-05-26 Neil Jerram Remove unused script-getopt.texi * doc/ref/Makefile.am (guile_TEXINFOS): Remove script-getopt.texi. * doc/ref/script-getopt.texi: Deleted. This file wasn't included in the manual, and its content is now duplicated identically in scheme-scripts.texi. 2011-05-26 Neil Jerram Emit a 1-based line number in error messages * module/ice-9/boot-9.scm (exception-printers): Add 1 to the 0-based line number. 2011-05-26 Neil Jerram Reveal guile-tools's inner simplicity... ...by not using its own-rolled getopt, and moving the `list' function to a separate script * meta/guile-tools.in: Use (ice-9 getopt-long). (directory-files, strip-extensions, unique, find-submodules, list-scripts): Deleted (and moved to new `list.scm' file). (getopt): Deleted. (main): Use getopt-long. Default to calling the `list' script if no script is specified. * module/scripts/list.scm: New script. * module/Makefile.am (SCRIPTS_SOURCES): Add list.scm. 2011-05-26 Neil Jerram Implement #:stop-at-first-non-option option for getopt-long (For use by guile-tools) * module/ice-9/getopt-long.scm: Use (ice-9 optargs) so we can use define*. (process-options): Add stop-at-first-non-option parameter. When this is true, stop processing when we hit a non-option (so long as that non-option isn't something that resulted from the unclumping of a short option group). (getopt-long): Add #:stop-at-first-non-option keyword; pass it on to process-options. * test-suite/tests/getopt-long.test ("stop-at-first-non-option"): New test (for the above). 2011-05-26 Neil Jerram Handle short option unclumping progressively, instead of all upfront This is needed as a prerequisite for the following change that introduces the stop-at-first-non-option option, because when that option is used we don't know upfront how far through the command line we should proceed with unclumping. * module/ice-9/getopt-long.scm (expand-clumped-singles): Delete. (process-options): Add a loop variable to indicate how many elements at the start of `argument-ls' are known not to be clumped. When we see a short option and this variable is <= 0, perform unclumping (using code that used to be in expand-clumped-singles) and loop with the variable > 0. (getopt-long): Don't call expand-clumped-singles upfront here. 2011-05-26 Neil Jerram Simplify getopt-long handling of option values, esp with multiple occurrences Basically, accumulate values in the `process-options' loop variables, instead of using set-option-spec-value! * module/ice-9/getopt-long.scm (option-spec): Delete the `value' slot. (process-options): Delete `val!loop' and just use `loop' everywhere instead. When adding an option spec to `found', add the corresponding value too; hence `found' becomes an alist, where it was previously a list of specs. (getopt-long): Use assq-ref to get values out of `found'. Remove unhittable error condition for detecting an option that requires an explicit value, where a value wasn't supplied. This condition is actually caught and handled in `process-options'. Rewrite the end of the procedure much more simply. 2011-05-26 Neil Jerram Fix "occurrances" typos in getopt-long code and test * module/ice-9/getopt-long.scm (process-options, getopt-long): Change to "occurrences". * test-suite/tests/getopt-long.test ("multiple occurrences"): Same again. 2011-05-26 Andy Wingo remove gc pthread redirects entirely * libguile/pthread-threads.h: As an experiment, just define scm_i_pthread_create et al to their pthread_* functions, instead of the GC_ ones. It seems sufficient, given that all uses of Guile have to go through scm_with_guile anyway... Passes tests on my machine. Committing to give buildbots a go at it. Merge remote-tracking branch 'origin/stable-2.0' leave guile when reading signal pipe * libguile/scmsigs.c (read_signal_pipe_data, signal_delivery_thread): Leave guile when reading from the signal pipe. Hopefully that lets GC know not to wake up this thread. lazily init futures worker pool * module/ice-9/futures.scm (%workers, %create-workers!) (create-workers!): Define a mechanism to spawn off the future threads only when the first future is created. (make-future): Call create-workers! here. 2011-05-26 Andy Wingo scm_new_smob, scm_new_double_smob inline functions * libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors, which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline functions instead of macros. They also bail to scm_i_new_smob / scm_i_new_double_smob in either the mark or the free case, so that the inline definition doesn't reference other internal details like libgc stuff. (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see them as already being declared. (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2): (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new inline functions. (scm_i_finalize_smob): Remove declaration, as it's no longer needed or used. Remove now-unneeded bdw-gc include. * libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and make static. (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators. * libguile/inline.c: Include smob.h, so as to reify scm_new_smob and scm_new_double_smob. 2011-05-26 Andy Wingo scm_cell, scm_double_cell, scm_words back to gc.h * libguile/inline.h: * libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move declarations and definitions back here, from inline.h. It's more natural. * libguile/inline.c: Include gc.h as well. 2011-05-26 Andy Wingo simplify inline function infrastructure * libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here, from inline.h. We'd like to support inline function definitions in more header files: not just inline.h. (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New definitions. * libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these wrappers, which redirect to the GC_MALLOC macros when building Guile, and the scm_gc_malloc functions otherwise. A step towards getting BDW-GC out of Guile's API. * libguile/inline.h: Simplify, using SCM_INLINE, SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the new SCM_GC_MALLOC macros. 2011-05-26 Andy Wingo Merge remote-tracking branch 'local-2.0/stable-2.0' remove scm_newcell_count, scm_newcell2_count * libguile/inline.h: * libguile/gc.c: Remove declaration and definition of unused "scm_newcell_count" and "scm_newcell2_count". Since SCM_INTERNAL is "extern", these symbols were not externally visible anyway, at least under Linux or Windows. 2011-05-26 Andy Wingo deprecate scm_immutable_{double_,}cell * libguile/inline.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_immutable_cell, scm_immutable_double_cell): Deprecate these, as the GC_STUBBORN API doesn't do anything any more. * libguile/strings.c (scm_i_c_make_symbol): Change the one use of scm_immutable_double_cell to scm_double_cell. 2011-05-25 Mark H Weaver Clarify docs for SCM_UNSPECIFIED: used sometimes but not always * doc/ref/data-rep.texi (Immediate objects): Clarify the description of SCM_UNSPECIFIED. It is returned by some (but not all) expressions whose value is unspecified by the Scheme standard. 2011-05-25 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' Conflicts: libguile/procprop.c out-of-tree build fix * test-suite/standalone/Makefile.am (GUILE_AUTO_COMPILE): Add srcdir to the environment. * test-suite/standalone/test-import-order: Look for the modules in the srcdir. Fixes out-of-tree builds. 2011-05-24 Andy Wingo threadsafe addition to the goops vtable_class_map * libguile/goops.c (scm_i_define_class_for_vtable): Lock around additions to the vtable_class_map. Use is unlocked though; solving GOOPS parallel-initialization would be a good thing. threadsafe access to source properties weak hash table * libguile/srcprop.c: Add a lock around scm_source_whash, and use it. 2011-05-24 Andy Wingo read + source properties simplification * libguile/srcprop.h: Remove internal scm_source_whash declaration. * libguile/srcprop.c (scm_i_set_source_properties_x) (scm_i_has_source_properties): New helpers. (scm_source_whash): Make static. * libguile/read.c (scm_read_sexp): Remove register declarations here; let's trust the compiler. Remove code to incrementally build up a copy; instead let's let scm_i_set_source_properties_x handle copying the expression if needed. (scm_read_quote, scm_read_syntax): Use scm_i_set_source_properties_x. (recsexpr): Remove this helper from 1996. (scm_read_sharp_extension): Instead of trying to recursively label sharp-read subforms with source properties, just label the outside form and rely on the macro-expander to propagate it down. 2011-05-24 Andy Wingo safely access the trampoline weak map * libguile/smob.c (scm_i_smob_apply_trampoline): Protect the trampoline weak map with a mutex. 2011-05-23 Andy Wingo set-procedure-property! threadsafety issue * libguile/procprop.c (scm_set_procedure_property_x): Fix a threadsafety bug pointed out by Ken Raeburn. really threadsafe access to symbol table * libguile/symbols.c (symbols_lock): Rename from intern_lock. (lookup_interned_symbol, lookup_interned_latin1_symbol): Instead of faith-based programming, just use the mutex. Though I haven't seen this break, Ken is right! 2011-05-22 Mark H Weaver Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type * libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void): New static functions that simply call scm_lock_mutex and scm_unlock_mutex, respectively, but return void instead of SCM. (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to scm_dynwind_rewind_handler_with_scm. Previously, we passed scm_unlock_mutex and scm_lock_mutex (which return SCM), but the scm_dynwind_* functions expect pointers to functions which return void. When SCM is of type union, this changes the calling conventions of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86). 2011-05-22 Mark H Weaver Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type * libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void): New static functions that simply call scm_lock_mutex and scm_unlock_mutex, respectively, but return void instead of SCM. (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to scm_dynwind_rewind_handler_with_scm. Previously, we passed scm_unlock_mutex and scm_lock_mutex (which return SCM), but the scm_dynwind_* functions expect pointers to functions which return void. When SCM is of type union, this changes the calling conventions of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86). 2011-05-21 Andy Wingo fix define-module ordering * module/ice-9/boot-9.scm (define-module): Fix to load the #:use-module clauses in the order in which they appear in the define-module form. Thanks to Jan Nieuwenhuizen for the report. * test-suite/standalone/test-import-order: Add new test that define-module and use-modules resolve the interface in the right order. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-import-order-a.scm: * test-suite/standalone/test-import-order-b.scm: * test-suite/standalone/test-import-order-c.scm: * test-suite/standalone/test-import-order-d.scm: Aux files. 2011-05-21 Andy Wingo (syntax foo) -> #'foo in goops * module/oop/goops.scm: Change instances of (syntax foo) to #'foo. 2011-05-20 Andy Wingo clocktime freebsd portability * libguile/stime.c (HAVE_POSIX_CPUTIME): Hack around buggy FreeBSD implementation of _POSIX_CPUTIME. fix compile error in mingw fstat socket detection * libguile/filesys.c (fstat_Win32) [__MINGW32__]: Apparently there is no _S_IFSOCK on mingw32. Thanks to Volker Grabsch for the report. gen-scmconfig cross-compilation fix * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Fix cross-compilation. Thanks to Volker Grabsch for the report! 2011-05-20 Andy Wingo fix documentation for option-set! syntaxen * doc/ref/api-evaluation.texi (Scheme Read): Note that read-set! is syntax. (Scheme Write): Likewise for print-set!. * doc/ref/api-io.texi (Writing): Remove reference to print-options-interface. * doc/ref/repl-modules.texi (Readline Options): Update, and add entries for readline-options, readline-set! et al. 2011-05-15 Andy Wingo regexp.test needed char-code-limit * test-suite/tests/regexp.test (char-code-limit): Define a local version of this recently removed definition. Hopefully that's the only use of it though! remove SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE definitions * libguile/__scm.h: Remove unused SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE definitions. use of EXIT_SUCCESS and EXIT_FAILURE * libguile/threads.c (scm_init_guile): * libguile/throw.c (scm_exit_status): Use EXIT_SUCCESS and EXIT_FAILURE instead of 0 and 1. 2011-05-15 Andy Wingo scm_wta_* procedures replace SCM_WTA_* macros * libguile/__scm.h: Move all the SCM_WTA and SCM_GASSERT macros out of here. Also remove the scm_call_generic declarations. * libguile/deprecated.h (SCM_WTA_DISPATCH_0, SCM_WTA_DISPATCH_1): (SCM_WTA_DISPATCH_2, SCM_WTA_DISPATCH_N): Deprecate. See below for their replacements. (SCM_GASSERT0, SCM_GASSERT1, SCM_GASSERT2, SCM_GASSERTn): Deprecate these too. (SCM_WTA_DISPATCH_1_SUBR): Deprecate this strange thing. (scm_call_generic_0, scm_call_generic_1, scm_call_generic_2): (scm_call_generic_3, scm_apply_generic): Remove, indicating their replacements. * libguile/print.c (iprin1): * libguile/eq.c (scm_equal_p): Use scm_call_2 instead of scm_call_generic_2. * libguile/goops.h: * libguile/goops.c: Remove scm_{call,apply}_generic definitions. (scm_wta_dispatch_0, scm_wta_dispatch_1, scm_wta_dispatch_2): (scm_wta_dispatch_n): New procedures, replacing the SCM_WTA macros. * libguile/numbers.c (scm_lcm): * libguile/procs.c (scm_setter): Remove uses of SCM_GASSERT. * libguile/numbers.c (scm_lcm): * libguile/procs.c (scm_setter): * libguile/vectors.c: Use the procedural scm_wta routines instead of the SCM_WTA macros. 2011-05-15 Andy Wingo SCM_ASSERT to error.h * libguile/error.h (SCM_ASSERT, SCM_ASSERT_TYPE): Move definition here. Remove SCM_RECKLESS case. * libguile/__scm.h: (From here.) remove SCM_ASRTGO * libguile/__scm.h (SCM_ASRTGO): Remove unused macro. remove unused SCM_FENCE definition * libguile/__scm.h (SCM_FENCE): Remove unused definition. 2011-05-15 Andy Wingo rename scm_async_click() to scm_async_tick(); privatize SCM_ASYNC_TICK * libguile/_scm.h (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE): Make these definitions private. Call the tick() function instead of click(). * libguile/__scm.h: * libguile/async.h (scm_async_tick): Move declaration here. Remove scm_async_click declaration. Tick is the new (and old!) click, you see. (SCM_CRITICAL_SECTION_END): Call tick() instead of click(). * libguile/async.c (scm_async_tick): Remove old definition, and rename scm_async_click to scm_async_tick. (decrease_block): Adapt to click() -> tick() name change. * libguile/deprecated.h (scm_async_click, SCM_ASYNC_TICK): Define some GONE macros. * libguile/threads.c (fat_mutex_unlock): Tick() instead of click(). 2011-05-15 Andy Wingo simplify SCM_TICK * libguile/__scm.h (SCM_TICK): Define to simply scm_async_tick (or SCM_ASYNC_TICK when building Guile). 2011-05-15 Andy Wingo remove SCM_THREAD_SWITCHING_CODE * libguile/deprecated.h (SCM_THREAD_SWITCHING_CODE): * libguile/threads.h: Remove SCM_THREAD_SWITCHING_CODE, adding in a deprecation note. * libguile/__scm.h (SCM_TICK): Remove SCM_THREAD_SWITCHING_CODE. 2011-05-15 Andy Wingo make SCM_I_SETJMP and SCM_I_LONGJMP private * libguile/_scm.h (SCM_I_SETJMP, SCM_I_LONGJMP): Move to this private header. * libguile/__scm.h (scm_i_jmp_buf): Only define the scm_i_jmp_buf type in this public header. move SCM_FLUSH_REGISTER_WINDOWS to continuations.c * libguile/continuations.c: Move SCM_FLUSH_REGISTER_WINDOWS define here... * libguile/__scm.h: ...from here. minor __scm.h cleanup * libguile/__scm.h: Clean up setjmp/longjmp portability defines. 2011-05-15 Andy Wingo remove mention of cheap continuations * libguile/__scm.h: Inline an #ifndef CHEAP_CONTINUATIONS block for VMS, as we always have full continuations. * libguile/feature.c (scm_init_feature): Don't bother defining the "full-continuation" feature. 2011-05-15 Andy Wingo remove SCM_I_LLONG and SCM_I_ULLONG limit defines * test-suite/standalone/test-num2integral.c (test_long_long): (test_ulong_long): Replace SCM_I_LLONG and SCM_I_ULLONG defines with their counterparts from limits.h. * libguile/__scm.h: Remove SCM_I_LLONG and SCM_I_ULLONG limit defines. 2011-05-15 Andy Wingo remove SCM_I_SIZE limits defines * libguile/__scm.h: Remove defines for SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN, and SCM_I_SSIZE_MAX, as there is no longer a scm_t_size / scm_size_t type. * libguile/bytevectors.c (make_bytevector): Replace a use of SCM_I_SIZE_MAX with ((size_t) -1). remove SCM_CHAR_CODE_LIMIT define * libguile/__scm.h: Remove SCM_CHAR_CODE_LIMIT define. * libguile/feature.c (scm_init_feature): Remove char-code-limit define, which was sure to be 256: a bogus value. remove more unused __scm.h options * libguile/__scm.h: Remove unused SCM_DEBUG_MARKING_API, SCM_DEBUG_INTERRUPTS, and SCM_DEBUG_DEBUGGING_SUPPORT defines. remove mention of GUILE_DEBUG_FREELIST * libguile/__scm.h: Remove commented-out GUILE_DEBUG_FREELIST define. * libguile/gen-scmconfig.c: Remove mention of GUILE_DEBUG_FREELIST. 2011-05-15 Andy Wingo remove #define STACK_CHECKING from __scm.h. * libguile/__scm.h: Remove #define STACK_CHECKING and #undef NO_CEVAL_STACK_CHECKING. * libguile/debug.c (scm_debug_options) * libguile/init.c (scm_i_init_guile): * libguile/stackchk.c (scm_report_stack_overflow): * libguile/stackchk.h: Always enable stack checking. 2011-05-15 Andy Wingo remove SICP from __scm.h * libguile/__scm.h: Remove #undef SICP. * libguile/feature.c (scm_init_feature): Never add the sicp feature. remove ENGNOT from __scm.h * libguile/__scm.h: Remove #undef ENGNOT. * libguile/numbers.c (idbl2str): Remove #ifdef ENGNOT sections. 2011-05-15 Andy Wingo SCM is either a union or scm_t_bits * libguile/tags.h: Elide the SCM_DEBUG_TYPING_STRICTNESS==1 case. Instead just have a flag, SCM_USING_PREHISTORIC_COMPILER, which if set uses what was SCM_DEBUG_TYPING_STRICTNESS==0. * libguile/__scm.h: Remove SCM_DEBUG_TYPING_STRICTNESS block. 2011-05-15 Andy Wingo SCM is a union * libguile/tags.h (SCM): Change to simply be a union containing scm_t_bits. (SCM_PACK, SCM_UNPACK): Adapt accordingly. fix type errors in test suite * test-suite/standalone/test-num2integral.c (out_of_range_handler): Fix SCM used as a truth value. * test-suite/standalone/test-scm-spawn-thread.c (inner_main): Use SCM2PTR here. 2011-05-14 Andreas Rottmann Improve R6RS conformance wrt. conditions in the I/O libraries * module/rnrs/io/ports.scm (open-file-output-port): Handle `no-fail' file option. (with-i/o-filename-conditions): Use `with-throw-handler' instead of `catch'. (with-i/o-port-error, with-textual-output-conditions. with-textual-input-conditions): New exception-conversion helpers. (put-char, put-datum, put-string, display): Use `with-textual-output-conditions' instead of `with-i/o-encoding-error' to get proper conditions in case of write errors. (get-char, get-datum, get-line, get-string-all, lookahead-char): Likewise, for the input case. * test-suite/tests/r6rs-ports.test (pass-if-condition, test-file, make-failing-port): New helpers. ("8.2.10 Output ports"): Add some tests for `open-file-output-port'. ("8.2.9 Textual Input"): Add tests read error conditions. ("8.2.12 Textual Output"): Add tests for write error conditions. ("8.3 Simple I/O"): Add tests for conditions, `call-with-input-file' and `call-with-output-file'. 2011-05-13 Andy Wingo Bump default typing strictness to 2. * libguile/__scm.h (SCM_DEBUG_TYPING_STRICTNESS): Bump the default to 2. merge strictness branch from 2.0 refactor do_thread_exit cleanup handler invocation * libguile/threads.c (do_thread_exit): Redo cleanup handler call so as not to shove a SCM into a pointer. i18n error return type fix * libguile/i18n.c (chr_to_case, str_to_case): Return #f in error case instead of 0. PTR2SCM and SCM2PTR in inline.h * libguile/inline.h (scm_cell, scm_immutable_cell): (scm_double_cell, scm_immutable_double_cell): (scm_words): Be more consistent in use of PTR2SCM and SCM2PTR. compile-time assertion in net_db uses constant expressions * libguile/net_db.c: Use constant expressions for EAI_BADFLAGS and AI_ALL representations. ports.c uninitialized static SCM values are #f, not 0 * libguile/ports.c: (scm_current_input_port, scm_current_output_port) (scm_current_error_port): Use #f as the uninitialized value instead of 0. scm_port_for_each fix * libguile/ports.c (scm_port_for_each): Inline the call to scm_c_port_for_each, to avoid type errors. weak_bucket_assoc tweak * libguile/hashtab.c (weak_bucket_assoc): Change assertion to be a check and abort, and so that only calls GC_is_visible if the check fails. vm_make_boot_program initializer fix * libguile/vm.c (vm_make_boot_program): Use #f as the "I don't have a program" value. correct use of SCM2PTR in SCM_I_REGISTER_DISAPPEARING_LINK forms * libguile/hashtab.c (set_weak_cdr): * libguile/vectors.c (scm_c_vector_set_x): * libguile/weaks.c (scm_weak_car_pair, scm_weak_cdr_pair): (scm_doubly_weak_pair): Use SCM2PTR for the target of SCM_I_REGISTER_DISAPPEARING_LINK calls. scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etc * libguile/deprecation.c (scm_issue_deprecation_warning) * libguile/eval.c (CAPTURE_ENV): * libguile/goops.c (make_dispatch_procedure, make_class_from_symbol): (create_smob_classes): * libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie): * libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold): * libguile/i18n.c (scm_nl_langinfo) * libguile/load.c (scm_primitive_load) * libguile/posix.c (scm_setrlimit) * libguile/socket.c (scm_to_sockaddr): * libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true / scm_is_null instead of comparing against SCM_BOOL_F et al. more care regarding SCM_PACK and SCM_UNPACK * libguile/control.c (reify_partial_continuation): * libguile/eval.c (RETURN_BOOT_CLOSURE): * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x) * libguile/frames.h (SCM_FRAME_SET_RETURN_ADDRESS): (SCM_FRAME_SET_MV_RETURN_ADDRESS, SCM_FRAME_SET_DYNAMIC_LINK): * libguile/goops.c (scm_class_of, scm_primitive_generic_generic) (scm_c_extend_primitive_generic, compute_getters_n_setters) (scm_sys_initialize_object): * libguile/guardians.c (finalize_guarded): * libguile/list.c (SCM_I_CONS): * libguile/macros.c (scm_i_make_primitive_macro) (scm_make_syntax_transformer): * libguile/memoize.c (MAKMEMO, SCM_MAKE_MEMOIZER) (SCM_MAKE_REST_MEMOIZER): * libguile/modules.c (scm_module_reverse_lookup) * libguile/print.c (iprin1): * libguile/promises.c (scm_make_promise) * libguile/srcprop.c (scm_make_srcprops): * libguile/vectors.c (scm_c_vector_ref): * libguile/vm-engine.c (vm_engine) * libguile/vm-i-scheme.c (REL, add1, sub1): * libguile/vm-i-system.c (new_frame, call_cc) * libguile/weaks.h (SCM_WEAK_PAIR_WORD_DELETED_P): Be more careful about SCM_PACK / SCM_UNPACK. scm_is_eq for SCM vals, not == or != * libguile/bytevectors.c (scm_make_bytevector, STRING_TO_UTF) (UTF_TO_STRING): * libguile/continuations.c (scm_i_check_continuation): * libguile/expand.h (SCM_EXPANDED_P): * libguile/fluids.c (scm_i_make_with_fluids): * libguile/generalized-vectors.c (scm_make_generalized_vector): * libguile/goops.c (SCM_GOOPS_UNBOUNDP, slot_definition_using_name): (scm_c_extend_primitive_generic, more_specificp, scm_make) * libguile/i18n.c (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): (scm_locale_string_to_integer) * libguile/modules.c (resolve_duplicate_binding): (scm_module_reverse_lookup) * libguile/posix.c (scm_to_resource): * libguile/r6rs-ports.c (scm_put_bytevector): * libguile/socket.c (scm_connect, scm_bind, scm_sendto * libguile/stacks.c (find_prompt): * libguile/variable.c (scm_variable_ref, scm_variable_bound_p): * libguile/vm-engine.h (ASSERT_BOUND_VARIABLE, ASSERT_BOUND) * libguile/vm-i-system.c (VARIABLE_BOUNDP, local_bound) (long_local_bound, fluid_ref): Use scm_is_eq to compare, not == / !=. 2011-05-13 Andy Wingo deprecate scm_internal_dynamic_wind * libguile/dynwind.c: * libguile/dynwind.h: * libguile/deprecated.h (scm_t_inner): * libguile/deprecated.c (scm_internal_dynamic_wind): Deprecate, as the scm_dynwind API is better, and this API encourages users to stuff SCM values into pointers. 2011-05-13 Andy Wingo excise scm_internal_dynamic_wind from goops.c * libguile/goops.c (go_to_hell, go_to_heaven, purgatory): (scm_change_object_class): Rewrite to use scm_dynwind_begin instead of scm_dynamic_wind. async.c refactor * libguile/async.c (increase_block, decrease_block): Write more clearly. (scm_dynwind_block_asyncs, scm_dynwind_unblock_asyncs): Move definitions up. (scm_call_with_blocked_asyncs, scm_c_call_with_blocked_asyncs) (scm_call_with_unblocked_asyncs, scm_c_call_with_unblocked_asyncs): Implement in terms of scm_dynwind_{un,}block_asyncs, so that we don't stuff SCM values into pointers. 2011-05-13 Andy Wingo fix type errors * libguile/numbers.c (scm_logand): Fix a type error (comparing a SCM against an int, when we really wanted to compare the unpacked fixnum). * libguile/ports.c (scm_i_set_conversion_strategy_x): Check scm_conversion_strategy_init, not scm_conversion_strategy. * libguile/read.c (recsexpr): Fix loops to avoid strange test of SCM values. 2011-05-13 Andy Wingo allow iflags to be constant expressions with typing-strictness==2 * libguile/tags.h (SCM_MAKE_ITAG8_BITS): New helper, produces a scm_t_bits instead of a SCM, because SCM_UNPACK is not a constant expression with SCM_DEBUG_TYPING_STRICTNESS==2. (SCM_MAKIFLAG_BITS): Remove SCM_MAKIFLAG, and replace with this, which returns bits. (SCM_BOOL_F_BITS, SCM_ELISP_NIL_BITS, SCM_EOL_BITS, SCM_BOOL_T_BITS): (SCM_UNSPECIFIED_BITS, SCM_UNDEFINED_BITS, SCM_EOF_VAL_BITS): (SCM_UNBOUND_BITS): New definitions. Defined SCM_BOOL_F, etc in terms of them. (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0): (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_1): (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_2): (SCM_XXX_ANOTHER_LISP_FALSE_DONT_USE): Be bits instead of SCM values. (SCM_BITS_DIFFER_IN_EXACTLY_ONE_BIT_POSITION): (SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS): Rename from SCM_VALUES_DIFFER_..., and take unpacked bits as the args. * libguile/boolean.c: Update verify block to use SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS et al. * libguile/debug.c (scm_debug_opts): * libguile/print.c (scm_print_opts): * libguile/read.c (scm_read_opts): Use iflags bits for initializers. * libguile/hash.c (scm_hasher): Use _BITS for iflags as case labels. * libguile/pairs.c: Nil/null compile-time check uses SCM_ELISP_NIL_BITS. 2011-05-13 Andy Wingo fix static allocation with debug_typing_strictness==2 * libguile/tags.h (SCM): For SCM_DEBUG_TYPING_STRICTNESS==2, give the union a tag, and use C99 compound literals to construct the value. This allows SCM_PACK to be a constant expression. * libguile/snarf.h: Allow SCM_SUPPORT_STATIC_ALLOCATION for SCM_DEBUG_TYPING_STRICTNESS==2. (SCM_IMMUTABLE_STRING): Properly parenthesize the string length. (SCM_STATIC_PROGRAM): Fix for SCM_DEBUG_TYPING_STRICTNESS==2. 2011-05-12 Andy Wingo remove all deprecated code * libguile/async.c: * libguile/async.h: * libguile/debug.h: * libguile/deprecated.c: * libguile/deprecated.h: * libguile/evalext.h: * libguile/gc-malloc.c: * libguile/gc.h: * libguile/gen-scmconfig.c: * libguile/numbers.c: * libguile/ports.c: * libguile/ports.h: * libguile/procprop.c: * libguile/procprop.h: * libguile/read.c: * libguile/socket.c: * libguile/srfi-4.h: * libguile/strings.c: * libguile/strings.h: * libguile/tags.h: * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm: Remove all deprecated code. CPP defines that were not previously issuing warnings were changed so that their expansions would indicate the replacement forms to use, e.g. scm_sizet__GONE__REPLACE_WITH__size_t. The two exceptions were SCM_LISTN, which did not produce warnings before, and the string-filter argument order stuff. Drops the initial dirty memory usage of Guile down to 2.8 MB on my machine, from 4.4 MB. 2011-05-12 Andy Wingo add missing SCM_DEPRECATED annotation * libguile/deprecated.h: Use SCM_DEPRECATED instead of SCM_API for the asinh, acosh, atanh, and atan2 wrappers. Merge remote-tracking branch 'origin/stable-2.0' all deprecated routines emit warnings * module/ice-9/deprecated.scm (substring-move-left!) (substring-move-right!, dynamic-maybe-call, dynamic-maybe-link) (try-module-linked, try-module-dynamic-link) ($asinh, $acosh, $atanh, $sqrt, $abs, $exp, $log, $sin, $cos) ($tan, $asin, $acos, $atan, $sinh, $cosh, $tanh) (process-define-module): Add deprecation warnings. 2011-05-09 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2011-05-08 Andy Wingo fix some duplication in object tables * module/language/glil/compile-assembly.scm (build-object-table): Don't add the same value to an object table twice. 2011-05-08 Ludovic Courtès Add `vhash-fold-right'. * module/ice-9/vlist.scm (vhash-fold-right): New procedure. * test-suite/tests/vlist.test ("vhash")["vhash-fold-right"]: New test. * doc/ref/api-compound.texi (VHashes): Document `vhash-fold-right'. 2011-05-08 Ludovic Courtès Optimize `vlist-fold-right'. * module/ice-9/vlist.scm (vlist-fold-right): Avoid `vlist-reverse' and instead `vlist-ref' individual elements. The result is about twice faster. Thanks Andy for suggesting it indirectly. :-) 2011-05-08 Andy Wingo add map and for-each benchmarks * benchmark-suite/benchmarks/srfi-1.bm ("map", "for-each"): Add benchmarks. 2011-05-08 Ludovic Courtès Fix small integer return value packing on big endian machines. * libguile/foreign.c (pack): Add `return_value_p' parameter. Update callers. When RETURN_VALUE_P is true, assume LOC points to an `ffi_arg', and cast its results to the relevant type. This fixes packing of integer return values smaller than `int' on SPARC64 and PowerPC64. Reported by Nelson H. F. Beebe . Make the definition of `scm_read_shebang' match its declaration. * libguile/read.c (scm_read_shebang): Remove the `inline' keyword. 2011-05-08 Andy Wingo compile-assembly: cleanup * module/language/glil/compile-assembly.scm: Clean up code for subprograms (not needed, we just cache the glil) and object alists (replaced by constants tables). 2011-05-08 Andy Wingo compile-assembly: use file-level constants table * module/language/glil/compile-assembly.scm (compile-assembly): Rework to handle toplevel-specific code generation here, instead of in glil->assembly. Specifically, here we build a global constant table, and arrange for it to be the objtable of the toplevel thunk. (compile-program): New helper, compiles a and returns just the (load-program ...) form. (compile-objtable): New helper, generates assembly to build an object table, using some other constants table, and possibly recursing to `compile-program' for cached GLIL programs. (glil->assembly): Simplify, removing the toplevel? argument, and replacing the object alist with an objtable computed in a previous pass. Adapt to the new form of the objtable, and to use compile-program and compile-objtable. 2011-05-08 Andy Wingo compile-assembly: add dump-constants, a new helper * module/language/glil/compile-assembly.scm (dump-constants): New helper. Generates bytecode that will result in a vector for the global object table being pushed on the stack. The items in the global object table will share state as much as possible. compile-assembly: add build-constant-store, build-object-table * module/language/glil/compile-assembly.scm (immediate?): New helper. (build-constant-store): New helper. Walks the GLIL tree and builds up a constant table, as a vhash. (build-object-table): Another helper, builds a constant table for a given GLIL program. compile-assembly: make-meta refactor * module/language/glil/compile-assembly.scm (make-meta): Avoid going through the compiler. compile-assembly: add traversal helpers * module/language/glil/compile-assembly.scm (vhash-fold-right2): (fold2, vector-fold2): Add some traversal helpers that we'll use in the next commit. fix `hash' for inf and nan * libguile/hash.c (scm_hasher): Fix to work on inf and nan. * test-suite/tests/hash.test ("hash"): Add tests. 2011-05-07 Andreas Rottmann Make the R6RS simple I/O library use conditions * module/rnrs/io/ports.scm (display): Implement as an exception-converting wrapper around Guile's core display. * module/rnrs/io/simple.scm: Don't export Guile's corresponding core procedures, but use `(rnrs io ports)' instead. This way, we get the conditions required by R6RS raised. * doc/ref/r6rs.texi (rnrs io simple): Mention that these procedures are supposed to raise R6RS conditions. 2011-05-07 Ludovic Courtès Fix `get_utf8_codepoint' to not consume valid starting bytes. Thanks to Mark H. Weaver for pointing this out. * libguile/ports.c (CONSUME_PEEKED_BYTE): New macro. (get_utf8_codepoint): New variable `pt'. Use `scm_peek_byte_or_eof'/`CONSUME_PEEKED_BYTE' pairs instead of `scm_get_byte_or_eof'. * test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42, #xe0 #xa0 #x41 #x42, #xf0 #x88 #x88 #x88]: Fix to conform to Unicode 6.0.0. [#xe0 #x88 #x88]: Remove test. [#xf0 #x80 #x80 #x41]: New test. 2011-05-07 Ludovic Courtès Add `scm_peek_byte_or_eof'. * libguile/inline.h (scm_get_byte_or_eof): Add `SCM_UNLIKELY' for EOF. (scm_peek_byte_or_eof): New function. * libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_peek_byte_or_eof'. 2011-05-07 Andreas Rottmann More completely document the `(rnrs io ports)' library * doc/ref/api-io.texi (R6RS I/O Ports): Transcribe missing parts from the R6RS document. 2011-05-07 Andy Wingo bytevectors have internal parent field * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Bump, giving bytevectors another word: a parent pointer. Will allow for sub-bytevectors and efficient mmap bindings. * libguile/bytevectors.c (make_bytevector): (make_bytevector_from_buffer): Init parent to #f. (scm_c_take_bytevector, scm_c_take_typed_bytevector): Another argument, the parent, which gets set in the bytevector. * libguile/foreign.c (scm_pointer_to_bytevector): Use the parent field instead of registering a weak reference from bytevector to foreign pointer. * libguile/objcodes.c (scm_objcode_to_bytecode): Use the parent field to avoid copying the objcode. * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): * libguile/strings.c (scm_from_stringn): * libguile/vm.c (really_make_boot_program): * libguile/r6rs-ports.c (scm_get_bytevector_some) (scm_get_bytevector_all, bytevector_output_port_procedure): Set the parent to #f. 2011-05-07 Andy Wingo fix srfi-1 map-in-order definition * module/srfi/srfi-1.scm (map-in-order): As we are not extending the core `map' binding, actually make a new `map-in-order' alias here. Fixes fresh builds. 2011-05-06 Ludovic Courtès Special-case UTF-8 ports to bypass `iconv' entirely. * libguile/ports.c (update_port_lf): Handle EOF. (get_utf8_codepoint, get_iconv_codepoint): New functions. (get_codepoint): Use them. (scm_i_set_port_encoding_x): Don't open conversion descriptors when ENCODING is "UTF-8". * libguile/print.c (display_string_as_utf8, display_string_using_iconv): New functions. (display_string): Use them. * test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42]: Add a note that this is not the wrong behavior per Unicode 6.0.0. 2011-05-06 Ludovic Courtès Fix `foreign.test' for big endian machines. * test-suite/tests/foreign.test ("pointer<->bytevector")["pointer from bits", "dereference-pointer"]: Fix iteration order for big endian machines. 2011-05-06 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2011-05-06 Andy Wingo avoid tls gets when handling interrupts in the vm * libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a scm_i_thread* as well. OK to do because it's within a BUILDING_LIBGUILE block. * libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of the dynstate, so we can use the thread for ticks. * libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the scm_i_thread* local var, to avoid excessive tls calls. * libguile/vm-i-system.c: Fix dynstate users to use current_thread->dynamic_state. 2011-05-05 Andy Wingo map and for-each in scheme * module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead of C. There are boot versions before `cond' is defined. (map-in-order): Define this alias here instead of in evalext.h. * libguile/eval.c: Stub out the map and for-each definitions to just call into Scheme. * libguile/evalext.c: Remove map-in-order definition. * module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map. (map, for-each): Define implementations here, in Scheme, instead of in C. * test-suite/tests/eval.test (exception:wrong-length, "map"): Update the expected exception for mapping over lists of different lengths. * libguile/srfi-1.h: * libguile/srfi-1.c: Remove map and for-each definitions. Remove the bit that extended the core `map' primitive with another method: the right way to do that is with modules. 2011-05-05 Andy Wingo psyntax simplification * module/ice-9/psyntax.scm (strip): Inline the and-map* definition to its one call site. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-05-05 Andy Wingo scm_mem[qv] optimization * libguile/list.c (scm_memq, scm_memv): Inline the tortoise/hare check that scm_ilength does, via SCM_VALIDATE_LIST, into the memq/memv bodies. Avoids traversing these lists twice. 2011-05-05 Ludovic Courtès Generate `escape' and `substitute' port decoding tests. 2011-05-05 Andy Wingo Merge remote-tracking branch 'origin/stable-2.0' 2011-05-05 Andy Wingo VM tweaks * libguile/vm-engine.c (VM_CHECK_OBJECT, VM_CHECK_FREE_VARIABLES): Set to 0 for both engines. These are really internal debugging variables, which don't affect user-visible features, provided that the compiler is correct of course. (VM_CHECK_UNDERFLOW): New var, also off by default: whether to check for stack underflow when popping values. (vm_engine): Don't declare object_count if we are not checking object table accesses. * libguile/vm-engine.h (CACHE_PROGRAM): Don't muck with object_count if we are not checking object table accesses. (CHECK_UNDERFLOW, PRE_CHECK_UNDERFLOW): Nop out if we are not checking underflow. (POP2, POP3): New macros which check for underflow before popping more than one value. * libguile/vm-i-loader.c (load_array): * libguile/vm-i-scheme.c (set_car, set_cdr, vector_set, slot_set) (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET, BV_INT_SET) (BV_FLOAT_SET): * libguile/vm-i-system.c (partial_cont_call, fix_closure, prompt) (fluid_set): Use POP2 / POP3. (local_set, long_local_set): Pop to locals instead of using values on the stack then dropping; allows for underflow to be checked before the value is accessed. (BR): Don't NULLSTACK or DROP after the operation. (br_if, br_if_not, br_if_eq, br_if_not_eq, br_if_null) (br_if_not_null): Pop to locals before doing the compare and jump. 2011-05-05 Andy Wingo srfi-1 `member' in scheme, inlines to memq / memv in some cases * libguile/srfi-1.c: * libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme. * module/srfi/srfi-1.scm (member): Implement here, with the inlining cases for eq? and eqv?. Speeds up a compiled bootstrap of psyntax.scm, because lset-adjoin inlines to the memq case. (lset<=): Reindent. (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass it through to `member', so we inline to memq / memv. Use something closer to the reference implementations. 2011-05-05 Andy Wingo speed up compile-bytecode * module/language/assembly/compile-bytecode.scm (compile-bytecode): Rewrite to fill a bytevector directly, instead of using bytevector ports. `write-bytecode' itself is still present and almost the same as before; it's just that `write-byte' et al now inline the effect of writing a byte to a binary port. * test-suite/tests/asm-to-bytecode.test (comp-test): Refactor to use public interfaces. 2011-05-05 Andy Wingo silly "optimization" in (language assembly) * module/language/assembly.scm (byte-length): Silly, minor tweak: put the fixed-length instruction case first. Seems to shave some 10% off the time compiling psyntax.scm (when the whole rest of the system is compiled, of course). add gcprof * module/statprof.scm (gcprof): New variant of statprof; instead of being driven by setitimer, this one is driven by the after-gc-hook. minor statprof tweaks * module/statprof.scm (statprof-reset): Make full-stacks? into an optional arg instead of doing the rest arg dance. (statprof-display): Format gc-time-taken appropriately. 2011-05-04 Ludovic Courtès Automatically generate `peek-char' decoding error tests. * test-suite/tests/ports.test ("string ports")[make-peek+read-checks]: New macro. [test-decoding-error]: Change to take a list of expected characters or conditions. Use `make-peek+read-checks' to generate a `peek-char' test. [(#xc2 #x41 #x42), (#xe0 #xa0 #x41 #x42)]: New tests. 2011-05-04 Andy Wingo measure time spent in gc * libguile/gc.c (scm_gc_stats): Set the gc-time-taken entry to our recorded value. (start_gc_timer, accumulate_gc_timer, scm_init_gc): Arrange to record a conservative estimate of time spent in GC. 2011-05-04 Andy Wingo scm_c_get_internal_run_time is more precise * libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C variable instead of being a pure preprocessor thing. This has the possibility to break existing compiled C extensions' interpretation of the internal-time-units-per-second, but hopefully there's no too much of that code out there, and in the worst case they can just recompile. Scheme code will get it right without the need to recompile. * libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and increase to nanosecond resolution if we are on a system in which this is useful and practical. (time_from_seconds_and_nanoseconds): New helper. (get_internal_real_time, get_internal_run_time): New global vars: function pointers. (get_internal_real_time_posix_timer): (get_internal_run_time_posix_timer): (get_internal_real_time_gettimeofday): (get_internal_run_time_times): (get_internal_real_time_fallback): Various implementations. (scm_get_internal_real_time): Return the get_internal_real_time() result. (scm_c_get_internal_run_time): Likewise. (scm_gettimeofday): No need for a critical section, and remove obsolete ftime block. (scm_init_stime): Init all of the new time bases, and decide on implementations of real time and run time accessors. 2011-05-04 Andy Wingo build support for detecting clock_gettime, with -lrt if needed * acinclude.m4 (gl_CLOCK_TIME): * configure.ac: Locally include gl_CLOCK_TIME. To be fixed properly when gnulib updates their license to reflect the actual BSD state of things. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Add -lrt for clock_gettime, if needed. * meta/guile-2.0-uninstalled.pc.in: * meta/guile-2.0.pc.in: Likewise, in Libs.private. 2011-05-02 Daniel Llorens Fix call-with-input-file & relatives for multiple values * module/ice-9/r4rs.scm (call-with-input-file, call-with-output-file): Rewrite with call-with-values. (with-input-from-file): use call-with-input-file. (with-output-to-file, with-error-to-file): use call-with-output-file. Update docstrings to make clear that multiple values may be yielded. 2011-05-01 Andy Wingo deprecate scm_struct_table * libguile/goops.h: * libguile/goops.c (scm_i_define_class_for_vtable): New internal helper, defines a class for a vtable, relying on the name slot being set correctly. (scm_class_of, create_struct_classes): Use the local vtable-to-class map instead of scm_struct_table. * libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME) (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table) (scm_struct_create_handle): Deprecate these internals of the map between structs and classes. * libguile/deprecated.h: * libguile/deprecated.c (scm_struct_create_handle): Deprecated code over here now. 2011-05-01 Andy Wingo disallow get-handle / create-handle! of weak hash tables * libguile/hashtab.c (scm_hashq_get_handle, scm_hashq_create_handle_x) (scm_hashv_get_handle, scm_hashv_create_handle_x) (scm_hash_get_handle, scm_hash_create_handle_x) (scm_hashx_get_handle, scm_hashx_create_handle_x): Don't allow these functions to be called on weak hash tables, as we have no idea when the GC will null out fields of the handle, and set-cdr! won't register disappearing links, and set-car! would never work of course. (ice-9 poe) does not get handles from weak hash tables * module/ice-9/poe.scm (pure-funcq, perfect-funcq): Reimplement to not use get-handle. boot-9 fixme note * module/ice-9/boot-9.scm (module-replace!): Add a fixme about using something other than object properties here. fix scm_object_property_set_x for handles and weak tables * libguile/objprop.c (scm_object_property_set_x): Use ref and set! instead of create-handle and set-cdr!, as it is a weak hash table. (scm_set_object_properties_x): Likewise. deprecated primitive-properties don't get handles from weak hash tables * libguile/deprecated.c (scm_primitive_property_ref) (scm_primitive_property_set_x): Avoid getting handles to elements in a weak hash table, as that's not going to work very well. 2011-05-01 Andy Wingo deprecate scm_whash API * libguile/deprecated.h: * libguile/deprecated.c (scm_whash_get_handle, SCM_WHASHFOUNDP) (SCM_WHASHREF, SCM_WHASHSET, scm_whash_create_handle) (scm_whash_lookup, scm_whash_insert): Deprecate this API. * libguile/srcprop.c: * libguile/srcprop.h: * libguile/read.c (scm_read_sexp): Use the hashq API instead of the whash API. 2011-05-01 Andy Wingo fix hash-set! in weak-value table from non-immediate to immediate * libguile/hashtab.c (set_weak_cdr, scm_hash_fn_set_x): If we have a weak-value hash table with a previous non-immediate value for a given key, and we are setting an immediate as the new value, we were not unregistering the disappearing link. Fixed. 2011-04-29 Andy Wingo fix free-id=? for module-bound keywords * module/ice-9/psyntax.scm (free-id=?): For identifiers that are resolved to the toplevel, check that the variables that they would resolve to are equal, instead of simply checking that the symbolic identifier names are equal. Allows keywords to be bound, renamed, exported, excluded, etc. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-04-29 Andy Wingo eval-when matches situations symbolically * module/ice-9/psyntax.scm (chi-when-list): Just match symbolically instead of lexically, so as not to tie the meaning of eval-when to the bindings of eval, load, compile, and expand. oop goops comment * module/oop/goops.scm: Add a note about the need to deprecate min-fixnum and max-fixnum. psyntax simplification * module/ice-9/psyntax.scm (id-var-name): Just rely on multiple-values truncation. 2011-04-29 Andy Wingo MV truncation in the boot evaluator * libguile/eval.c (truncate_values): New helper. (EVAL1): New macro, does an eval then truncates the values. (eval, prepare_boot_closure_env_for_apply) (prepare_boot_closure_env_for_eval): Use EVAL1 in appropriate places to get multiple-values truncation even here in the boot evaluator. eval.c fixen 2011-04-29 Andy Wingo latin1 strings in vm error messages * libguile/vm-engine.c: Use latin1 strings here for the string literals. 2011-04-28 Andy Wingo check for iconveh values at configure-time * configure.ac: Check for the iconveh values here, instead of relying on gen-scmconfig to know them. That doesn't work in general because gen-scmconfig runs on the build machine, not the target machine. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the revision before 533d8212. * libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR): (SCM_I_GSC_ICONVEH_QUESTION_MARK): (SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE): * libguile/gen-scmconfig.c: Use configure-time substitutions to set SCM_ICONVEH_ERROR_HANDLER et al. 2011-04-28 Andy Wingo -x error message fix * module/ice-9/command-line.scm (compile-shell-switches): Fix error message for -x switch. fix double-loading of script in -ds case * module/ice-9/command-line.scm (compile-shell-switches): In the -ds case, we were erroneously loading the script twice. Fix that. fix break example * doc/ref/api-control.texi (while do): Fix a break example. Merge remote-tracking branch 'origin/stable-2.0' Conflicts: GUILE-VERSION allow while as an expression * module/ice-9/boot-9.scm (while): Specify the return value as #f under normal conditions, #t under (break), and arg... under (break arg...). * test-suite/tests/syntax.test ("while"): Test. * doc/ref/api-control.texi (while do): Document. 2011-04-28 Andy Wingo add reset and shift * module/ice-9/control.scm (reset, shift): Add implementations of these operators from Wolfgang J Moeller, derived from implementations by Oleg Kiselyov. (reset*, shift*): Procedural variants. * test-suite/tests/control.test ("shift and reset"): Add tests, originally from Oleg Kiselyov. 2011-04-27 Ludovic Courtès Fix typo in `NEWS'. Bump version number for 2.0.1. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions such as `scm_c_public_ref' and `scm_from_latin1_keyword'. (LIBGUILE_INTERFACE_AGE): Increment. Update `NEWS'. 2011-04-27 Ludovic Courtès Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9). Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and 531c9f1dc51c4801c4d031ee80a31f15285a6b85. * module/srfi/srfi-9.scm (define-inlinable): New macro. 2011-04-27 Ludovic Courtès Document `(ice-9 binary-ports)'. * doc/ref/api-io.texi (R6RS I/O Ports): Mention `(ice-9 binary-ports)'. * NEWS: Update. 2011-04-27 Ludovic Courtès Add tests for UTF-8 ill-formed sequence handling. * test-suite/tests/ports.test ("string ports"): Add for `test-decoding-error' tests for ill-formed UTF-8 sequences. Thanks to Mark H Weaver for pointing this out. 2011-04-27 Ludovic Courtès Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'. * libguile/ports.c (get_codepoint): Return EILSEQ when OUTPUT_SIZE == 0. * test-suite/tests/ports.test ("string ports"): Add 2 tests for unterminated sequences. 2011-04-27 Ludovic Courtès Add a couple more Unicode I/O tests. * test-suite/tests/ports.test ("string ports")["%default-port-encoding is honored"]: Make sure `(port-encoding p)' is as expected. ["peek-char [utf-16]"]: New test. Rewrite port decoding error tests using a mini DSL. * test-suite/tests/ports.test ("string ports")[test-decoding-error]: New macro. ["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute", "peek-char, wrong encoding, error"]: Rewrite using `test-decoding-error'. Gracefully handle `setlocale' errors at the REPL. * module/ice-9/top-repl.scm (top-repl): Catch exceptions from `setlocale'. Reported by CRLF0710 . 2011-04-26 Ludovic Courtès Remove the `sizeof (mpz_t)' check. * libguile/numbers.c: Remove `sizeof (mpz_t)' check, which wasn't need anymore since `make_bignum' doesn't make any such assumption. 2011-04-25 Ludovic Courtès Use `scm_with_guile' in `test-pthread-create'. * test-suite/standalone/test-pthread-create.c (inner_main): New function. (main): Call it within `scm_with_guile', instead of using `scm_init_guile'. This improves portability--e.g., `GC_get_stack_base', used by `scm_init_guile', failed on Darwin up to BDW-GC 7.1alpha4 included (thanks, Mark, for the hint.) 2011-04-25 Ludovic Courtès Update Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'. * m4/gnulib-cache.m4: Remove `strcase' and `version-etc-fsf'. * configure.ac (POTENTIAL_GCC_CFLAGS): Remove `-Wundef'. * libguile/script.c: Don't include . 2011-04-25 Ludovic Courtès Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests. * test-suite/standalone/test-asmobs-lib.c, test-suite/standalone/test-extensions-lib.c, test-suite/standalone/test-ffi-lib.c, test-suite/standalone/test-list.c, test-suite/standalone/test-num2integral.c, test-suite/standalone/test-with-guile-module.c: Change `#ifndef HAVE_CONFIG_H' to `#ifdef HAVE_CONFIG_H' (!). Compile more file system related procedures when `--disable-posix'. * libguile/filesys.c (scm_tc16_dir, scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print, scm_dir_free, scm_lstat): Compile unconditionally. 2011-04-25 Ludovic Courtès Move `{total,current}-processor-count' outside of `posix.c'. * libguile/posix.c (scm_total_processor_count, scm_current_processor_count): Move to... * libguile/threads.c: ... here. * libguile/posix.h (scm_total_processor_count, scm_current_processor_count): Move declarations to... * libguile/threads.h: ... here. * test-suite/tests/posix.test ("nproc"): Move tests to... * test-suite/tests/threads.test: ... here. 2011-04-25 Ludovic Courtès Make the `sizeof (mpz_t)' check at compile-time. * libguile/init.c (scm_i_init_guile): Remove the `sizeof (mpz_t)' run-time check. * libguile/numbers.c: Add a compile-time check for `sizeof (mpz_t)'. 2011-04-25 Ludovic Courtès Add pthread-related tests. * test-suite/standalone/Makefile.am (test_scm_spawn_thread_CFLAGS, test_scm_spawn_thread_LDADD, test_pthread_create_CFLAGS, test_pthread_create_LDADD, test_pthread_create_secondary_CFLAGS, test_pthread_create_secondary_LDADD): New variables. (check_PROGRAMS)[BUILD_PTHREAD_SUPPORT]: Add `test-scm-spawn-thread', `test-pthread_create', `test-pthread_create-secondary'. (TESTS)[BUILD_PTHREAD_SUPPORT]: Likewise. * test-suite/standalone/test-scm-spawn-thread.c, test-suite/standalone/test-pthread-create.c, test-suite/standalone/test-pthread-create-secondary.c: New files. 2011-04-25 Ludovic Courtès Make `scm_i_ensure_signal_delivery_thread' call in Guile mode. * libguile/threads.c (on_thread_exit): Move `scm_i_ensure_signal_delivery_thread' call... (do_thread_exit): ... here. 2011-04-22 Ludovic Courtès Make sure binary ports pass `binary-port?' regardless of the locale. * libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Set `c_port->encoding' to NULL. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["bytevector-input-port is binary"]: New test. ("7.2.7 Input Ports")["make-custom-binary-input-port"]: Make sure PORT passes `binary-port?' and `input-port?'. ("8.2.10 Output ports")["bytevector-output-port is binary"]: New test. ["make-custom-binary-output"]: Rename to... ["make-custom-binary-output-port"]: ... this. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute", "peek-char, wrong encoding, error"]: Use `set-port-encoding!' instead of `%default-port-encoding' to set the encoding of bytevector input ports. * test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding error, substitute"]: Likewise. * doc/ref/api-io.texi (R6RS Port Manipulation): Document `binary-port?' and `textual-port?'. * doc/ref/r6rs.texi (R6RS Incompatibilities): Mention the soft distinction between textual and binary ports. 2011-04-22 Ludovic Courtès Turn the libunistring/iconv configure check into a macro. * acinclude.m4 (GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT): New macro. * configure.ac: Use it. 2011-04-22 Ludovic Courtès Fix typo in `configure.ac'. * configure.ac: Add missing comma in `AC_RUN_IFELSE' invocation. Increase the timeout of timing-sensitive thread tests. * test-suite/tests/threads.test ("timed locking succeeds if mutex unlocked within timeout", "timed unlocking returns #t if condition signaled", "timed joining succeeds if thread exits within timeout"): Increase the timeout. Reported by Dale P. Smith . 2011-04-21 Andy Wingo add test that libunistring was built with iconv support * configure.ac: Add check that libunistring was built with iconv support. Thanks to Mark Weaver for the debugging and test program. 2011-04-21 Mark H Weaver Clarify units of string length in decription of scm_from_stringn * doc/ref/api-data.texi (Conversion to/from C): In description of scm_from_stringn, clarify that the length is specified in bytes. 2011-04-20 Mark H Weaver Clarify the units of returned lengths in string conversion functions * doc/ref/api-data.texi (Conversion to/from C): In descriptions of scm_to_stringn and scm_to_{latin1,utf8,utf32}, clarify that the returned length is in units of bytes or code points, not characters. Also change NULL to @code{NULL} in a few places. 2011-04-15 Andy Wingo fix pre-GC_set_start_callback compilation * libguile/gc.c: Move declaration of run_before_gc_hook up. 2011-04-15 Andy Wingo pre-GC_set_start_callback compatibility * configure.ac: Add a check for GC_set_start_callback. * libguile/gc.c (scm_i_gc): If we don't have GC_set_start_callback, run the before-gc hook manually here. (scm_init_gc): Otherwise set it as a start callback. * libguile/hashtab.c (weak_gc_callback, weak_gc_hook) (weak_gc_finalizer, scm_c_register_weak_gc_callback): Fix to work either way, with or without GC_set_start_callback. 2011-04-15 Andy Wingo weak hash table vacuum on before-gc C hook * libguile/hashtab.c (weak_gc_callback) (scm_c_register_weak_gc_callback): Change implementation to use the before-gc C hook instead of the after-gc finalizers. use gc_start_callback + asyncs for after-gc-hook, instead of finalizers * libguile/gc.c (run_before_gc_c_hook, scm_storage_prehistory) (after_gc_async_thunk, queue_after_gc_hook, scm_init_gc): Instead of playing our finalizer trick, connect to the GC start callback, and use it to queue an async after-gc-hook. Seems to fix the after-gc-hook on non-threaded builds. Though this does re-enable the before-gc C hook, we don't wire up the Scheme hook because we're in the alloc lock; and indeed, a before-GC scheme hook isn't a great idea... 2011-04-15 Andy Wingo add --fresh-auto-compile * doc/ref/api-evaluation.texi (Compilation): Add discussion of --fresh-auto-compile. * doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile option. * NEWS: Add entry. * libguile/load.c: Define %fresh-auto-compile. (scm_primitive_load_path): Use it here. (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env var, with a value of "fresh". * module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is stale if %fresh-auto-compile is true. * module/ice-9/command-line.scm (compile-shell-switches): Parse out --fresh-auto-compile. 2011-04-15 Ludovic Courtès Build `filesys.x'. * libguile/Makefile.am (DOT_X_FILES): Add `filesys.x'. 2011-04-15 Ludovic Courtès Allow compilation with `--disable-posix'. Reported by Dmitry Dzhus . * configure.ac: Remove `AC_LIBOBJ([filesys])'. Document `--disable-posix' as omitting non-essential POSIX interfaces. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Add `filesys.c'. (DOT_DOC_FILES): Add `filesys.doc'. (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove `filesys.c'. * libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'. (scm_init_posix): Move `R_OK' etc. to `filesys.c'. * libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes, scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir, scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd, set_element, fill_select_type, get_element, retrieve_select_type, scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink, scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX. (scm_mkstemp, scm_access): New functions. (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on HAVE_POSIX. Define `R_OK', `W_OK', etc. * libguile/fports.c (fport_print): Use `scm_ttyname' only when HAVE_POSIX. * libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New functions. Update users of `scm_i_locale_mutex' to use them. * libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'. * meta/guile-tools.in (main): Use `setlocale' only when it is defined. * module/ice-9/boot-9.scm: Always load `ice-9/posix'. 2011-04-14 Ludovic Courtès Include in `posix.c'. * configure.ac: Check for . * libguile/posix.c [HAVE_SCHED_H]: Include , for `sched_setaffinity' & co. Reported by Marco Maggi . 2011-04-14 Ludovic Courtès Add tests for `-Wformat' and gettext. * test-suite/tests/tree-il.test ("warnings")["non-literal format string using gettext", "one missing argument, gettext"]: New tests. 2011-04-14 Andy Wingo fix analyze.scm literal string warnings * module/language/tree-il/analyze.scm (const-fmt): Return any literal value, not just strings. The string case is checked later. fix embarrassing bugs in (ice-9 command-line) * module/ice-9/command-line.scm (compile-shell-switches): Whoops, fix a few cases that forgot to loop back to the beginning. guile -v prints LGPLv3+. * module/ice-9/command-line.scm (compile-shell-switches): Though Guile may be distributed under the GPLv3, Guile is actually LGPLv3+. script.c calls out to (ice-9 command-line) * libguile/script.c (scm_shell_usage): Call (ice-9 command-line)'s shell-usage. (scm_compile_shell_switches): Likewise, call (ice-9 command-line)'s compile-shell-switches. add packager info to %build-info * libguile/load.c (init_build_info): Add packager, packager-version, and packager-bug-reports to %build-info, if they are available. add (ice-9 command-line) * module/ice-9/command-line.scm: New module for parsing Guile's command line, ported from script.c. Includes local eval-string implementation to make `guile -c 1' faster, by not having to load the compiler. * module/Makefile.am: Add to build. don't warn about non-literal fmt strings for e.g. (_ "foo") * module/language/tree-il/analyze.scm (const-fmt, format-analysis): Allow format strings to be gettexted, using the conventional _ name. 2011-04-13 Andy Wingo update NEWS * NEWS: Update for 2.0.1. (rnrs arithmetic fixnums) fixnum? export a procedure again * module/rnrs/arithmetic/fixnums.scm (fixnum?): Restore this export to be a procedure, not syntax. (inline-fixnum?): This is what fixnum? was. Use it internally. revert 4a2ac0623c3dabb2c8b9d38c27b837dcb2c7fe4e * module/ice-9/popen.scm (open-pipe*): No need to pump the pipes guardian here, now that hooks are working again. --disable-threads fix * libguile/threads.c (do_thread_exit_trampoline, on_thread_exit): (scm_i_init_thread_for_guile): Only register and unregister threads with bdw-gc when we are building with threads support. Thanks to Marijn for the report. 2011-04-11 Andy Wingo bump effective version to 2.2 * .gitignore: * GUILE-VERSION (GUILE_EFFECTIVE_VERSION): * configure.ac: * doc/example-smob/Makefile (CFLAGS, LIBS): * doc/guile.1: * doc/ref/libguile-concepts.texi: * doc/ref/srfi-modules.texi: * doc/ref/vm.texi: * meta/Makefile.am (EXTRA_DIST, pkgconfig_DATA): * meta/guile-config.in (guile-module): * meta/guile-2.2-uninstalled.pc.in: * meta/guile-2.2.pc.in: Bump effective version to 2.2. Merge remote branch 'origin/stable-2.0' Conflicts: GUILE-VERSION test-suite/tests/srfi-4.test 2011-04-11 Ian Price Fix fencepost error in bip_seek * libguile/r6rs-ports.c (bip_seek): Fix to allow seeking to end of port. * test-suite/tests/r6rs-ports.test ("bytevector input port can seek to very end"): Add tests. 2011-04-11 Ian Price fix assert to return true value. * module/rnrs/base.scm (assert): returns value instead of void. * test-suite/tests/r6rs-base.test ("assert"): add test cases. 2011-04-11 Ian Price Added optional second arg to R6RS log function * module/rnrs/base.scm (log): now takes a base argument, using the change of base formula for logs. * test-suite/tests/r6rs-base.test ("log (2nd arg)"): Add test cases. 2011-04-11 Andy Wingo fix reader.test for --disable-deprecated * test-suite/tests/reader.test: Fix deprecated tests; begin-deprecated was splicing in expression context before, which is a no-no. regen psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate, to take advantage of better #{}# serialization. 2011-04-11 Andy Wingo symbols with odd characters print better in #{}# * libguile/print.c (symbol_has_extended_read_syntax): Use a more general, unicode-appropriate algorithm. Hopefully doesn't cause any current #{}# cases to be unescaped. (print_extended_symbol): Use more appropriate unicode algorithm, and emit unicode hex escapes instead of our own lame escapes. * test-suite/tests/symbols.test: Add tests. 2011-04-11 Andy Wingo read-extended-symbol handles backslash better, including r6rs hex escapes * libguile/read.c (scm_read_extended_symbol): Interpret '\' as an escape character. Due to some historical oddities we have to support '\' before any character, but since we never emitted '\' in front of "normal" characters like 'x' we can interpret "\x..;" to be an R6RS hex escape. * test-suite/tests/reader.test ("#{}#"): Add tests. 2011-04-11 Andy Wingo refactor scm_i_print_symbol_name * libguile/print.c (symbol_has_extended_read_syntax) (print_normal_symbol, print_extended_symbol, scm_i_print_symbol_name): Factor scm_i_print_symbol_name into separate routines. Add comments. There are a number of bugs here. ignore SIGPIPE in (system repl server) * module/system/repl/server.scm (run-server): Ignore SIGPIPE when we run a server, as otherwise a rudely disconnected client could cause the server to quit. Thanks to John Proctor for the report, and Detlev Zundel for the debugging. 2011-04-09 Mark H Weaver Fix the R6RS exact-integer-sqrt and import into core guile * libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to compute exact integer square root and remainder. (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt' from the R6RS, imported into core guile. * libguile/numbers.h: Add prototypes. * module/rnrs/base.scm: Remove broken stub implementation, which would fail badly when applied to large integers. * doc/ref/api-data.texi: Add documentation. * doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a stub that xrefs the core docs, as is done for other operations available in core. * test-suite/tests/numbers.test: Add tests. * NEWS: Add news entries. 2011-04-08 Andreas Rottmann Implement R6RS' `fixnum?' in a smarter way * module/rnrs/arithmetic/fixnums.scm (fixnum?): Implemented using bit-twiddling, and using `define-inlinable'. 2011-04-07 Mark H Weaver Fix typo in arithmetic benchmark * benchmark-suite/benchmarks/arithmetic.bm (fixnum): Fix `-' benchmark to actually use `-' operator instead of `+' operator. 2011-04-07 Andreas Rottmann Move `define-inlinable' into the default namespace * module/ice-9/boot-9.scm (define-inlineable): Moved here from SRFI-9. * module/srfi/srfi-9 (define-inlinable): Removed here. * doc/ref/api-procedures.texi (Inlinable Procedures): Add subsection about `define-inlinable'. 2011-04-07 Mark H Weaver Fix parsing of exact numbers with negative exponents * libguile/numbers.c (mem2decimal_from_point): Use scm_divide instead of scm_divide2real when applying a negative exponent, to preserve exactness in case the "#e" forced exactness specifier is present. This fixes a bug where numeric literals such as "#e1e-5" yielded incorrect fractions. 2011-04-06 Mark H Weaver Doc fix: quotient/remainder/modulo do not require exact arguments * doc/ref/api-data.texi (Arithmetic): `floor-remainder' is equivalent to the R5RS `modulo' when the arguments are integers. Previously, equivalence was claimed only for exact integers. Similarly for `truncate-quotient' and `truncate-remainder' compared with the R5RS `quotient' and `remainder'. Undeprecate read syntax for uniform complex vectors * libguile/read.c (scm_read_sharp): Move the "#c..." case outside of #if SCM_ENABLE_DEPRECATED, and to the same section which handles "#s...", "#u..." and "#f...". Thanks to Andreas Rottmann for the bug report. 2011-04-04 Andreas Rottmann Several optimizations for R6RS fixnum arithmetic * module/rnrs/arithmetic/fixnums.scm (assert-fixnum): Is now a macro. (assert-fixnums): New procedure checking a the elements of a list for fixnum-ness. All callers applying `assert-fixnum' to a list now changed to use this procedure. * module/rnrs/arithmetic/fixnums.scm (define-fxop*): New for defining n-ary inlinable special-casing the binary case using `case-lambda'. All applicable procedures redefined using this macro. * module/rnrs/arithmetic/fixnums.scm: Alias all predicates to their non-fixnum counterparts. 2011-04-04 Andreas Rottmann Add a few benchmarks for R6RS fixnum arithmetic * benchmark-suite/benchmarks/r6rs-arithmetic.bm: New file containing some benchmarks for R6RS fixnum operations. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add benchmarks/r6rs-arithmetic. 2011-04-03 Andy Wingo pthread-threads.h: only redirect to GC_pthread_sigmask if it is present * configure.ac: Check for pthread_sigmask. * libguile/gen-scmconfig.c: Create SCM_HAVE_GC_PTHREAD_SIGMASK. * libguile/pthread-threads.h (scm_i_pthread_sigmask): Only redirect to GC_pthread_sigmask if GC_pthread_sigmask is present. 2011-04-01 Andy Wingo fix c32vector-set!, c64vector-set! * module/srfi/srfi-4/gnu.scm (bytevector-c32-native-set!): (bytevector-c64-native-set!): Fix to actually allow complex numbers. * test-suite/tests/srfi-4.test: Add tests. 2011-04-01 Andy Wingo string->pointer and pointer->string have optional encoding arg * test-suite/tests/foreign.test ("pointer<->string"): Add test cases. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Add optional encoding, and in the pointer->string case, length arguments. * libguile/foreign.h: Update prototypes of internal functions. Shouldn't affect ABI as they are internal. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update docs. 2011-04-01 Andy Wingo support loading objcode even if mmap(2) is unavailable * configure.ac: Check for sys/mman.h. * libguile/objcodes.c (verify_cookie): Factor cookie verification out to a helper function. (make_objcode_from_file): Rename from make_objcode_by_mmap. If mmap is unavailable, just read(2) to a bytevector. 2011-04-01 Andy Wingo make_objcode_by_mmap uses MAP_PRIVATE, not MAP_SHARED * libguile/objcodes.c (make_objcode_by_mmap): MAP_PRIVATE, not MAP_SHARED -- we don't need to update the underlying file, nor do we need to see updates. latin1 subr and message in internal scm_{encoding,decoding}_error * libguile/strings.c (scm_encoding_error, scm_decoding_error): Use scm_from_latin1_string for the subr and message args, as these are internal functions, and we know their callers. 2011-03-31 Andy Wingo fix duplicate path in uninstalled-env * meta/uninstalled-env.in: Our code that checked for paths already being in the load path was not working for the last entry in the load path. This caused the last entry to be re-added to the beginning, which also caused relative filename canonicalization to prepend "module/" to everything. Terrible. 2011-03-31 Kevin Fletcher fix gc_register_my_thread et al fallback impls * libguile/threads.c (GC_register_my_thread, GC_get_stack_base): Fix fallback impls. 2011-03-31 Andy Wingo web.texi: handler return types documentation * doc/ref/web.texi (Web Server): More docs on handler return types. web.texi: fix uri->string invocation * doc/ref/web.texi (Web Examples): Fix uri->string invocation. Thanks to Romel Sandoval for the report. 2011-03-31 Andy Wingo fix problems detecting coding: in block comments * libguile/read.c (scm_i_scan_for_encoding): Fix for coding on first line #! and for !# immediately following the coding. * test-suite/Makefile.am: * test-suite/tests/coding.test: Add tests. 2011-03-31 Andy Wingo inline fxops in psyntax * module/ice-9/psyntax.scm (fx+, fx-, fx=, fx<): Given our lame lack of an inliner, inline these manually with identifier syntax. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-03-31 Andy Wingo allow definitions in with-syntax body * module/ice-9/psyntax.scm (with-syntax): Allow definitions in the body, as seems to be suggested by the R6RS. * test-suite/tests/syncase.test ("with-syntax"): Add test. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-03-31 Michael Gran More descriptive error for dynamic-pointer * libguile/dynl.c (sysdep_dynl_value): Failure to find a symbol is not an error, so raise our own, more appropriate error. * test-suite/tests/foreign.test ("dynamic-pointer"): Add a test. 2011-03-30 Andy Wingo with-continuation-barrier calls exit(3) _after_ unwinding * libguile/continuations.c (scm_handler, c_handler) (scm_c_with_continuation_barrier, scm_with_continuation_barrier): Instead of calling scm_handle_by_message_noexit in the pre-unwind handler, roll our own exception printing in the pre-unwind, and do to exit()-on-quit in the post-unwind handler. This lets the stack unwind at exit-time so that pending dynwinds run. * test-suite/tests/continuations.test ("continuations"): Add a test. 2011-03-30 Michael Gran don't GC unregister null thread GC_unregister_my_thread is only supposed to be called from a thread other than the main thread, so, it should never be called when the system is compiled with null threads. * libguile/threads.c (on_thread_exit)[SCM_USE_NULL_THREADS]: don't call GC_unregister_my_thread 2011-03-30 Michael Gran check for GC_allow_register_threads This is not present in earlier versions of BDW-GC * configure.ac: check for GC_allow_register_threads * libguile/threads.c (scm_i_init_thread_for_guile): Only call GC_allow_register_threads if it is present. 2011-03-29 Ludovic Courtès Fix `procedure->pointer' for functions returning `void'. * libguile/foreign.c (unpack): Handle `FFI_TYPE_VOID'. * test-suite/tests/foreign.test ("procedure->pointer")["procedures returning void"]: New test. Reported by Tristan Colgate . 2011-03-29 Andy Wingo fix prompt and abort with the boot evaluator * libguile/control.h: * libguile/control.c (scm_i_prompt_pop_abort_args_x): Take a VM instead of a prompt, given that it's the VM's registers that record the abort arguments, not the prompt registers (which actually point right below the abort values). * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Pass the vm instead of a prompt. 2011-03-29 Andy Wingo fix compilation with libgc 7.0, 7.1 * configure.ac: Check for GC_pthread_exit and GC_pthread_cancel. * libguile/gen-scmconfig.c: Write HAVE_GC_PTHREAD_CANCEL and HAVE_GC_PTHREAD_EXIT into scmconfig.h. * libguile/pthread-threads.h (scm_i_pthread_exit, scm_i_pthread_cancel): Only redefine to their GC_pthread_* variants if we have those functions, which is not the case in libgc < 7.2. 2011-03-29 Andy Wingo fix error message on ,disassemble "non-procedure" * module/language/objcode/spec.scm (decompile-value): Don't assume that `error' will handle format strings appropriately. * module/system/repl/command.scm (disassemble): A more human error when you disassemble a non-procedure. Bug reported by Andrew Horton. 2011-03-29 Andy Wingo document -q, repl options * doc/ref/scheme-scripts.texi (Invoking Guile): Document -q. * doc/ref/scheme-using.texi (Init File): New section, on .guile. (Readline): Link to Init File. (System Commands): Document the various REPL options, and repl-default-option-set!. rewrite ensure-writable-dir to not be racy * module/system/base/compile.scm (ensure-writable-dir): Rewrite to not be racy. 2011-03-27 Andy Wingo fix prompt in fix in single-value context compilation * module/language/tree-il/compile-glil.scm (flatten): When compiling a in push context with an RA, after the body returns normally, jump to that RA instead of to our POST label (which in that case does not need to be emitted). Fixes a tail in a push . * test-suite/tests/control.test ("prompt in different contexts"): Add more test cases. 2011-03-27 Andy Wingo tree-il->scheme fix * module/language/tree-il.scm (tree-il->scheme): Fix to Scheme serialization. 2011-03-27 Noah Lavine Document SRFI-23 * doc/ref/srfi-modules.texi: mention that we support SRFI 23 * module/ice-9/boot-9.scm (%cond-expand-features): add srfi-23 2011-03-26 Bruno Haible Update comment about uc_locale_language. * libguile/i18n.c (locale_language): Update comment. 2011-03-26 Andy Wingo fix stexi->html double translation * module/texinfo/html.scm (entry): Fix to avoid double translation: arg-req already pulls an stexi->shtml on its arg. fix (texinfo reflection) to handle nested structures like syntax patterns * module/texinfo/reflection.scm (process-args): Convert any arg to a string. "Fixes" documentation of syntax-rules patterns. 2011-03-25 Neil Jerram Remove statements about scripts/* that are no longer true * doc/ref/tools.texi (Executable Modules): Say "guile-tools modules" instead of "executable modules". Remove obsolete statements about not ending in .scm, being executable, and beginning with shell script invocation sequence. * module/scripts/README: Ditto. 2011-03-25 Neil Jerram Inline the effect of am/pre-inst-guile It's just one variable definition, and in my opinion it confuses, rather than helps, the overall build picture to have two names (preinstguile and meta/guile) for the same thing. * am/Makefile.am (am_frags): Remove pre-inst-guile. * am/pre-inst-guile: Deleted. * doc/ref/Makefile.am: Don't include am/pre-inst-guile. ($(snarf_doc).am, $(snarf_doc).texi): Expand $(preinstguile). * module/Makefile.am (ice-9/psyntax-pp.scm.gen): Don't include am/pre-inst-guile. (ice-9/psyntax-pp.scm.gen): Expand $(preinstguile). 2011-03-25 Neil Jerram Make explicit that GUILE_FOR_BUILD is only used when cross-compiling * configure.ac (GUILE_FOR_BUILD): Change normal build value to 'this-value-will-never-be-used'. GUILE_FOR_BUILD is only needed by meta/guile.in, not by Makefiles * configure.ac: Use AM_SUBST_NOTMAKE for GUILE_FOR_BUILD instead of AC_SUBST. Remove unused definition of preinstguiletool * am/pre-inst-guile (preinstguiletool): Removed. 2011-03-25 Andy Wingo avoid running GC when SCM_I_CURRENT_THREAD is unset * libguile/threads.c (guilify_self_1): Prevent finalizers from running before SCM_I_CURRENT_THREAD is set. (do_thread_exit_trampoline): Leave the thread in the registered state. (on_thread_exit): Always unregister the thread here. 2011-03-25 Andy Wingo threading / with_guile refactor to use more GC_stack_base * libguile/init.h: * libguile/init.c (scm_i_init_guile): Change arg to this internal function from SCM_STACKITEM* to void*. Actually it's a struct GC_stack_base*. * libguile/bdw-gc.h: Don't do pthread redirects, because we don't want to affect applications' pthread_* bindings. * libguile/pthread-threads.h (scm_i_pthread_create) (scm_i_pthread_detach, scm_i_pthread_exit, scm_i_pthread_cancel) (scm_i_pthread_sigmask): Do pthread redirects here, in this internal header. * libguile/threads.h: Remove declaration of internal scm_i_with_guile_and_parent. Remove declaration of undefined scm_threads_init_first_thread. Make declaration of internal scm_threads_prehistory actually internal, and take a void* (actually a struct GC_stack_base*). * libguile/threads.c (GC_get_stack_base): Implement a shim if this function is unavailable, and fold in the implementations of get_thread_stack_base. (GC_call_with_stack_base): Actually implement. (guilify_self_1): Take a GC_stack_base* as an arg. (scm_i_init_thread_for_guile): Likewise, and set up libgc for registration of other threads. (scm_init_guile): Use GC_get_stack_base instead of our own guesswork. (with_guile_and_parent, scm_i_with_guile_and_parent): Rework to trampoline through a GC_call_with_stack_base. (scm_threads_prehistory): Pass the "base" arg on to guilify_self_1. 2011-03-25 Andy Wingo Revert "with-continuation-barrier carps, calls exit(3) _after_ unwinding" This reverts commit ecba00af6501e082b86c8f2f7730081c733509d7. 2011-03-24 Andy Wingo bdw-gc 6.8 compatibility (hopefully) * configure.ac (HAVE_GC_STACK_BASE): New check. * libguile/threads.c (GC_UNIMPLEMENTED, GC_SUCCESS): Define if needed. (GC_register_my_thread, GC_unregister_my_thread) (GC_call_with_stack_base): Define shims if needed. 2011-03-24 Andy Wingo with-continuation-barrier carps, calls exit(3) _after_ unwinding * libguile/continuations.c (scm_handler, c_handler) (scm_c_with_continuation_barrier, scm_with_continuation_barrier): Call scm_handle_by_message_noexit in the post-unwind handler, so that dynwinds * test-suite/tests/continuations.test ("continuations"): Add a test. 2011-03-23 Andy Wingo fix a failure to sync regs in vm bytevector ops * libguile/vm-i-scheme.c (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET) (BV_INT_SET, BV_FLOAT_SET): Sync registers before dispatching to the C function. 2011-03-22 Mark H Weaver Do not enter the debugger if the thrown key is in `pass-keys' * module/system/repl/error-handling.scm (call-with-error-handling): Do _not_ enter the debugger if the thrown key is in `pass-keys'. Previously, for example, (throw 'quit) entered the debugger when run from the REPL, despite the fact that 'quit is in `pass-keys'. 2011-03-20 Ludovic Courtès Make VM string literals immutable. * libguile/strings.c (scm_i_make_string, scm_i_make_wide_string): Add `read_only_p' parameter. All callers updated. * libguile/vm-i-loader.c (load_string, load_wide_string): Push read-only strings. * test-suite/tests/strings.test ("literals"): New test prefix. 2011-03-20 BT Templeton fix guile-snarf * libguile/snarf.h: New macro `SCM_SNARF_INIT_PREFIX'. (SCM_SNARF_INIT) Use `SCM_SNARF_INIT_PREFIX' instead of including a literal marker. If the preprocessor echoes #define directives to its output, this will prevent `guile-snarf' from snarfing the `SCM_SNARF_INIT' definition itself. Reported by Mike Gran . * libguile/guile-snarf.in (modern_snarf): Don't output anything for lines in which only one of the magic snarfing markers is present. Modify the `sed' program for compatibility with POSIX `sed'. The new `sed' program is based on a version by Wolfgang Jenkner . * test-suite/standalone/test-guile-snarf: New tests. 2011-03-20 Andreas Rottmann Add VM test for call/cc in non-tail position * test-suite/vm/t-call-cc.scm: Add test case using call/cc in a non-tail position. Fix syntax error in benchmark-suite/Makefile.am * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Correct position of a trailing backslash. 2011-03-19 Michael Gran Benchmarks for string comparisons * benchmark-suite/benchmarks/strings.bm: new file * benchmark-suite/Makefile.am: add strings.bm 2011-03-19 Andy Wingo fix new-frame push in call/cc * libguile/vm-i-system.c (call/cc): Whoops, fix the new-frame push here. A little birdie tells me a test case is coming soon. 2011-03-18 Andy Wingo fix thread cleanup * libguile/threads.h: Always declare a scm_i_thread_key, for cleanup purposes, in the BUILDING_LIBGUILE case. * libguile/threads.c (scm_i_thread_key): Init with a cleanup handler, so any guile-specific info for a thread can be cleaned up reliably. (guilify_self_1): Always set the thread key. (do_thread_exit_trampoline, on_thread_exit): Enter guile-mode for the guile-mode cleanup handler, and trampoline through a gc_call_with_stack_base for reasons explained in the code. (init_thread_key, scm_i_init_thread_for_guile): Always init the key. (scm_i_with_guile_and_parent): No need for pthread_cancel cleanup handlers, as the pthread key destructor will take care of that for us. (really_launch): Remove needless pthread_exit call with incorrect comment. 2011-03-18 Ludovic Courtès Fix `i18n.test' when the German or Greek locales aren't available. * test-suite/tests/i18n.test (%german-utf8-locale, %greek-utf8-locale): New variables. (under-german-utf8-locale-or-unresolved, under-greek-utf8-locale-or-unresolved): Use them. 2011-03-17 Ludovic Courtès i18n: Add case mapping and case-insensitive string comparison tests. Thanks to Mark H Weaver for coming up with most of the examples. * test-suite/tests/i18n.test (%german-utf8-locale-name, %greek-utf8-locale-name): New variables. (under-german-utf8-locale-or-unresolved, under-greek-utf8-locale-or-unresolved): New procedures. ("text collation (German)", "text collation (Greek)"): New tests prefixes. ("string mapping")["string-locale-upcase German", "string-locale-upcase Greek", "string-locale-upcase Greek (two sigmas)", "string-locale-downcase Greek", "string-locale-downcase Greek (two sigmas)"]: New tests. 2011-03-17 Ludovic Courtès i18n: Re-enable tests with the Turkish locale. * test-suite/tests/i18n.test ("character mapping")["char-locale-upcase Turkish", "char-locale-downcase Turkish"]: Re-enable. Passes with GNU libc 2.12.1. ("string mapping")["string-locale-upcase Turkish", "string-locale-downcase Turkish"]: Likewise. 2011-03-17 Andy Wingo add multibyte regexp test * test-suite/standalone/Makefile.am: * test-suite/standalone/test-mb-regexp: New test, that the previous patch fixed the abort() on fixup_multibyte_match. 2011-03-17 Andy Wingo scm_{to,from}_locale_string use current locale, not current ports * libguile/strings.c (scm_to_locale_stringn, scm_from_locale_stringn): Use the encoding of the current locale, not of the current i/o ports. Also use the current conversion strategy. * doc/ref/api-data.texi (Conversion to/from C): Update docs. 2011-03-17 Andy Wingo allow ,option on-error report instead of debug * module/system/repl/command.scm: * module/system/repl/debug.scm (terminal-width): Move terminal-width here, make it thread-local, and export it. (print-locals, print-frame, print-frames): Default width to terminal-width. * module/system/repl/error-handling.scm (call-with-error-handling): Add `report' and `backtrace' on-error handlers. * module/system/repl/common.scm (repl-default-options): Add on-error REPL option, defaulting to `debug', but which may be changed. * module/system/repl/repl.scm (run-repl): Pass the #:on-error REPL option to call-with-error-handling. 2011-03-17 Andy Wingo add heap-allocated-since-gc to gc-stats * libguile/gc.c (scm_gc_stats): Use add bytes_since_gc to the alist, under "heap-allocated-since-gc", and remove dead code. 2011-03-17 Andy Wingo fix code that causes warnings on gcc 4.6 * libguile/arrays.c (scm_i_read_array): * libguile/backtrace.c (display_backtrace_body): * libguile/filesys.c (scm_readdir) * libguile/i18n.c (chr_to_case): * libguile/ports.c (register_finalizer_for_port): * libguile/posix.c (scm_nice): * libguile/stacks.c (scm_make_stack): Clean up a number of set-but-unused vars. Thanks to Douglas Mencken for the report. * libguile/numbers.c (scm_log, scm_exp): Fix a few #if cases that should be #ifdef. 2011-03-17 Andy Wingo add pointer->scm, scm->pointer * libguile/foreign.c (scm_pointer_to_scm, scm_scm_to_pointer): New functions, useful to pass and receive SCM values to and from foreign functions. * module/system/foreign.scm: Export the new functions. * doc/ref/api-foreign.texi (Foreign Variables): Add docs. * test-suite/tests/foreign.test ("pointer<->scm"): Tests. 2011-03-15 Andy Wingo add more prompt/abort tests * test-suite/tests/control.test: Use c&e tests for most test blocks. Note that this did not catch the recent bug. ("reified continuations"): Add a new test for capturing partial continuations containing pending call frames. Before these would contain dynamic links pointing out of the continuation segment, which would not be relocated; now, the dynamic links are only made when the frames are activated. Thanks to Wolfgang J Moeller for the bug report and test case. 2011-03-15 Andy Wingo fix frame dynamic linkage in the face of partial continuation application * libguile/vm-i-system.c (new-frame): Though it was appealing to set the dynamic link here on the incomplete frame, we no longer do that, for the reasons mentioned in the code. (call, mv-call): Adapt to set the frame's dynamic link. * libguile/vm-engine.c (vm_engine): Don't set dynamic link here, even for boot program. * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x): Fix up not-yet-active frame detection. 2011-03-13 Ludovic Courtès doc: Remove "lack of support for Unicode I/O and strings". * doc/ref/api-io.texi (R6RS I/O Ports): Remove 1.8ish comment. 2011-03-13 Andreas Rottmann Enhance transcoder-related functionality of `(rnrs io ports)' * module/rnrs/io/ports.scm (transcoder-eol-style) (transcoder-error-handling-mode): Export these. (textual-port?): Implement this procedure and export it. * module/rnrs.scm: Export these here as well. * module/rnrs/io/ports.scm (port-transcoder): Implement this procedure. (binary-port?): Treat only ports without an encoding as binary ports, add docstring. (standard-input-port, standard-output-port, standard-error-port): Ensure these are created without an encoding. (eol-style): Add `none' as enumeration member. (native-eol-style): Switch to `none' from `lf'. * test-suite/tests/r6rs-ports.test (7.2.7 Input ports) (8.2.10 Output ports): Test binary-ness of `standard-input-port', `standard-output-port' and `standard-error-port'. (8.2.6 Input and output ports): Add test for `port-transcoder'. 2011-03-13 Andreas Rottmann Export `current-*-port' from `(rnrs io ports)' * module/rnrs/io/ports.scm: Export `current-input-port', `current-output-port' and `current-error-port' (see R6RS 8.2.7 "Input ports" and 8.2.10 "Output ports"). 2011-03-13 Andreas Rottmann Add `get-string-n' and `get-string-n!' for R6RS ports * libguile/r6rs-ports.c (scm_get_string_n_x): Implement `get-string-n!' in C for efficiency. * libguile/r6rs-ports.h: Add prototype for this function. * module/ice-9/binary-ports.scm: Export `get-string-n!'. * module/rnrs/io/ports.scm (get-string-n): Implement based on `get-string-n!'. Export both `get-string-n!' and `get-string-n'. * module/rnrs.scm: Also export these. * test-suite/tests/r6rs-ports.test (8.2.9 Textual input): Add a few tests for `get-string-n' and `get-string-n!'. 2011-03-13 Ludovic Courtès Work around weak-value hash table bug in `define-wrapped-pointer-type'. * module/system/foreign.scm (define-wrapped-pointer-type)[wrap]: Use `hash-ref' and `hash-set!' instead of `hash-create-handle!' and `set-cdr!'. 2011-03-11 Ludovic Courtès Fix `define-inlinable' in SRFI-9 so that arguments are evaluated only once. * module/srfi/srfi-9.scm (define-inlinable): When inlining, evaluate the arguments only once. Reported by Andreas Rottmann; thanks to Andy Wingo for the elegant solution. * test-suite/tests/srfi-9.test ("side-effecting arguments"): New test prefix. 2011-03-11 Andy Wingo fix port-filename without readline to match the docs * libguile/init.c (stream_body, scm_standard_stream_to_port): Don't name stdin, stdout, and stderr -- at least not as strings. That confuses any code which tries to treat port-filename as a real filename, like the syntax expander, or the `load' procedure/macro. Also this behavior matches the docs now. 2011-03-10 Mark H Weaver Fix bug to make `string=' much faster * libguile/srfi-13.c (scm_string_eq): Fix a bug which caused the slow general string_compare function to be used for strings of unequal lengths. 2011-03-10 Ludovic Courtès Thanks, Aidan. 2011-03-10 Ludovic Courtès FFI: Return the right alignment for structures. * libguile/foreign.c (scm_alignof): Fix handling of structure alignment. Reported by Aidan Gauland . * test-suite/tests/foreign.test ("structs")["alignof { int8, double, int8 }", "int8, { int8, double, int8 }, int16"]: New tests. 2011-03-09 Mark H Weaver Update Gnulib; add new modules; remove `round' module. This updates Gnulib to v0.0-4951-g6ff7b70. * m4/gnulib-cache.m4: Add floor, ceil, frexp, and ldexp. Add wchar as an explicit dependency; it had been present as an indirect dependency before, but no longer. Remove round, which I had requested earlier, but turned out to be unnecessary. 2011-03-09 Andy Wingo fix-letrec tweaks * module/language/tree-il/fix-letrec.scm (partition-vars): Previously, for letrec* we treated all unreferenced vars as complex, because of orderings of effects that could arise in their definitions. But we can actually keep simple and lambda vars as unreferenced, as their initializers cannot cause side effects. (fix-letrec!): Remove letrec* -> letrec code, as it's unneeded. 2011-03-09 Andreas Rottmann Don't mix definitions and expressions in SRFI-9 The expansion of `define-inlinable' contained an expression, which made SRFI-9's `define-record-type' fail in non-toplevel contexts ("definition used in expression context"). * module/srfi/srfi-9.scm (define-inlinable): Get rid of apparently useless expression in the expansion, so the expansion yields only definitions. At the same time, use a space in the generated names to lessen the chances of name conflicts, also avoiding -Wunused-toplevel warnings. * test-suite/tests/srfi-9.test (non-toplevel): New test verifying that `define-record-type' works in non-toplevel context as well. * doc/ref/srfi-modules.texi (SRFI-9 - define-record-type): Add subsubsection noting that Guile does not enforce top-levelness. 2011-03-09 Mark H Weaver Add scm_from_latin1_keyword and scm_from_utf8_keyword * libguile/keywords.c (scm_from_latin1_keyword, scm_from_utf8_keyword): New functions appropriate for use when keyword name is a constant. (scm_from_locale_keyword, scm_from_locale_keywordn): Change formal parameter from `str' to `name'. * libguile/keywords.h: Add prototypes for new functions. Change formal parameter of scm_from_locale_keyword* from `str' to `name'. * doc/ref/api-data.texi: Document new functions. Remind users that scm_from_locale_keyword should not be used when the name is a C string constant. Change formal parameter from `str' to `name'. 2011-03-09 Mark H Weaver Add scm_from_latin1_keyword and scm_from_utf8_keyword * libguile/keywords.c (scm_from_latin1_keyword, scm_from_utf8_keyword): New functions appropriate for use when keyword name is a constant. (scm_from_locale_keyword, scm_from_locale_keywordn): Change formal parameter from `str' to `name'. * libguile/keywords.h: Add prototypes for new functions. Change formal parameter of scm_from_locale_keyword* from `str' to `name'. * doc/ref/api-data.texi: Document new functions. Remind users that scm_from_locale_keyword should not be used when the name is a C string constant. Change formal parameter from `str' to `name'. 2011-03-09 Mark H Weaver Improve docs of string and symbol conversions from C strings * doc/ref/api-data.texi (Conversion to/from C): Document scm_from_latin1_string, scm_from_utf8_string, and scm_from_utf32_string. Remind readers that these functions should be used to convert C string constants, and that scm_from_locale_string is _not_ appropriate for that purpose. (Symbol Primitives): Document scm_from_latin1_symbol and scm_from_utf8_symbol. Remind readers that these functions should be used when the specified names are C string constants, and that scm_from_locale_symbol is _not_ appropriate for that purpose. 2011-03-09 Mark H Weaver Improve docs of string and symbol conversions from C strings * doc/ref/api-data.texi (Conversion to/from C): Document scm_from_latin1_string, scm_from_utf8_string, and scm_from_utf32_string. Remind readers that these functions should be used to convert C string constants, and that scm_from_locale_string is _not_ appropriate for that purpose. (Symbol Primitives): Document scm_from_latin1_symbol and scm_from_utf8_symbol. Remind readers that these functions should be used when the specified names are C string constants, and that scm_from_locale_symbol is _not_ appropriate for that purpose. 2011-03-09 Mark H Weaver Within `while', `continue' takes zero arguments * module/ice-9/boot-9.scm (while): Report an error if `continue' is passed one or more arguments. Previously, it would report an error if `(continue arg rest ...)' was found within the `while', but not if `continue' was found bare and later applied to one or more arguments, e.g. `(apply continue (list arg rest ...))'. 2011-03-09 Mark H Weaver Quotient, remainder and modulo accept inexact integers * libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo): Accept inexact integers as well as exact ones, as required by the R5RS. * test-suite/tests/numbers.test (quotient, remainder, modulo): Add tests. 2011-03-09 Mark H Weaver Within `while', `continue' takes zero arguments * module/ice-9/boot-9.scm (while): Report an error if `continue' is passed one or more arguments. Previously, it would report an error if `(continue arg rest ...)' was found within the `while', but not if `continue' was found bare and later applied to one or more arguments, e.g. `(apply continue (list arg rest ...))'. 2011-03-09 Mark H Weaver Quotient, remainder and modulo accept inexact integers * libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo): Accept inexact integers as well as exact ones, as required by the R5RS. * test-suite/tests/numbers.test (quotient, remainder, modulo): Add tests. 2011-03-08 Mark H Weaver Remove incorrect footnote from GOOPS manual * doc/ref/goops.texi (Inheritance): Remove footnote which incorrectly stated that was not shown in the class hierarchy figure. Update comments regarding GMP earlier than 4.2. * libguile/numbers.c: Update comments regarding GMP earlier than 4.2. Remove speculations about versions of GMP that had not yet been released when the comments were written. Replace them with facts that are now known about the changes made in GMP 4.2. Fix description of the R6RS `finite?' in manual * doc/ref/r6rs.texi (rnrs base): `(finite? x)' returns true iff x is neither infinite nor a NaN. Previously, it stated that `finite?' was the negation of `infinite?', which was incorrect because NaNs are neither finite nor infinite. Combine description of 'nan?' with those of `finite?' and `infinite?'. 2011-03-08 Mark H Weaver Fix bytevectors VALIDATE_REAL to test for reals, not rationals Reported and fixed by Daniel Llorens . * libguile/bytevectors.c (VALIDATE_REAL): Test for reals, not rationals. * test-suite/tests/srfi-4.test (f32 vectors, f64 vectors): Add tests. 2011-03-08 Mark H Weaver Remove incorrect footnote from GOOPS manual * doc/ref/goops.texi (Inheritance): Remove footnote which incorrectly stated that was not shown in the class hierarchy figure. Update comments regarding GMP earlier than 4.2. * libguile/numbers.c: Update comments regarding GMP earlier than 4.2. Remove speculations about versions of GMP that had not yet been released when the comments were written. Replace them with facts that are now known about the changes made in GMP 4.2. Fix description of the R6RS `finite?' in manual * doc/ref/r6rs.texi (rnrs base): `(finite? x)' returns true iff x is neither infinite nor a NaN. Previously, it stated that `finite?' was the negation of `infinite?', which was incorrect because NaNs are neither finite nor infinite. Combine description of 'nan?' with those of `finite?' and `infinite?'. 2011-03-08 Mark H Weaver Fix bytevectors VALIDATE_REAL to test for reals, not rationals Reported and fixed by Daniel Llorens . * libguile/bytevectors.c (VALIDATE_REAL): Test for reals, not rationals. * test-suite/tests/srfi-4.test (f32 vectors, f64 vectors): Add tests. 2011-03-08 Andy Wingo scm_public_ref et al docs * doc/ref/api-modules.texi (Accessing Modules from C): Add docs for the new C procedures. eval-string docs * doc/ref/api-evaluation.texi (Fly Evaluation): Update eval-string documentation. document scm_call_{5,6,n} * doc/ref/api-evaluation.texi (Fly Evaluation): Document scm_call_{5,6,n}. add scm_call_{5,6} * libguile/eval.h: * libguile/eval.c (scm_call_5, scm_call_6): New scm_call functions; why not. 2011-03-08 Andy Wingo fix scm_setter * libguile/procs.c (scm_setter): Only get at the setter slot if the pure generic actually has a setter. Needs test. * test-suite/tests/goops.test ("defining generics"): ("defining accessors"): Add `setter' tests. 2011-03-08 Andy Wingo core eval-string uses (ice-9 eval-string) * libguile/strports.c (scm_eval_string_in_module): Use eval-string from (ice-9 eval-string). add scm_c_public_ref et al * libguile/modules.h: * libguile/modules.c (scm_public_lookup, scm_private_lookup) (scm_c_public_lookup, scm_c_private_lookup, scm_public_ref) (scm_private_ref, scm_c_public_ref, scm_c_private_ref) (scm_public_variable, scm_private_variable, scm_c_public_variable) (scm_c_private_variable): New helpers to get at variables and values in modules. 2011-03-06 Ludovic Courtès Handle `letrec*' like `letrec' in simple cases. * module/language/tree-il/fix-letrec.scm (fix-letrec!): When X is a `letrec*' with only lambdas and simple expressions, analyze it as if it were a `letrec'. * test-suite/tests/tree-il.test ("letrec"): Add test for `(letrec* (x y) (xx yy) ((const 1) (const 2)) (lexical y yy))'. Have `gc-profile.scm' make sure it's on a Linux-based system. * gc-benchmarks/gc-profile.scm (memory-mappings): Check %HOST-TYPE for "-linux-". 2011-03-06 Ludovic Courtès Add `gc-benchmarks/' to the distribution. * gc-benchmarks/Makefile.am: New file. * configure.ac: Produce it. * Makefile.am (SUBDIRS): Add `gc-benchmarks'. 2011-03-06 Ludovic Courtès Make `object->string' explicitly close its string output port. * libguile/strports.c (scm_object_to_string): Close PORT before returning the resulting string. Slightly optimize `gensym'. * libguile/symbols.c (default_gensym_prefix): New variable. (scm_gensym): Use it. Use `scm_from_latin1_stringn' instead of `scm_from_locale_stringn'. (scm_init_symbols): Initialize DEFAULT_GENSYM_PREFIX. Simply grow string port buffers geometrically. * libguile/strports.c (SCM_WRITE_BLOCK): Remove. (st_flush): Multiply `pt->write_buf_size' by 2. (st_seek): Likewise when TARGET == PT->write_buf_size. 2011-03-06 Ludovic Courtès Let `scm_mkstrport' allocate buffers on the caller's behalf. * libguile/strports.c (INITIAL_BUFFER_SIZE): New macro. (scm_mkstrport): If STR is false, allocate a bytevector on the caller's behalf. (scm_object_to_string, scm_call_with_output_string, scm_open_output_string): Pass SCM_BOOL_F as the STR argument of `scm_mkstrport'. * libguile/backtrace.c (scm_display_application, display_backtrace_body): Likewise. * libguile/gdbint.c (scm_init_gdbint): Likewise. * libguile/print.c (scm_simple_format): Likewise. 2011-03-06 Ludovic Courtès Use a bytevector as the backing buffer of string ports. * libguile/strports.c (st_resize_port): Adjust to deal with OLD_STREAM and NEW_STREAM as bytevectors. (scm_mkstrport): Store a bytevector in the port's stream rather than a string. 2011-03-05 Andy Wingo add ice-9 eval-string * module/Makefile.am: * module/ice-9/eval-string.scm: New module, for use in implementing the scm_c_eval_string_from_file_line suggestion. * test-suite/Makefile.am: * test-suite/tests/eval-string.test: New tests. 2011-03-05 Andy Wingo remove obsolete comments * libguile/eval.c (scm_nconc2last): * libguile/strports.c (scm_c_read_string): Remove some obsolete comments. 2011-03-05 Mark Harig Updated Guile manual page. * doc/guile.1: Added the current month and year, Guile version descriptive text, and the text GNU to the title. Updated the nroff formatting commands for the SYNOPSIS and OPTIONS sections to what 'man' prescribes. See 'man(1)', 'man(7)', and 'man-pages(7)'. Corrected grammar, spelling, and capitalization (for example, 'scheme' to 'Scheme'). Vertical white-space was non-standard (two lines between some sections, one space between others). Changed this to the standard one empty line before each section heading, and added dots (a single period on a line) before every section heading (.SH) so that maintainers will find the readability unchanged. Added white space to follow the 'groff' recommendation of starting every sentence on its own line, and breaking sentences at punctuation. Corrected an error in description of the info command. Added the missing option '--no-debug', and the short switches '-h' and '-v'. Changed the description of the environment variable GUILE_LOAD_COMPILED_PATH so that it references the Guile variable `%load-compiled-path' instead of the variable `%load-path'. Updated the copyright to include 2011. 2011-03-04 BT Templeton guile-snarf: allow multiple init actions on one line * libguile/guile-snarf.in (modern_snarf): Allow programs to specify multiple initialization actions on a single line. This makes it possible for C programs to define multiple subrs with a single macro invocation. * test-suite/standalone/test-guile-snarf: Enable more tests. 2011-03-04 BT Templeton add guile-snarf tests * test-suite/standalone/test-guile-snarf: New file. * test-suite/standalone/Makefile.am: Add `test-guile-snarf'. 2011-03-04 Andy Wingo repl: terminal-width by default * module/system/repl/command.scm (terminal-width): New parameter that will use the true terminal width if unset. (backtrace, locals): Default to (terminal-width). (width): Simplify. 2011-03-04 Michael Gran Add ,width meta-command to set screen width in debug output This meta-command allows one to set the default number of columns that output from ,backtrace and ,locals shall occupy. * doc/ref/scheme-using.texi (Debug Commands): document ,width * module/system/repl/command.scm (*width*): new var (backtrace, locals): use *width* in optarg (width): new meta-command 2011-03-04 Andy Wingo fix ,stat * module/system/repl/command.scm (statistics): Fix for BDW-GC. Unfortunately we still don't have mallocation or time taken. 2011-03-03 Andy Wingo repl.scm understands comments * module/system/repl/repl.scm (read-comment, read-scheme-line-comment) (read-scheme-datum-comment): New helpers. (meta-reader): Take a language instead of a reader. If we have a nonwhitespace char, first check to see that it's a comment, and if so, read it off and loop. (prompting-meta-read): Call meta-reader with the lang. repl.scm refactor * module/system/repl/repl.scm (flush-leading-whitespace): Rename from next-char. (meta-reader): Use flush-leading-whitespace. (run-repl): Use flush-to-newline after the evaluation, which seems to be the same as what we did before. fix encoding scanning for non-seekable ports * libguile/read.c (scm_i_scan_for_encoding): If possible, just use the read buffer for the encoding scan, and avoid seeking. Fixes `(open-input-file "/dev/urandom")', because /dev/urandom can't be seeked backwards. 2011-03-03 Andy Wingo more module-use-interfaces! tweaks * module/ice-9/boot-9.scm (module-use-interfaces!): Fix up to prevent duplication in the use list of multiple incoming interfaces. * test-suite/tests/modules.test ("module-use"): Add tests. 2011-03-03 Andreas Rottmann Use module identity to filter for existing modules This fixes a problem with R6RS's `import' in particuliar: when importing a subset of a library/module, the interface created for that purpose inherits the name of the module it is derived from. The low-level primitives that are used for importing would then disregard earlier imports from the same module. An example for this bug can be seen with the following library definition: (library (test-guile2) (export foo) (import (only (rnrs base) define) (only (rnrs base) error)) (define (foo . args) #t)) In the above, the import of `define' would be disregarded when `error' is imported, thus leading to a syntax error, since `(foo . args)' is treated as an application, since the binding of `define' would be not present. * module/ice-9/boot-9.scm (module-use!): Remove the filtering of the existing imports of the module by name; a check for identity is already done beforehand. (module-use-interfaces!): Filter the existing imports by identity instead of filtering them by their names. 2011-03-03 Ludovic Courtès Remove extra comma after `SCM_ARRAY_ELEMENT_TYPE_LAST'. * libguile/array-handle.h (scm_t_array_element_type): Remove extra comma after last element. Reported by David Fang . Indent. 2011-03-02 Ludovic Courtès Improve the documentation for `dynamic-link'. * doc/ref/api-foreign.texi (Foreign Libraries): Make it clear that the LIBRARY argument of `dynamic-link' should not contain an extension. (Foreign Functions): Add cross-reference from `load-extension' to `dynamic-link'. Typeset file names and module names correctly. 2011-03-02 Mark H Weaver Portability fixes for popen.test (for when /bin/sh is not bash) * test-suite/tests/popen.test (open-input-pipe no-duplicate): Pass "read REPLY" command instead of "read" to the subshell, for improved portability. In particular, it is needed when /bin/sh is dash. (open-output-pipe no-duplicate): Pass "exec guile [...]" instead of "guile [...]" to the subshell, to ensure that the subshell will not run guile as a subprocess while holding a duplicate of STDIN, which would cause this test to fail. This is needed when /bin/sh is dash. 2011-03-02 Mark H Weaver Portability fixes for popen.test (for when /bin/sh is not bash) * test-suite/tests/popen.test (open-input-pipe no-duplicate): Pass "read REPLY" command instead of "read" to the subshell, for improved portability. In particular, it is needed when /bin/sh is dash. (open-output-pipe no-duplicate): Pass "exec guile [...]" instead of "guile [...]" to the subshell, to ensure that the subshell will not run guile as a subprocess while holding a duplicate of STDIN, which would cause this test to fail. This is needed when /bin/sh is dash. 2011-02-28 Ludovic Courtès Have `read' update line/column numbers when reading SCSH block comments. * libguile/read.c (scm_read_scsh_block_comment): Use `scm_getc' instead of `scm_get_byte_or_eof'. * test-suite/tests/reader.test ("read-options")["position of SCSH block comment"]: New test. 2011-02-28 Andy Wingo update port-filename docs * doc/ref/api-io.texi (File Ports): * libguile/ports.c (scm_port_filename): Fix docs to match implementation. 2011-02-28 Ludovic Courtès Link stand-alone tests against libgc. Reported by Andreas Rottmann . * test-suite/standalone/Makefile.am (LIBGUILE_LDADD): New variable. (test_num2integral_LDADD, test_round_LDADD, libtest_asmobs_la_LIBADD, libtest_ffi_la_LIBADD, test_list_LDADD, test_unwind_LDADD, test_conversion_LDADD, test_loose_ends_LDADD, test_scm_c_read_LDADD, test_scm_take_locale_symbol_LDADD, test_scm_take_u8vector_LDADD, libtest_extensions_la_LIBADD, test_with_guile_module_LDADD, test_scm_with_guile_LDADD): Use it. 2011-02-28 Ludovic Courtès Strip any CPPFLAGS other than `-I' from `guile-2.0.pc'. * configure.ac: Strip anything beyond `-I' from $GUILE_CFLAGS so that `guile-2.0.pc' does not export them to the user. Reported and fixed by Bruno Haible . 2011-02-27 Andy Wingo flush all input on a read error * module/system/repl/repl.scm (flush-all-input): New helper. (prompting-meta-read): Flush all input on a read error, as we could be within some expression or a string or something. 2011-02-27 Andy Wingo scm-error-printer resilience * module/ice-9/boot-9.scm (scm-error-printer): Allow #f for rest args, interpreting it as '(). Fixes regexp throws, which are of the form: (regular-expression-syntax "make-regexp" "Invalid preceding regular expression" #f ("?.*")) 2011-02-27 Andy Wingo update R6RS incompatibilities * doc/ref/r6rs.texi (R6RS Incompatibilities): Update. regenerate psyntax-pp * module/ice-9/psyntax-pp.scm: Regenerate. add syncase test * test-suite/tests/syncase.test ("top-level expansions"): New test. chi-top-sequence defines macros before expanding other exps * module/ice-9/psyntax.scm (chi-top-sequence): Manually inline eval-if-c&e into its two call sites; I found it hard to understand otherwise. If the mode is just 'e, defer expansion of definitions and expressions until the end, so that they can be expanded in a context of all syntax expanders defined in the sequence. psyntax: fold chi-top-sequence into chi-top * module/ice-9/psyntax.scm (chi-top-sequence): Pull chi-top into the body of this toplevel begin expander. This will let us do r6rs toplevel expansion correctly. (chi-top): Remove. (macroexpand): Dispatch to chi-top-sequence directly. 2011-02-25 Ludovic Courtès Fix `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (memory-mappings)[mapping-line-rx]: Fix and give an example. (total-heap-size): Fix docstring. 2011-02-25 Andy Wingo make-weak-key-hash-table vacuuming * libguile/hashtab.c (scm_make_weak_key_hash_table): Whoops, fix the case I actually cared about. 2011-02-24 Ludovic Courtès Revert ""latin1" -> "Latin-1"." This reverts commit c2c550ca9d2442d070f79ed8bacb8db173c72df3. The name "latin1" is standardized by IANA, unlike the other one. Reported by Bruno Haible. 2011-02-24 Ludovic Courtès Make `locale-digit-grouping' more robust. * libguile/i18n.c (scm_nl_langinfo)[GROUPING]: Consider negative numbers like `CHAR_MAX'. Reported by David Fang . Fix suggested by Bruno Haible . Fix README. * README: Remove mention of an alpha release. Reported by Mark H. Weaver. 2011-02-24 Andy Wingo weak hash tables vacuum stale entries after a gc * libguile/hashtab.c (scm_c_register_weak_gc_callback): New private helper, arranges for a C function to be called with a SCM as an argument, as long as the argument is reachable by GC. (scm_make_weak_key_hash_table) (scm_make_weak_value_hash_table) (scm_make_doubly_weak_hash_table): Register a weak GC callback to vacuum_weak_hash_table. re-enable the after-gc-hook * libguile/gc.c (scm_gc): No need to take a mutex here. Don't run the hook, the hook will run itself. (scm_c_register_gc_callback): New private helper, registers a callback the next time GC happens. (system_gc_callback): Guile's internal callback that runs scm_after_gc_c_hook, which itself queues a call to the after-gc-hook. (scm_storage_prehistory): Queue up a call to system_gc_callback. pointerless backing buffers for string ports * libguile/strports.c (scm_mkstrport): String port string buffer allocated atomically. errno saving in display_string * libguile/print.c (display_string): Fix a case in which perhaps `errno' could have been stompled. 2011-02-24 Andy Wingo web server more assiduous about closing ports * module/web/uri.scm: * module/web/server.scm (call-with-output-string*): (call-with-output-bytevector*): Local procs to output to strings or bytevectors, *and then close the port*. We can't make this change in call-with-output-string because it would be incompatible. * module/web/uri.scm (call-with-encoded-output-string, decode-string) (uri-decode) * module/web/server.scm (call-with-encoded-output-string): Use the new helpers. 2011-02-23 Andy Wingo open-pipe* pumps pipes guardian * module/ice-9/popen.scm (open-pipe*): Hack around the lack of an after-gc hook, and pump the pipes guardian here in the procedure that adds to the guardian. 2011-02-23 Andy Wingo GC dead links in weak hash tables before a possible rehash * libguile/hashtab.c (vacuum_weak_hash_table): New helper, goes through the entirety of a weak hash table, vacuuming dead entries. (scm_hash_fn_create_handle_x): If when adding to a weak hash table, we would trigger a rehash, vacuum the table first. The weak_bucket_assoc would have only caught dead entries within one bucket. Without this patch, the following code leaks: (let lp () (call-with-output-string (lambda (port) (display "foo" port))) (lp)) 2011-02-23 Ludovic Courtès Switch to 2.1.0. * GUILE-VERSION (GUILE_MAJOR_VERSION, GUILE_MINOR_VERSION, GUILE_MINOR_VERSION): Switch to 2.1.0. 2011-02-23 Mark H Weaver Portability fix for new log and log10 * libguile/numbers.c: Define M_LN2 if it's not already defined. Fix error in comment. Portability fix for new log and log10 * libguile/numbers.c: Define M_LN2 if it's not already defined. Fix error in comment. 2011-02-22 Ludovic Courtès Fix a bug in `vhash-delete'. * module/ice-9/vlist.scm (vhash-delete): Honor HASH. * test-suite/tests/vlist.test ("vhash")["vhash-delete honors HASH"]: New test. Use `vhash-delq' in `(language tree-il analyze)'. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use `vhash-delq' instead of `vhash-delete'. Optimize `vhash-delete'. * module/ice-9/vlist.scm (vhash-delete): Check whether KEY is in VHASH and return VHASH if it's not. Add omitted exports from `(ice-9 vlist)'. * module/ice-9/vlist.scm: Export `vhash-delq' and `vhash-delv'. Compile `(rnrs)' after all other RNRS modules, potentially. * module/Makefile.am (RNRS_SOURCES): Move `rnrs.scm' last. Make `(rnrs base)' independent of other rnrs modules. * module/rnrs/base.scm (define-proxy): New macro. (raise, condition, make-error, make-assertion-violation, make-who-condition, make-message-condition, make-irritants-condition): Use it. 2011-02-20 Andy Wingo update examples in manual to use PKG_CHECK_MODULES * doc/ref/autoconf.texi (Using Autoconf Macros): Switch example to use PKG_CHECK_MODULES. * doc/ref/libguile-linking.texi (A Sample Guile Main Program): Likewise, and change from configure.in to configure.ac, and recommend autoreconf. pkg-config instead of guile-config in manuals * doc/ref/api-options.texi (Build Config): * doc/ref/libguile-linking.texi (Linking Programs With Guile): (A Sample Guile Main Program): * doc/ref/libguile-smobs.texi (The Complete Example): Use pkg-config in the examples instead of guile-config. tour.texi compilation fix * doc/ref/tour.texi (Writing Guile Extensions): Fix compilation example. 2011-02-20 Andy Wingo @value{EFFECTIVE-VERSION} instead of 2.0 in some places in the manual * doc/ref/history.texi (A Timeline of Selected Guile Releases): Update the 2.0 release blurb. * doc/ref/api-foreign.texi (Modules and Extensions): * doc/ref/libguile-extensions.texi (A Sample Guile Extension): * doc/ref/tour.texi (Linking Guile into Programs): Use @value{EFFECTIVE-VERSION} instead of 2.0. Also fix sample extension compilation line to include the Guile CFLAGS. 2011-02-20 Bruno Haible guile.m4: Add support for linking against guile with rpath. * guile.m4 (GUILE_FLAGS): Also set GUILE_LIBS and GUILE_LTLIBS. Fix documentation. 2011-02-19 Neil Jerram Fix typos in (web ...) doc * doc/ref/web.texi (Types and the Web): "help" -> "helpful". (HTTP): Add closing paren. Remove code that looks like a leftover. Last (for a little while) GOOPs doc fix * doc/ref/goops.texi (GOOPS Object Miscellany): Clarify that it would be instances being printed, not classes. 2011-02-18 Neil Jerram Remove unneeded fixme * doc/ref/goops.texi (Class Definition Protocol): Removed `*fixme Need to insert something here about checking that the value is not unbound'. It's a fine detail, and also I imagine there could be a valid application that would choose to allow SCM_GOOPS_UNBOUND values to escape through here. Tidy up remaining bits of the MOP section * doc/ref/goops.texi (Method Definition): Unindent text about define-method invoking add-method!. (Method Definition Internals): Add @noindent's. (Generic Function Invocation): Add intro text, and tidy up the tree. Clean up doc on class redefinition and instance class changing * doc/ref/goops.texi (Class Redefinition): Deleted, with its material all merged into later `Redefining a Class' and `Changing the Class of an Instance' sections. Merge orphan Class Options section into Class Definition * doc/ref/goops.texi (Class Definition): Move material from later `Class Options' section to here. 2011-02-18 Neil Jerram Doc of MOP for instance and class creation * doc/ref/goops.texi (Instance Creation Protocol): Rename from `Customizing Instance Creation', and move before the more complicated class definition stuff. Couple of very minor edits. (Class Definition Protocol): Remove ensure-metaclass-with-supers (too internal) and repeated material. Move class-redefinition stuff to (existing) later section on that. Merge reference-like material from `Customizing Class Definition' to here. 2011-02-18 Neil Jerram Summarize class definition protocol * doc/ref/goops.texi (Class Definition Protocol): Add tree summary diagram. Work on GOOPS MOP documentation * doc/ref/goops.texi (The Metaobject Protocol): Simplify intro text. Minor edits and simplifications throughout this section. (Metaobjects and the Metaobject Protocol): Insert "default". (Metaclasses): Renamed from `Terminology', and deleted the material on CPL and accessors, which just duplicated what has already been covered earlier in the chapter. Remove statements that confuse whether "metaclass of" means "class of class of" or "class of (something that is itself a class)". (I think it's actually the latter.) (Class Definition Protocol): Renamed from `Class Definition Internals'. Rewording for "make an intervention". * doc/ref/compiler.texi (Extending the Compiler): Rephrase first sentence. No sublimated desires * doc/ref/compiler.texi: Delete "subliminated". 2011-02-18 Andy Wingo fix a couple leaks in ports.c. thanks valgrind! * libguile/ports.c (scm_i_remove_port): Fix a case in which ports explictly closed via close-port would leak their iconv_t data. (scm_set_port_encoding_x): scm_i_set_port_encoding_x strdups its argument, so we need to free the locale encoding of the incoming str. core modules use (ice-9 binary-ports) instead of (rnrs io ports) * module/language/assembly/compile-bytecode.scm: * module/language/elisp/lexer.scm: * module/web/request.scm: * module/web/response.scm: * module/web/server.scm: * module/web/uri.scm: Use ice-9 binary-ports. 2011-02-18 Andy Wingo add (ice-9 binary-ports) * module/ice-9/binary-ports.scm: New module. * module/Makefile.am: Add to makefile. * module/rnrs/io/ports.scm: Re-export bindings from (ice-9 binary ports). This will allow the compiler to not pull (rnrs) into its included module set. 2011-02-18 Andy Wingo update extension example in manual * doc/ref/libguile-extensions.texi (A Sample Guile Extension): Fix use of deprecated functions. 2011-02-16 Ludovic Courtès Change tag naming convention to `vX.Y.Z'. * configure.ac: Tell `git-version-gen' that we're switching to a `vX.Y.Z' scheme for release tags. 2011-02-16 Neil Jerram Rewording for "make an intervention". * doc/ref/compiler.texi (Extending the Compiler): Rephrase first sentence. No sublimated desires * doc/ref/compiler.texi: Delete "subliminated". 2011-02-16 Mark H Weaver Improvements to `log' and `log10' * libguile/numbers.c (log_of_shifted_double, log_of_exact_integer, log_of_exact_integer_with_size, log_of_fraction): New internal static functions used by scm_log and scm_log10. (scm_log, scm_log10): Robustly handle large integers, large and small fractions, and fractions close to 1. Previously, computing logarithms of fractions close to 1 yielded grossly inaccurate results, and the other cases yielded infinities even though the answer could easily fit in a double. (log -0.0) now returns -inf.0+i, where previously it returned -inf.0. (log 0) now throws a numerical overflow exception, where previously it returned -inf.0. (log 0.0) still returns -inf.0. Analogous changes made to `log10'. * test-suite/tests/numbers.test (log, log10): Add tests. 2011-02-16 Mark H Weaver Fix comment above number-theoretic division tests * test-suite/tests/numbers.test: Fix comment. 2011-02-16 Mark H Weaver Improvements to `log' and `log10' * libguile/numbers.c (log_of_shifted_double, log_of_exact_integer, log_of_exact_integer_with_size, log_of_fraction): New internal static functions used by scm_log and scm_log10. (scm_log, scm_log10): Robustly handle large integers, large and small fractions, and fractions close to 1. Previously, computing logarithms of fractions close to 1 yielded grossly inaccurate results, and the other cases yielded infinities even though the answer could easily fit in a double. (log -0.0) now returns -inf.0+i, where previously it returned -inf.0. (log 0) now throws a numerical overflow exception, where previously it returned -inf.0. (log 0.0) still returns -inf.0. Analogous changes made to `log10'. * test-suite/tests/numbers.test (log, log10): Add tests. 2011-02-16 Mark H Weaver Fix comment above number-theoretic division tests * test-suite/tests/numbers.test: Fix comment. 2011-02-15 Ludovic Courtès Switch to 2.0.0. * GUILE-VERSION (GUILE_MAJOR_VERSION, GUILE_MINOR_VERSION, GUILE_MINOR_VERSION): 2.0.0! Increment `LIBGUILE_INTERFACE_CURRENT'. * GUILE-VERSION (LIBGUILE_INTERFACE_CURRENT): Set to 22, i.e., Guile 1.8.8 + 1. 2011-02-15 Ludovic Courtès Update `doc/example-smob'. * doc/example-smob/Makefile (CFLAGS, LIBS): Use `pkg-config' instead of `guile-config'. * doc/example-smob/image-type.c (mark_image, free_image): Remove. (init_image_type): Don't call `scm_set_smob_mark' and `scm_set_smob_free'. 2011-02-15 Mark H Weaver Use trunc in scm_i_inexact_truncate_divide * libguile/numbers.c (scm_i_inexact_truncate_divide): Use trunc instead of floor and ceil. Important for consistency with scm_truncate_quotient and scm_truncate_remainder. 2011-02-15 Ludovic Courtès Document `%auto-compilation-options'. * doc/ref/api-evaluation.texi (Compilation): Emphasize auto-compilation. Document `%auto-compilation-options'. Fix compilation of `c-tokenize.c' in a cross-compile setup. * libguile/Makefile.am (c-tokenize.$(OBJEXT)): When cross-compiling, don't include any CPPFLAGS since we could end up seeing Gnulib's replacements, e.g., `rpl_malloc', which we can't use. Use all the LDFLAGS from Gnulib. * libguile/Makefile.am (version_info): New variable. (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): Remove `$(LTLIBUNISTRING) $(LTLIBICONV) $(LTLIBINTL)'. (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Add all the flags from Gnulib, one per line as in the `gnulib-tool' output, including those above. Remove Gnulib's `sockets' module from the import list. * m4/gnulib-cache.m4: Remove `sockets', which we don't directly depend on. 2011-02-15 Ludovic Courtès Import Gnulib's `log1p' and `round' modules. From Gnulib v0.0-4889-ge375fe3. * m4/gnulib-cache.m4: Add `log1p' and `round', requested by Mark H Weaver . Use `malloc-gnu' instead of `malloc', the latter being obsolete. 2011-02-15 Andy Wingo remove 1.9 changes from NEWS (leaving only 2.0) * NEWS: Compress year range (as allowed by standards and note in README). Remove 1.9.15->2.0 changes, leaving only 2.0 changes. 2011-02-15 Mark H Weaver Use trunc instead of scm_c_truncate * libguile/numbers.c (scm_c_truncate, scm_truncate_number, scm_i_inexact_truncate_quotient, scm_i_inexact_truncate_remainder): Use trunc directly, now that we have its gnulib module. Fix minor errors in docs of division operators * doc/ref/api-data.texi (Arithmetic): The R5RS `quotient', `remainder', and `modulo' operators are exact-integer-only operators. `modulo' is equivalent to `floor-remainder', not `floor-quotient'. 2011-02-14 Andy Wingo news tweak * NEWS: Tweak add more NEWS * NEWS: Add new NEWS and fold into main text. fold new NEWS items into main text * NEWS: Fold all items into main text, while keeping a list of things that are new in 1.9.15. update THANKS * THANKS: Update, adding all people who have their name on a patch in Git. Add a section on authors of other free software libraries. tweak to internal scm_i_extract_values_2 * libguile/values.c (scm_i_extract_values_2): Make nvalues check more robust. 2011-02-14 Mark H Weaver Allow GOOPS getters to add methods to primitive generics * module/oop/goops.scm (ensure-generic): If the old definition of a desired getter is a primitive generic, let the new method be added to it instead of creating a fresh new generic. (ensure-accessor): Modify as necessary to keep the old behavior. Maybe something more optimal can be done here, but it's not yet obvious to me how to do it. 2011-02-14 Mark H Weaver Make SCM_NUMP and SCM_NUMBERP more extensible * libguile/numbers.h (SCM_NUMP, SCM_NUMBERP): Mask out more bits in the cell type field when doing the comparison, in order to accept future numeric types that have not yet been implemented. This should allow us to add more core numeric types without breaking ABI compatibility. As a bonus, these macros are now more efficient. Slight optimization for scm_equal_p * libguile/eq.c (scm_equal_p): Move SCM_STRUCTP check within the default case of the SCM_TYP7 switch statement, for optimization. 2011-02-14 Mark H Weaver Reduce code size of division operators * libguile/numbers.c (scm_quotient): Reimplement in terms of scm_truncate_quotient. (scm_remainder): Reimplement in terms of scm_truncate_remainder. (scm_modulo): Reimplement in terms of scm_floor_remainder. (scm_euclidean_quotient, scm_euclidean_remainder, scm_euclidean_divide): Reimplement in terms of floor and ceiling. Make them non-extensible, because there is no need; they will work with any objects that implement the floor and ceiling division operators, and that can be tested using `negative?'. 2011-02-14 Mark H Weaver Optimize truncate, round, floor, and ceiling * libguile/numbers.c (scm_c_truncate): Use ceil (x) instead of -floor (-x). (scm_truncate_number): Implement directly instead of by checking the sign and using scm_floor or scm_ceiling. Use scm_truncate_quotient for fractions. Make extensible, so that new number types implemented in GOOPS will be able to do the job more efficiently, since it is often easier to implement truncate than floor or ceiling. (scm_round_number): Optimize fractions case by using scm_round_quotient. Make extensible, so that new number types implemented in GOOPS will be able to do the job efficiently. (scm_floor, scm_ceiling): Optimize fractions case by using scm_floor_quotient and scm_ceiling_quotient, respectively. * test-suite/tests/numbers.test: Add test cases. 2011-02-14 Mark H Weaver Add four new sets of fast quotient and remainder operators * libguile/numbers.c (scm_floor_divide, scm_floor_quotient, scm_floor_remainder, scm_ceiling_divide, scm_ceiling_quotient, scm_ceiling_remainder, scm_truncate_divide, scm_truncate_quotient, scm_truncate_remainder, scm_round_divide, scm_round_quotient, scm_round_remainder): New extensible procedures `floor/', `floor-quotient', `floor-remainder', `ceiling/', `ceiling-quotient', `ceiling-remainder', `truncate/', `truncate-quotient', `truncate-remainder', `round/', `round-quotient', and `round-remainder'. * libguile/numbers.h: Add function prototypes. * test-suite/tests/numbers.test: Add tests. * doc/ref/api-data.texi (Arithmetic): Add documentation. * NEWS: Add NEWS entry. 2011-02-14 Mark H Weaver Optimize division operators handling of fractions * libguile/numbers.c: (scm_euclidean_quotient, scm_euclidean_remainder, scm_euclidean_divide, scm_centered_quotient, scm_centered_remainder, scm_centered_divide): Optimize case where both arguments are exact and at least one is a fraction, by reducing to a subproblem involving only integers, and then adjusting the resulting remainder as needed. 2011-02-14 Mark H Weaver Make divide functions return values via (SCM *) output arguments * libguile/numbers.c (scm_euclidean_divide, scm_centered_divide): Change API to return two values via output arguments of type (SCM *), instead of packing into a values object. (scm_i_euclidean_divide, scm_i_centered_divide): New internal wrappers that call the above functions and pack the result into a values object. * libguile/numbers.h: Change prototypes to reflect new API. * doc/ref/api-data.h (Arithmetic): Update manual. 2011-02-14 Mark H Weaver Added internal C function to extract from values object * libguile/values.c (scm_i_extract_values_2): New internal function that extracts two values from a values object. * libguile/values.h: Added prototype. 2011-02-14 Andy Wingo update thanks * THANKS: Add Ian Price add vector-move test cases * test-suite/tests/vectors.test ("vector-move-left!") ("vector-move-right!"): Add test cases for recent bug. 2011-02-14 Ian Price fix fencepost error in vector-move-left! and -right! * libguile/vectors.c (scm_vector_move_right_x, scm_vector_move_left_x): Fix edge case. 2011-02-14 Ludovic Courtès Pass all the flags when building `gen-scmconfig' in a cross-compile setup. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling, pass all the CPPFLAGS and CFLAGS. Leave the default `*current-warning-prefix*' at the REPL. * module/system/repl/common.scm (repl-compile): Leave the default `*current-warning-prefix*'. 2011-02-14 Ludovic Courtès Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'. See for details. * lib/unistr.in.h: Change #if's into #ifdef's. 2011-02-14 Ludovic Courtès Update Gnulib; add new modules. This updates Gnulib to v0.0-4889-ge375fe3. * m4/gnulib-cache.m4: Add `accept', `bind', `close', `connect', `getpeername', `getsockname', `getsockopt', `listen', `malloc', `malloca', `recv', `recvfrom', `send', `sendto', `setsockopt', `shutdown', `socket', and `sockets', requested by Jan Nieuwenhuizen for cross-MinGW32 builds. Add `trunc', requested by Mark H Weaver . 2011-02-14 Neil Jerram Thank Ralf * THANKS: Thank Ralf. 2011-02-13 Neil Jerram Typo fix * doc/ref/api-modules.texi (R6RS Libraries): "libraries implementation" -> "library implementation". Procedure/macro index includes Autoconf macros * doc/ref/indices.texi (Procedure Index): Make explicit that the procedure/macro index includes Autoconf macros. 2011-02-13 Neil Jerram Misc textual editing * doc/ref/api-scheduling.texi (Asyncs): "queueing" -> "queuing". * benchmark-suite/lib.scm, doc/sources/unix.texi (Unix conventions), test-suite/lib.scm: "postpend" -> "append". * doc/ref/api-compound.texi (Array Syntax, Dictionary Types), doc/ref/api-control.texi (Catch), doc/ref/api-data.texi (Complex Numbers, Conversion, Random, Symbol Props, Symbol Uninterned), doc/ref/api-options.texi (Build Config, Common Feature Symbols), doc/ref/api-regex.texi (Match Structures), doc/ref/api-undocumented.texi, doc/ref/compiler.texi (Tree-IL, GLIL), doc/ref/data-rep.texi (Immediate objects), doc/ref/goops.texi (Slot Description Example), doc/ref/history.texi (A Scheme of Many Maintainers, Status), doc/ref/libguile-program.texi (Available Functionality), doc/ref/misc-modules.texi (Formatted Output), doc/ref/mod-getopt-long.texi (getopt-long Reference), doc/ref/posix.texi (Network Socket Address, Network Sockets and Communication), doc/ref/srfi-modules.texi (SRFI-1 Association Lists, SRFI-10, SRFI-19 String to date, SRFI-27 Random Sources), doc/ref/vm.texi (Instruction Set, Top-Level Environment Instructions, Procedure Call and Return Instructions), doc/sources/unix.texi (Unix conventions): Correct spacing after "i.e." and "e.g.". 2011-02-13 Neil Jerram Avoid uses of "resp. signed" * doc/ref/api-data.texi (Bytevectors as Integers, Bytevectors and Integer Lists): Split signed and unsigned deffns. Reword intro of `Accessing Arrays from C' * doc/ref/api-compound.texi (Accessing Arrays from C): Reword to avoid awkward "rectangularily organized". 2011-02-13 Ralf Wildenhues docs: fix typos in manual, and a couple in code comments. * doc/ref/api-data.texi: Use \sqrt{2} consistently rather than \sqrt2. Add @: for correct spacing after "i.e.". docs: fix markup in api-options.texi. * doc/ref/api-options.texi (Build Config): Use @var for metasyntactic variable. Add newline after @noindent. Use @env for GUILE_LOAD_PATH. 2011-02-13 Noah Lavine Set sockaddr_in.sin_len field when it exists. * configure.ac: Detect when struct sockaddr_in has a sin_len field. Remove obsolete comment. * libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Set the sin_len field in our struct sockaddr_in when it exists. 2011-02-13 Andy Wingo bump objcode version to 2.0; introduce minor-version compatibility * libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump to 2. (SCM_OBJCODE_MINOR_VERSION): Reset to 0. (SCM_OBJCODE_MACHINE_VERSION_STRING, SCM_OBJCODE_COOKIE): Reorder so the minor version is the last byte. * libguile/objcodes.c (make_objcode_by_mmap): Accept objcodes whose minor version is less than SCM_OBJCODE_MINOR_VERSION, not just equal to. 2011-02-13 Noah Lavine zero newly allocated sockaddrs * libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Zero the sockaddrs, so we do not pass uninitialized memory to the kernel. 2011-02-13 Ludovic Courtès Add `%auto-compilation-options', used by `compile-file' when auto-compiling. * module/ice-9/boot-9.scm (%auto-compilation-options): New variable. (load-in-vicinity): Honor it. * libguile/load.c (kw_opts, sym_compile_file, sym_auto_compilation_options): New variables. (do_try_auto_compile): Honor %AUTO-COMPILATION-OPTIONS. * module/system/repl/common.scm (repl-default-options): Have `compile-options' default to %AUTO-COMPILATION-OPTIONS. 2011-02-13 Ludovic Courtès Add `*current-warning-prefix*'. * module/system/base/message.scm (*current-warning-prefix*): New variable. (%warning-types): Honor `*current-warning-prefix*'. * module/scripts/compile.scm (compile): Use an empty `*current-warning-prefix*'. * module/system/repl/common.scm (repl-compile): Likewise. * test-suite/tests/tree-il.test (call-with-warnings): Likewise. 2011-02-13 Andy Wingo primitive-load defaults to utf-8, not latin-1 * libguile/load.c (scm_primitive_load): Default to utf-8. 2011-02-13 Ludovic Courtès Have `the-scm-module' be its own public interface (bug #30623). * module/ice-9/boot-9.scm (the-scm-module): Make it its own public interface. * test-suite/tests/modules.test ("foundations")["the-root-module", "the-scm-module"]: New tests. 2011-02-13 Andy Wingo autocompile -> auto-compile * NEWS: * check-guile.in: * doc/guile.1: * doc/ref/scheme-scripts.texi: * libguile/init.c: * libguile/load.c: * libguile/load.h: * libguile/script.c: * module/Makefile.am: * module/ice-9/boot-9.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * test-suite/Makefile.am: * test-suite/tests/popen.test: Change "autocompile" to "auto-compile" or "auto_compile", as appropriate, in variable names, function names, command line arguments, and the documentation. `load' is a macro (!) that resolves paths relative to source file dir * module/ice-9/boot-9.scm (load-in-vicinity): New helper, loads a file relative to a path. (load): Turn into a macro that captures the name of the source file being expanded, and dispatches to load-in-vicinity. Referencing `load' by bare name returns a closure that embeds the current source file name. 2011-02-13 Andy Wingo read-enable 'positions by default * libguile/read.c (scm_read_opts): Default "positions" to #t. The compiler was already turning it on anyway, and this allows primitive-load without --auto-compile to also propagate source information through the expander, for better errors and to let macros know their source. * module/language/scheme/spec.scm: No need to enable positions here now. 2011-02-13 Andy Wingo use scm_c_make_struct in scm_values * libguile/values.c (scm_values): Micro-optimization. 2011-02-13 Ludovic Courtès Add `scm_t_subr' typedef (fix bug #23681). * libguile/__scm.h (scm_t_subr): New typedef. * libguile/deprecated.h (scm_make_gsubr, scm_make_gsubr_with_generic, scm_call_catching_errors): Use it. * libguile/gsubr.h (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_define_gsubr_with_generic): Likewise. * libguile/smob.h (scm_smob_descriptor)[apply]: Likewise. (scm_set_smob_apply): Likewise. * libguile/snarf.h (SCM_FUNC_CAST_ARBITRARY_ARGS): Likewise. 2011-02-13 Ludovic Courtès Change `scm_ramapc' prototype to avoid empty declarators (bug #23681). * libguile/array-map.h (scm_ramapc): Change `cproc' to `void *' instead of using empty declarators. * libguile/array-map.c (scm_ramapc): Adjust accordingly. 2011-02-13 Ludovic Courtès Fix prototype of `scm_the_vm'. * libguile/vm.h (scm_the_vm): Use `(void)' instead of `()'. 2011-02-12 Andy Wingo fix syntax-error printing * module/ice-9/boot-9.scm: Fix to make "extra" a rest arg. fix scm-error invocation on SIGINT in top-repl.scm * module/ice-9/top-repl.scm (call-with-sigint): Pass '() as the format args when invoking scm-error, to ensure that the error is printable. 2011-02-12 Mark H Weaver Fixes and improvements to number-theoretic division operators * libguile/numbers.c (scm_euclidean_quotient, scm_euclidean_divide, scm_centered_quotient, scm_centered_divide): Fix bug in inum/inum case, where (quotient most-negative-fixnum -1) would not be converted to a bignum. (scm_euclidean_quotient): Be more anal-retentive about calling scm_remember_upto_here_1 after mpz_sgn, (even though mpz_sgn is documented as being implemented as a macro and certainly won't do any allocation). It's better to be safe than sorry here. (scm_euclidean_quotient, scm_centered_quotient): In the bignum/inum case, check if the divisor is 1, since this will allow us to avoid allocating a new bignum. (scm_euclidean_divide, scm_centered_quotient, scm_centered_divide): When computing the intermediate truncated quotient (xx / yy) and remainder, use (xx % yy) instead of (xx - qq * yy), on the theory that the compiler is more likely to handle this case intelligently and maybe combine the operations. (scm_euclidean_divide): In the bignum/inum case, we know that the remainder will fit in an fixnum, so don't bother allocating a bignum for it. (scm_euclidean_quotient, scm_euclidean_remainder, scm_euclidean_divide, scm_centered_quotient, scm_centered_remainder, scm_centered_divide): Minor stylistic changes. * test-suite/tests/numbers.test: Rework testing framework for number-theoretic division operators to be more efficient and comprehensive in its testing of code paths and problem cases. 2011-02-12 Mark H Weaver Add comment about handling of exactness specifiers * libguile/numbers.c: Add discussion on the handling of exactness specifiers to the comment above the string-to-number conversion functions. Fix extensibility of 1-argument atan * libguile/numbers.c (scm_atan): Call SCM_WTA_DISPATCH_1 instead of SCM_WTA_DISPATCH_2 if the second argument is unbound. Arguably, SCM_WTA_DISPATCH_* should handle that case gracefully, but currently it doesn't. Fix mistake in comment in tags.h * libguile/tags.h: Fix comment in discussion of data representation. tc3-code #0b110 indicates a small integer and #0b100 indicates a non-integer immediate. Previously, these were reversed. Bump copyright date in REPL version string * module/system/repl/common.scm (*version*): Add 2011 to copyright date range. 2011-02-12 Ludovic Courtès Make sure we don't override the user's extension search path. * libguile/dynl.c (augment_env): New function. (sysdep_dynl_init): Use it instead of `lt_dladdsearchdir'. * configure.ac: Define `SHARED_LIBRARY_PATH_VARIABLE'. 2011-02-12 Ralf Wildenhues Save config.cache before tests which are likely to fail. Guile's configure script takes fairly long. On a system without automatic build dependency installation, it is amplified by the fact that your user might be both impatient and not read the build instructions, thus needs to rerun configure several times only to find out there is another dependency to install. Still, there is help even for such kinds of misguided figures such as me: save the temporary config.cache file (if one is used anyway) before embarking upon the set of tests that are likely to error out. That way, the second and further reruns are much faster. The downside of this patch is that, when fixing the errors requires changing to precious variables (such as CPPFLAGS or so), the user will need to 'rm -f config.cache' to keep configure happy. * configure.ac: Call AC_CACHE_SAVE before the gmp tests. 2011-02-11 Andreas Rottmann install r6rs exception printer * module/rnrs/exceptions.scm: Install an exception printer for R6RS exceptions. 2011-02-11 Andy Wingo better narrowing in catch-all handlers in throw.c * libguile/throw.c (handler_message): Narrow away the catch-closure and throw frames. 2011-02-11 Andy Wingo pre-boot lookup of print-exception works * libguile/backtrace.c (scm_print_exception): Use scm_module_variable to look up print-exception so that it works before boot-9 is loaded. * libguile/throw.c (CACHE_VAR): Tweak to use scm_from_latin1_symbol. 2011-02-11 Andy Wingo scm_handle_by_message uses scm_print_exception * libguile/throw.c (handler_message, should_print_backtrace): Use scm_print_exception. Add a helper function to determine when to print a backtrace; don't do so on read or syntax errors. scm_display_error_message, display-error use print-exception * libguile/backtrace.c (scm_display_error_message) (scm_i_display_error): Use scm_print_exception. 2011-02-11 Andy Wingo print-exception gets a c binding * libguile/backtrace.c (scm_print_exception): Add C binding for print-exception, which dispatches to whatever is defined in Scheme. (boot_print_exception): Add initial binding, replaced later in Scheme. * module/ice-9/boot-9.scm: Expect there to already be a print-exception binding. 2011-02-11 Andy Wingo repl.scm: use print-exception * module/system/repl/repl.scm: Remove custom exception printers in favor of print-exception. (system repl error-handling) uses print-exception * module/system/repl/error-handling.scm (error-string): Just use print-exception instead of rolling our own printer. (call-with-error-handling): Simplify. add set-exception-printer!, print-exception to boot-9 * module/ice-9/boot-9.scm (set-exception-printer!, print-exception): Define an extensible exception-printing mechanism. Also register printers for all keys thrown by Guile. Inspired by a patch by Andreas Rottmann. 2011-02-11 Andy Wingo frame-source available in default environment * libguile/frames.c (scm_frame_source): Don't call out to (system vm frames), as this routine is used when printing exceptions. Make available in the default environment (ugh). * module/system/vm/frame.scm: Remove frame-source definition and export. 2011-02-10 Andy Wingo deprecate primitive properties * libguile.h: * libguile/Makefile.am: * libguile/deprecated.h: * libguile/deprecated.c: * libguile/init.c: * libguile/properties.c: * libguile/properties.h: Deprecate the "primitive properties" interface. It was only used to implement object properties, and that is no longer the case. * module/ice-9/boot-9.scm (make-object-property): Reimplement just in terms of weak hash tables, and make threadsafe. * NEWS: * doc/ref/api-utility.texi: Update. 2011-02-10 Andy Wingo ports.c safely accesses the port weak hash table * libguile/ports.h (scm_i_remove_port): Remove declaration, as it was SCM_INTERNAL. * libguile/ports.c (scm_add_to_port_table): Issue a deprecation warning if this function is called. Remove needless SCM_API declaration, it was already declared as such in ports.h. Safely access the port table. (scm_i_remove_port): Remove bogus comment about lack of need for threadsafety. Take the port table mutex. (scm_close_port): No need to take port table mutex around calling scm_i_remove_port. pre-deprecate scm_ptobs * libguile/ports.h (scm_t_ptob_descriptor): Add comment about impending ptob deprecation. fix potential concurrency bugs in port-for-each * libguile/ports.c (scm_c_port_for_each): Simplify to avoid concurrency- and gc-related bugs. comment on scm_pre_modules_obarray re threadsafety * libguile/modules.c (scm_pre_modules_obarray): Add comment to the effect that this global variable does not need a lock around it. instructions.c: threadsafe static var * libguile/instructions.c (fetch_instruction_table): Lock access to the static, lazily-generated table. make static hash table access thread-safe in foreign.c * libguile/foreign.c (register_weak_reference): Wrap static hash table access in a mutex. fix potential deadlock in issue-deprecation-warning * libguile/deprecation.c (scm_c_issue_deprecation_warning): Avoid printing to a Scheme port while in a mutex. 2011-02-10 Ludovic Courtès "latin1" -> "Latin-1". Reported by Ralf Wildenhues. * doc/ref/vm.texi (Loading Instructions): Use "Latin-1", not "latin1". 2011-02-10 Ludovic Courtès Add `scm_i_set_default_port_encoding' and `scm_i_default_port_encoding'. * libguile/ports.c (scm_i_set_default_port_encoding, scm_i_default_port_encoding): New function. Replace `scm_i_set_port_encoding_x' and `scm_i_get_port_encoding' with PORT == SCM_BOOL_F. (scm_i_set_port_encoding_x): Assume PORT is a port. (scm_i_get_port_encoding): Remove. (scm_port_encoding): Adjust accordingly. (scm_new_port_table_entry): Use `scm_i_default_port_encoding'. * libguile/ports.h (scm_i_get_port_encoding): Remove declarations. (scm_i_default_port_encoding, scm_i_set_default_port_encoding): New declarations. * libguile/posix.c (setlocale): Use `scm_i_set_default_port_encoding'. 2011-02-10 Ludovic Courtès Simplify `scm_i_set_port_encoding_x'. * libguile/ports.c (find_valid_encoding): Remove. (scm_i_set_port_encoding_x): Remove call to `find_valid_encoding'. Remove `valid_enc'. Rename `enc' to `encoding'. * test-suite/tests/ports.test ("port-encoding"): New test prefix. 2011-02-10 Ludovic Courtès Add `read-delimited' tests. * test-suite/tests/rdelim.test ("read-delimited", "read-delimited!"): New test prefixes. 2011-02-10 Andy Wingo getopt-long: arg parsing errors cause print and exit, not backtrace * module/ice-9/getopt-long.scm (fatal-error): New helper. For errors that come from the user -- i.e., not the grammar -- we will handle our own error printing and call `exit' rather than relying on the root catch handler. This is more friendly to the user than a Scheme backtrace. (parse-option-spec, process-options, getopt-long): Call `fatal-error' as appropriate. * test-suite/tests/getopt-long.test (pass-if-fatal-exception): New helper, checks that a certain key was thrown to, and that suitable output has been printed on an error port. (deferr): Change to expect a 'quit key instead of 'misc-error. Update exceptions to not match the beginning of the string, as that will be the program name. Update tests to use pass-if-fatal-exception. 2011-02-10 Andy Wingo getopt-long cleanups * module/ice-9/getopt-long.scm (process-options): Use `match' in the loop. Clean up `eat' to not take the option being processed. getopt-long cleanup * module/ice-9/getopt-long.scm (process-options): Use more internal definitions instead of let-bound functions to decrease the nesting depth. getopt-long cleanup * module/ice-9/getopt-long.scm (looks-like-an-option): Remove obtuse use of "some". getopt-long uses match:substring from (ice-9 regex) * module/ice-9/getopt-long.scm: Import (ice-9 regex), and use its match:substring instead of our own. match-lambda in getopt-long * module/ice-9/getopt-long.scm (parse-option-spec): Use match-lambda to parse the grammar. getopt-long uses srfi-9 records internally * module/ice-9/getopt-long.scm: #:keywords in the define-module block. (option-spec): Define as a srfi-9 record instead of playing macro games with boot-9 records. volatile locals in bootstrap evaluator * libguile/eval.c (eval): For SCM_M_PROMPT, mark the locals needed after a longjmp as volatile. Perhaps related to bug 32340. 2011-02-09 Andy Wingo more robust fallback error printer * libguile/throw.c (pre_init_throw): Deal with errors printing the exception. 2011-02-09 Ralf Wildenhues docs: add missing parentheses in asin formula. * doc/r5rs/r5rs.texi (Numerical operations): Add parentheses around argument to sqrt. docs: fix markup in api-options.texi. * doc/ref/api-options.texi (Build Config): Use @env for GUILE_LOAD_PATH. fix typos in the manual bits generated from source comments. * libguile/bitvectors.c, libguile/chars.c, libguile/deprecated.c, libguile/numbers.c, libguile/random.c, libguile/read.c, libguile/root.c, libguile/srfi-1.c, libguile/srfi-13.c, libguile/srfi-14.c, libguile/uniform.c: Fix typos, add missing newlines. docs: fix typos in manual, and a couple in code comments. * doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-debug.texi, doc/ref/api-io.texi, doc/ref/api-macros.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-undocumented.texi, doc/ref/api-utility.texi, doc/ref/compiler.texi, doc/ref/goops.texi, doc/ref/libguile-concepts.texi, doc/ref/misc-modules.texi, doc/ref/posix.texi, doc/ref/r6rs.texi, doc/ref/slib.texi, doc/ref/srfi-modules.texi, doc/ref/sxml-match.texi, doc/ref/tools.texi, doc/ref/vm.texi, doc/ref/web.texi, doc/sources/env.texi, doc/sources/jimb-org.texi, doc/sources/scheme-concepts.texi, doc/sources/unix.texi, module/ice-9/optargs.scm: Fix typos. * doc/r4rs/r5rs.texi: Likewise. Do not capitalize code symbols even at the start of a sentence. * doc/ref/api-data.texi: Likewise. Also, remove executable bit. 2011-02-09 Andy Wingo abort on pre-boot throw without catch * libguile/throw.c (pre_init_throw): Abort instead of exit in the error case. Print out a message. 2011-02-09 Andy Wingo fix a couple of (system vm frame) accesses on boot errors * libguile/backtrace.c (display_error_body): Don't look up the frame-source if Guile isn't initialized yet. Fixes display-error before boot has finished. * libguile/throw.c (handler_message): Likewise, don't backtrace before boot has finished, because we can't load (system vm frame). 2011-02-09 Andy Wingo fix recursive throws if an error occurs at boot-time * libguile/throw.c (find_pre_init_catch): New internal helper. (pre_init_throw): If we don't find a catch, print out a message and abort. (scm_init_throw): Declare pre-init-throw as taking at least one arg. remove dead code in init.c * libguile/init.c: Remove some dead code. 2011-02-09 Ralf Wildenhues docs: remove non-ASCII space from docs. * doc/ref/api-compound.texi (Vector Accessing from C): Replace 0xa0 character with space. 2011-02-09 Andy Wingo readline uses define-once * guile-readline/ice-9/readline.scm: Use define-once. 2011-02-09 Andy Wingo add define-once * module/ice-9/boot-9.scm (define-once): New syntax. * doc/ref/api-binding.texi (Top Level): * NEWS: Add notes about define-once. 2011-02-09 Ludovic Courtès Improve type checking when invoking foreign functions. * libguile/foreign.c (unpack): Make sure X is a pointer before using `SCM_POINTER_VALUE'. * test-suite/tests/foreign.test ("pointer->procedure"): New test prefix. 2011-02-08 Andy Wingo uninstalled-env ordering tweaks to fix readline's file name * meta/uninstalled-env.in (subdirs_with_ltlibs): Remove "srfi". Reorder the load-path and load-compiled-path to put the root dir after guile-readline, so that relative canonicalization computes the correct path for ice-9/readline.scm. module-use-interfaces! handles duplicate interfaces * module/ice-9/boot-9.scm (module-use-interfaces!): Fix to have the same interface de-duplication characteristics as module-use!. remove readline-activator.scm * guile-readline/readline-activator.scm: Remove this file that was deprecated in Guile 1.4. 2011-02-08 Ludovic Courtès Make `(format #f ...)' always Unicode-capable. * module/ice-9/format.scm (format): When DESTINATION is #f, use a Unicode-capable output string port. * test-suite/tests/format.test ("format basic output")["default to Unicode-capable port"]: New test. 2011-02-08 Andy Wingo fix scm_procedure on non-structs * libguile/procs.c (scm_procedure): Fix argument type check. 2011-02-08 Ludovic Courtès Have `define-wrapped-pointer-type' take a type name. * module/system/foreign.scm (define-wrapped-pointer-type): Add a `type-name' argument instead of non-hygienically generating one. * test-suite/tests/foreign.test (foo): Update. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update accordingly. 2011-02-08 Andy Wingo fix quasiquote test * test-suite/tests/syntax.test ("quasiquote"): Fix unquote-splicing extra args test to update for current behavior. hackily fix another case where display-exception would be apropos * module/system/repl/error-handling.scm (display-syntax-error) (error-string): Until we get the exception-printing patch merged in, copy display-syntax-error into error-handling so that we avoid display-error. Fixes bug 32365. 2011-02-08 Andy Wingo unquote and unquote-splicing can split multiple expressions * module/ice-9/psyntax.scm (quasiquote): Import new definition from upstream psyntax, to allow unquote and unquote-splicing to take multiple arguments. (unquote, unquote-splicing): Adapt to not require a particular syntax form. * module/ice-9/psyntax-pp.scm: Regenerated. 2011-02-07 Ludovic Courtès Hack around a defect in `define-wrapped-pointer-type'. * module/system/foreign.scm (define-wrapped-pointer-type): Choose TYPE-NAME deterministically. 2011-02-07 Ludovic Courtès Add tests for `memq' and `memv'. This is a follow-up to a75ea6589642270adf933b85a15d96a74ff59225 ("fix memq/memv inlining"). * test-suite/tests/list.test ("memq", "memv"): New test prefixes. 2011-02-07 Andy Wingo fix memq/memv inlining * module/language/tree-il/inline.scm (boolean-value): Add a case for applications of primitives, and move the memq/memv->bool code here. (inline!): We were inlining (memq 'a '(a b c)) => #t, and not the list tail, which was an embarrassing bug. Fixed by moving this code to the boolean-value function. Thanks to Mark Harig for the report. hack around bug in port-filename * module/ice-9/boot-9.scm (define-module): Until the port-filename bug is fixed, hack around it. 2011-02-03 Mark H Weaver Improved exactness handling for complex number parsing When parsing non-real complex numbers, apply exactness specifiers on per-component basis, as is done in PLT Scheme. For complex numbers written in rectangular form, exactness specifiers are applied to the real and imaginary parts before calling scm_make_rectangular. For complex numbers written in polar form, exactness specifiers are applied to the magnitude and angle before calling scm_make_polar. There are two kinds of exactness specifiers: forced and implicit. A forced exactness specifier is a "#e" or "#i" prefix at the beginning of the entire number, and applies to both components of a complex number. "#e" causes each component to be made exact, and "#i" causes each component to be made inexact. If no forced exactness specifier is present, then the exactness of each component is determined independently by the presence or absence of a decimal point or hash mark within that component. If a decimal point or hash mark is present, the component is made inexact, otherwise it is made exact. After the exactness specifiers have been applied to each component, they are passed to either scm_make_rectangular or scm_make_polar to produce the final result. Note that this will result in a real number if the imaginary part, magnitude, or angle is an exact 0. Previously, both forced and implicit exactness specifiers applied to the number as a whole _after_ calling scm_make_rectangular or scm_make_polar. For example, (string->number "#i5.0+0i") now does the equivalent of: (make-rectangular (exact->inexact 5.0) (exact->inexact 0)) which yields 5.0+0.0i. Previously it did the equivalent of: (exact->inexact (make-rectangular 5.0 0)) which yielded 5.0. * libguile/numbers.c (mem2ureal): Receive a forced exactness specifier (forced_x), create and maintain our own implicit exactness specifier flag local to this component (implicit_x), and apply these exactness specifiers within this function. Previously, we received a pointer to an implicit exactness specifier flag from above, and the exactness specifiers were applied from within scm_i_string_length. (mem2complex): Receive a forced exactness specifier parameter and pass it down to mem2ureal. Previously, we passed down a pointer to an implicit exactness specifier flag instead. (scm_i_string_to_number): No longer create an implicit exactness specifier flag here, and do not apply exactness specifiers here. All we do here now regarding exactness is to parse the "#e" or "#i" prefix (if any) and pass this information down to mem2ureal via mem2complex in the form of an explicit exactness specifier (forced_x). (scm_c_make_polar): If the cosine and sine of the angle are both NaNs and the magnitude is zero, return 0.0+0.0i instead of +nan.0+nan.0i. This case happens when the angle is not finite. * test-suite/tests/numbers.test (string->number): Move the test cases for non-real complex numbers into a separate table in which the expected real and imaginary parts are separate entries. Add several new test cases. 2011-02-03 Mark H Weaver Fix non-portable usage of `isinf' in `max' and `min' * numbers.c: Add new macros DOUBLE_IS_POSITIVE_INFINITY and DOUBLE_IS_NEGATIVE_INFINITY. (scm_max, scm_min): Use the new macros to detect particular infinities. Previously we checked the return value of `isinf' to determine the sign of the infinity, but that is not portable. 2011-02-02 Ludovic Courtès Bump version number for 1.9.15. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Fix `GUILE_THREAD_LOCAL_STORAGE'. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Fix M4 quotation. Enclose SRFI-13 deprecation handling in `#if SCM_ENABLE_DEPRECATED == 1'. * libguile/srfi-13.c (scm_string_filter, scm_string_delete): Enclose deprecated call convention handling in `#if SCM_ENABLE_DEPRECATED == 1'. 2011-02-02 Andy Wingo fix srfi-13 test argument orders * test-suite/tests/srfi-13.test ("string-filter", "string-delete"): Fix argument order in tests. 2011-02-02 Mark H Weaver Support non-real complex numbers with inexact zero imaginary part Add the ability to represent non-real complex numbers whose imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS. Previously, such numbers were immediately changed into inexact reals. * libguile/numbers.c: Remove from the list of `General assumptions' in numbers.c that objects satisfying SCM_COMPLEXP() have a non-zero complex component. This is no longer true. Also add a warning about another unrelated assumption that is not entirely correct (that floor(r) == r implies that mpz_set_d will DTRT; it won't if r is infinite). (icmplx2str): Always print the imaginary part, even if it is zero. Also handle a negative zero imaginary part more gracefully. It now prints 0.0-0.0i, where previously it would print 0.0+-0.0i. (mem2ureal): Replace scm_from_double (0.0) with flo0. (scm_c_make_rectangular): Always create non-real complex numbers. Previously it would create inexact reals if the specified imaginary part was zero. (scm_make_rectangular): If the imaginary part is an _exact_ 0, return the real part unchanged (possibly exact), otherwise return a non-real complex number (possibly with an inexact zero imaginary part). Previously, it would return an inexact real number whenever the imaginary part was any kind of zero. (scm_make_polar): If the magnitude is an exact 0, return an exact 0. If the angle is an exact 0, return the magnitude unchanged (possibly exact). Otherwise return a non-real complex number (possibly with an inexact zero imaginary part). Previously, it would return a real number whenever the imaginary part was any kind of zero. (scm_imag_part): Return an exact 0 if applied to a real number. Previously it would return an inexact zero if applied to an inexact real number. (scm_inexact_to_exact): Accept complex numbers with inexact zero imaginary part. In that case, simply use the real part and ignore the imaginary part. Essentially we coerce the inexact zero imaginary part to an exact 0. * test-suite/tests/numbers.test: Add many test cases, and modify existing tests as needed to reflect these changes. Also add a new internal predicate: `almost-real-nan?' which tests for a non-real complex number with zero imaginary part whose real part is a NaN. * doc/ref/api-data.texi (Complex Numbers): Update description of complex numbers to reflect these changes: non-real complex numbers in Guile need not have non-zero imaginary part. Also, each part of a complex number may be any inexact real, not just rationals as was previously stated. Explicitly mention that each part may be an infinity, a NaN, or a signed zero. (Complex Number Operations): Change the formal parameter names of `make-polar' from `x' and `y' to `mag' and `ang'. * NEWS: Add news entries. 2011-02-02 Mark H Weaver Improve handling of signed zeroes * libguile/numbers.c (scm_abs): (abs -0.0) now returns 0.0. Previously it returned -0.0. Also move the REALP case above the BIGP case, and consider it SCM_LIKELY to be REALP if not INUMP. (scm_difference): (- 0 0.0) now returns -0.0. Previously it returned 0.0. Also make sure that (- 0 0.0+0.0i) will return -0.0-0.0i. * test-suite/tests/numbers.test (abs, -): Add test cases, and change some tests to use `eqv?' instead of `=', in order to test exactness and distinguish signed zeroes. 2011-02-02 Mark H Weaver Trigonometric functions return exact numbers in some cases * libguile/numbers.c (scm_sin, scm_cos, scm_tan, scm_asin, scm_acos, scm_atan, scm_sinh, scm_cosh, scm_tanh, scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): Return an exact result in some cases. * test-suite/tests/numbers.test: Add test cases. * NEWS: Add NEWS entry 2011-02-02 Mark H Weaver Fix `min' and `max' handling of NaNs, infinities, and signed zeroes * libguile/numbers.c (scm_min, scm_max): Properly order the real infinities and NaNs, per R6RS, and also take care to handle signed zeroes properly. Note that this ordering is different than that of `<', `>', `<=', and `>=', which return #f if any argument is a real NaN, and consider the real zeroes to be equal. The relevant real infinity (-inf.0 for min, +inf.0 for max) beats everything, including NaNs, and NaNs beat everything else. Previously these were handled improperly in some cases, e.g.: (min 1/2 +nan.0) now returns +nan.0 (previously returned 0.5), (max 1/2 +nan.0) now returns +nan.0 (previously returned 0.5), (min -inf.0 +nan.0) now returns -inf.0 (previously returned +nan.0), (max +inf.0 +nan.0) now returns +inf.0 (previously returned +nan.0), (min -0.0 0.0) now returns -0.0 (previously returned 0.0), (max 0.0 -0.0) now returns 0.0 (previously returned -0.0), (max 0 -0.0) now returns 0.0 (previously returned -0.0), (max -0.0 0 ) now returns 0.0 (previously returned -0.0). * test-suite/tests/numbers.test (min, max): Add many more test cases relating to NaNs, infinities, and signed zeroes. Change most existing test cases to use `eqv?' instead of `=', in order to check exactness. 2011-02-02 Noah Lavine macro documentation fixup * doc/ref/api-macros.texi: make the difference between pattern variables and lexical variables a bit clearer. 2011-02-02 Ludovic Courtès Disable use of thread-local storage on FreeBSD. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Explicitly require `AC_CANONICAL_HOST'. Disable on FreeBSD. Update `NEWS'. * NEWS: Update. 2011-02-02 Ludovic Courtès R6RS: Have `put-char', `put-string', etc. raise an `&i/o-encoding-error'. * module/rnrs/io/ports.scm (&i/o-encoding): New error condition type. (with-i/o-encoding-error): New macro. (put-char, put-datum, put-string): Use it. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port, output [error handling mode = raise]"]: New test. 2011-02-02 Ludovic Courtès Change `scm_encoding_error' to pass the port and faulty character. * libguile/strings.c (scm_encoding_error): Remove the `from', `to', and `string_or_bv' parameters; add `port' and `chr'. (scm_to_stringn): Update accordingly. * libguile/strings.h (scm_encoding_error): Update accordingly. * libguile/ports.c (scm_ungetc): Update accordingly. * libguile/print.c (iprin1, scm_write_char): Update accordingly. * test-suite/tests/encoding-escapes.test ("display output errors")["ultima", "Rashomon"]: Check the arguments of `encoding-error'. ["tekniko"]: New test. * test-suite/tests/ports.test ("string ports")["wrong encoding"]: Adjust to new `encoding-error' arguments. 2011-02-02 Ludovic Courtès Upon port encoding error, always write as much as possible. * libguile/print.c (display_string): Upon error, always write the OUTPUT_LEN bytes of output, regardless of the conversion strategy. 2011-02-02 Ludovic Courtès R6RS: Have `get-char', `get-line', etc. raise an `&i/o-decoding-error'. * module/rnrs/io/ports.scm (&i/o-decoding): New error condition type. (with-i/o-decoding-error): New macro. (get-char, get-datum, get-line, get-string-all, lookahead-char): Use it. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Use `guard' and `i/o-decoding-error?'. 2011-02-02 Ludovic Courtès Avoid circular dependency between (rnrs base) and (rnrs exceptions). * module/rnrs/base.scm (raise): Define as a macro instead of a procedure. 2011-02-02 Ludovic Courtès Have `read-char' & co. throw to `decoding-error'. * libguile/ports.c (scm_read_char): Mention `decoding-error' in the docstring. (get_codepoint): Change to return an error code; add `codepoint' output parameter. Don't raise an error from here. (scm_getc): Raise an error with `scm_decoding_error' if `get_codepoint' returns an error. (scm_peek_char): Likewise. Update docstring. * libguile/strings.c (scm_decoding_error_key): New variable. (scm_decoding_error): New function. (scm_from_stringn): Use `scm_decoding_error' instead of `scm_encoding_error'. * libguile/strings.h (scm_decoding_error): New declaration. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error"]: Change to expect `decoding-error'. Make sure PORT points past the error. ["read-char, wrong encoding, escape"]: Likewise. ["peek-char, wrong encoding, error"]: New test. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Change to expect `decoding-error'. ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Likewise. * test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding error, substitute"]: New tests. * doc/ref/api-io.texi (Reading): Update documentation of `read-char' and `peek-char'. (Line/Delimited): Update documentation of `read-line'. 2011-02-02 Ludovic Courtès Use `#ifdef HAVE_...', not `#if'. * test-suite/standalone/test-round.c (test_scm_c_round): Use `#ifdef HAVE_FESETROUND', not `#if'. Fix typo. * libguile/srfi-1.c (scm_srfi1_concatenate_x): Fix `FUNC_NAME'. 2011-02-02 Michael Gran Use 'substring' instead of obsoleted 'make-shared-substring' * module/system/repl/describe.scm (display-description): replace make-shared-substring with substring 2011-02-01 Andreas Rottmann Fix `show' REPL meta-command * module/system/repl/command.scm (warranty, copying, version): Use `define-meta-command' to define these procedures, so they are entered into the *command-infos* table. 2011-02-01 Mark H Weaver Improve discussion of exactness propagation in manual * doc/ref/api-data.texi (Exact and Inexact Numbers): Improve the discussion of exactness propagation. Mention that there are exceptions to the rule that calculations involving inexact numbers must product an inexact result. Move comment about trig functions back where it belongs * libguile/numbers.c: Move a comment about the trigonometric functions next to those functions. At some point they became separated, when scm_expt was placed between them. 2011-02-01 Mark H Weaver Handle products with exact 0 differently * libguile/numbers.c (scm_product): Handle exact 0 differently. A product containing an exact 0 now returns an exact 0 if and only if the other arguments are all exact. An inexact zero is returned if and only if the other arguments are all finite but not all exact. If an infinite or NaN value is present, a NaN value is returned. Previously, any product containing an exact 0 yielded an exact 0, regardless of the other arguments. A note on the rationale for (* 0 0.0) returning 0.0 and not exact 0: The exactness propagation rules allow us to return an exact result in the presence of inexact arguments only if the values of the inexact arguments do not affect the result. In this case, the value of the inexact argument _does_ affect the result, because an infinite or NaN value causes the result to be a NaN. A note on the rationale for (* 0 +inf.0) being a NaN and not exact 0: The R6RS requires that (/ 0 0.0) return a NaN value, and that (/ 0.0) return +inf.0. We would like (/ x y) to be the same as (* x (/ y)), and in particular, for (/ 0 0.0) to be the same as (* 0 (/ 0.0)), which reduces to (* 0 +inf.0). Therefore (* 0 +inf.0) should return a NaN. * test-suite/tests/numbers.test: Add many multiplication tests. * NEWS: Add NEWS entry. 2011-02-01 Mark H Weaver More discriminating NaN predicates for numbers.test * test-suite/tests/numbers.test: (real-nan?, complex-nan?, imaginary-nan?): Add more discriminating NaN testing predicates internal to numbers.test, and convert several uses of `nan?' to use these instead: * `real-nan?' checks that its argument is real and a NaN. * `complex-nan?' checks that both the real and imaginary parts of its argument are NaNs. * `imaginary-nan?' checks that its argument's real part is zero and the imaginary part is a NaN. 2011-02-01 Mark H Weaver Fix bugs in `rationalize' * libguile/numbers.c (scm_rationalize): Fix bugs. Previously, it returned exact integers unmodified, although that was incorrect if the epsilon was at least 1 or inexact, e.g. (rationalize 4 1) should return 3 per R5RS and R6RS, but previously it returned 4. Also handle cases involving infinities and NaNs properly, per R6RS. * test-suite/tests/numbers.test: Add test cases for `rationalize'. * NEWS: Add NEWS entry 2011-02-01 Mark H Weaver Fix and combine NEWS entries on `infinite?' and `finite?' * NEWS: Fix and combine NEWS entries on `infinite?' and `finite?'. Previous, they stated that these predicates now work on non-real complex numbers, but that is not the case. 2011-02-01 Mark H Weaver Update copyright date of manual, and a small fix * doc/ref/guile.texi: Update copyright date to 2011. * doc/ref/r6rs.texi (rnrs base): Fix typo: `rem0' -> `div0'. 2011-01-31 Andy Wingo update NEWS * NEWS: Update. 2011-01-31 Mark H Weaver Improve extensibility of `expt' and `integer-expt' * libguile/numbers.c (scm_integer_expt): No longer require that the first argument be a number, in order to improve extensibility. This allows us to efficiently raise arbitrary objects to an integer power as long as we can multiply those objects. For example, this allows us to efficiently exponentiate matrices if we define only multiplication methods for matrices. Note also that scm_expt calls this procedure whenever the exponent is an integer, regardless of the type of the first argument. Also rearrange the order in which we test special cases. * test-suite/tests/numbers.test (expt, integer-expt): Comment out tests that required `(expt #t 0)' and `(integer-expt #t 0)' to throw exceptions. Add tests for (expt #t 2) and `(integer-expt #t 2) instead. * NEWS: Add NEWS entry 2011-01-31 Andy Wingo toplevel vars added by syntax expansion are unbound * module/ice-9/psyntax.scm (chi-top): When adding to the toplevel environment at compile-time, default to undefined variables, not variables defined to #f. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm (module-add!): Add a new pre-modules version of this function, so we can add variables the environment, not just values. (module-define!): Use module-add!. 2011-01-31 Mark H Weaver Rename {euclidean,centered}_quo_rem to {euclidean,centered}_divide * libguile/numbers.c (euclidean_quo_rem): Rename to euclidean_divide. (centered_quo_rem): Rename to {euclidean,centered}_divide. * libguile/numbers.h: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide. * doc/ref/api-data.texi: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide. 2011-01-31 Ludovic Courtès Disable stand-alone tests that require `dlopen' when `--disable-shared'. * configure.ac (HAVE_SHARED_LIBRARIES): New Automake conditional. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add `test-asmobs', `test-ffi', and `test-extensions' only when `HAVE_SHARED_LIBRARIES'. 2011-01-31 Mark H Weaver Rework the testing framework for number-theoretic division operators * test-suite/tests/numbers.test (test-eqv?): Remove special handling of zeroes. Zeroes are now compared like all other numbers. Exact numbers are compared with `eqv?' and inexact numbers are compared to within test-epsilon. Rework the testing framework for number-theoretic division operators: `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', and `centered-remainder'. Previously we compared all test results against a simple scheme implementation of the same operations. However, these operations have discontinuous jumps where a tiny change in the inputs can lead to a large change in the outputs, e.g.: (euclidean/ 130.00000000000 10/7) ==> 91.0 and 0.0 (euclidean/ 129.99999999999 10/7) ==> 90.0 and 1.42857142856141 In the new testing scheme, we compare values against the simple implementations only if the input arguments contain an infinity or a NaN. In the common case of two finite arguments, we simply make sure that the outputs of all three operators (e.g. `euclidean/', `euclidean-quotient', `euclidean-remainder') equal each other, that outputs are exact iff both inputs are exact, and that the required properties of the operator are met: that Q is an integer, that R is within the specified range, and that N = Q*D + R. 2011-01-30 Ludovic Courtès Add `pointer?'. * libguile/foreign.c (scm_pointer_p): New function. * libguile/foreign.h (scm_pointer_p): New declaration. * module/system/foreign.scm: Export `pointer?'. * test-suite/tests/foreign.test ("null pointer")["pointer?"]: New test. ("make-pointer")["pointer?"]: New test. * doc/ref/api-foreign.texi (Foreign Variables): Document `pointer?'. 2011-01-30 Ludovic Courtès Remove the "has finalizer?" bit from pointer objects. * libguile/foreign.h (SCM_POINTER_HAS_FINALIZER): Remove. * libguile/foreign.c (scm_from_pointer): Store nothing more than `scm_tc7_pointer' in the type slot. 2011-01-30 Ludovic Courtès Add `define-wrapped-pointer-type'. * module/system/foreign.scm (define-wrapped-pointer-type): New macro. * doc/ref/api-foreign.texi (Foreign Types): Mention the `*' symbol. (Void Pointers and Byte Access): Document `define-wrapped-pointer-type'. * test-suite/tests/foreign.test ("define-wrapped-pointer-type"): New test prefix. 2011-01-30 Mark H Weaver Improve extensibility of core numeric procedures * libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo, scm_zero_p, scm_positive_p, scm_negative_p, scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_magnitude, scm_angle, scm_exact_to_inexact): Change from SCM_GPROC to SCM_PRIMITIVE_GENERIC. As a side effect, all of these procedures now have documentation strings. (scm_exact_p, scm_inexact_p, scm_odd_p, scm_even_p, scm_finite_p, scm_inf_p, scm_nan_p, scm_expt, scm_inexact_to_exact, scm_log, scm_log10, scm_exp, scm_sqrt): Change from SCM_DEFINE to SCM_PRIMITIVE_GENERIC, and make sure the code allows these functions to be extended in practice. (scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_inexact_to_exact): Simplify type dispatch code. (scm_sqrt): Rename formal argument from x to z, since complex numbers are supported. (scm_abs): Fix empty FUNC_NAME. * libguile/numbers.h (scm_finite_p): Add missing prototype. (scm_inf_p, scm_nan_p): Rename formal parameter from n to x, since the domain is the real numbers. * test-suite/tests/numbers.test: Test for documentation strings. Change from `expect-fail' to `pass-if' for several of these, and add tests for others. Also add other tests for `real-part' and `imag-part', which previously had none. 2011-01-30 Mark H Weaver Add two new sets of fast quotient and remainder operators * libguile/numbers.c (scm_euclidean_quo_and_rem, scm_euclidean_quotient, scm_euclidean_remainder, scm_centered_quo_and_rem, scm_centered_quotient, scm_centered_remainder): New extensible procedures `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * libguile/numbers.h: Add function prototypes. * module/rnrs/base.scm: Remove incorrect stub implementations of `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Instead do renaming imports of `euclidean-quotient', `euclidean-remainder', `euclidean/', `centered-quotient', `centered-remainder', and `centered/', which are equivalent to the R6RS operators. * module/rnrs/arithmetic/fixnums.scm (fxdiv, fxmod, fxdiv-and-mod, fxdiv0, fxmod0, fxdiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. (fx+/carry): Remove unneeded calls to `inexact->exact'. * module/rnrs/arithmetic/flonums.scm (fldiv, flmod, fldiv-and-mod, fldiv0, flmod0, fldiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. Remove unneeded calls to `inexact->exact' and `exact->inexact' * test-suite/tests/numbers.test: (test-eqv?): New internal predicate for comparing numerical outputs with expected values. Add extensive test code for `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * test-suite/tests/r6rs-arithmetic-fixnums.test: Fix some broken test cases, and remove `unresolved' test markers for `fxdiv', `fxmod', `fxdiv-and-mod', `fxdiv0', `fxmod0', and `fxdiv0-and-mod0'. * test-suite/tests/r6rs-arithmetic-flonums.test: Remove `unresolved' test markers for `fldiv', `flmod', `fldiv-and-mod', `fldiv0', `flmod0', and `fldiv0-and-mod0'. * doc/ref/api-data.texi (Arithmetic): Document `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', and `centered-remainder'. (Operations on Integer Values): Add cross-references to `euclidean/' et al, from `quotient', `remainder', and `modulo'. * doc/ref/r6rs.texi (rnrs base): Improve documentation for `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Add cross-references to `euclidean/' et al. * NEWS: Add NEWS entry. 2011-01-30 Mark H Weaver Add SCM_LIKELY and SCM_UNLIKELY for optimization * libguile/numbers.c (scm_abs, scm_quotient, scm_remainder, scm_modulo): Add SCM_LIKELY and SCM_UNLIKELY in several places for optimization. (scm_remainder): Add comment about C99 "%" semantics. Strip away a redundant set of braces. 2011-01-30 Mark H Weaver Fix GOOPS method compilation bug when no next-method exists * module/oop/goops/compile.scm (compute-cmethod): Fix a bug that caused the method compiler to barf while compiling a method that calls (next-method), if there is no applicable next method. 2011-01-30 Mark H Weaver Implement R6RS `real-valued?', `rational-valued?', `integer-valued?' * module/rnrs/base.scm (real-valued?, rational-valued?, integer-valued?): Implement in compliance with R6RS. * test-suite/tests/r6rs-base.test: Add test cases for `real-valued?', `rational-valued?', and `integer-valued?'. * NEWS: Add NEWS entries. 2011-01-30 Mark H Weaver Infinities and NaNs are no longer rational * libguile/numbers.c (scm_rational_p): Return #f for infinities and NaNs, per R6RS. Previously it returned #t for real infinities and NaNs. They are still considered real by scm_real `real?' however, per R6RS. Also simplify the code. (scm_real_p): New implementation to reflect the fact that the rationals and reals are no longer the same set. Previously it just called scm_rational_p. (scm_integer_p): Simplify the code. * test-suite/tests/numbers.test: Add test cases for `rational?' and `real?' applied to infinities and NaNs. * doc/ref/api-data.texi (Real and Rational Numbers): Update docs to reflect the fact that infinities and NaNs are no longer rational, and that `real?' no longer implies `rational?'. Improve discussion of infinities and NaNs. * NEWS: Add NEWS entries, and combine with an earlier entry about infinities no longer being integers. 2011-01-30 Mark H Weaver `equal?' and `eqv?' are now equivalent for numbers Change `equal?' to work like `eqv?' for numbers. Previously they worked differently in some cases, e.g. when comparing signed zeroes or NaNs. For example, (equal? 0.0 -0.0) returned #t but (eqv? 0.0 -0.0) returned #f, and (equal? +nan.0 +nan.0) returned #f but (eqv? +nan.0 +nan.0) returned #t. * libguile/numbers.c (scm_real_equalp, scm_bigequal, scm_complex_equalp, scm_i_fraction_equalp): Move to eq.c. * libguile/eq.c (scm_real_equalp): Compare flonums using real_eqv instead of ==, so that NaNs are now considered equal, and to distinguish signed zeroes. (scm_complex_equalp): Compare real and imaginary components using real_eqv instead of ==, so that NaNs are now considered equal, and to distinguish signed zeroes. (scm_bigequal): Use scm_i_bigcmp instead of duplicating it. (real_eqv): Test for NaNs using isnan(x) instead of (x != x), and use SCM_UNLIKELY for optimization. (scm_eqv_p): Use scm_bigequal, scm_real_equalp, scm_complex_equalp, and scm_i_fraction_equalp to compare numbers, instead of inline code. Those predicates now do what scm_eqv_p formerly did internally. Replace if statements with switch statements, as is done in scm_equal_p. Remove useless code to check equality of fractions with different SCM_CELL_TYPEs; this was for a tentative "lazy reduction bit" which was never developed. (scm_eqv_p, scm_equal_p): Remove useless code to check equality between inexact reals and non-real complex numbers with zero imaginary part. Such numbers do not exist, because the current code is careful to never create them. * test-suite/tests/numbers.test: Add test cases for `eqv?' and `equal?'. Change existing test case for `(equal? +nan.0 +nan.0)' to expect #t instead of #f. * NEWS: Add NEWS entries. 2011-01-30 Mark H Weaver Remove useless test and fix spelling errors * test-suite/tests/numbers.test: Remove test for lazy reduction bit of fractions, which was never implemented. Fix some spelling errors. 2011-01-29 Ludovic Courtès Don't remove `standard-library.texi' upon "make clean". * doc/ref/Makefile.am (CLEANFILES): Rename to... (DISTCLEANFILES): ... this. So that "make clean" doesn't remove `standard-library.texi'. Reported by Hans Åberg . Add missing include for MinGW. * libguile/ports.h: Include . Make `inet-ntop' and `inet-pton' available even when !HAVE_IPV6. * libguile/socket.c (scm_inet_pton, scm_inet_ntop): Move out of `#ifdef HAVE_IPV6' and conditionalize the IPv6-specific bits. Reported by Jan Nieuwenhuizen . 2011-01-29 Jan Nieuwenhuizen When cross building, run GUILE_FOR_BUILD instead of just-built guile. * meta/guile.in: Run @GUILE_FOR_BUILD@ when cross-compiling. 2011-01-29 Ludovic Courtès Have `srfi-19.test' use the non-deprecated `format' style. * test-suite/tests/srfi-19.test: Fix all uses of `format' to pass a port or Boolean as the first argument. Add a test for `send' and `recv!'. * test-suite/tests/socket.test ("AF_UNIX/SOCK_STREAM")["bind (bis)", "listen (bis)", "recv!", "accept (bis)"]: New tests. 2011-01-29 Ludovic Courtès Have `recv!', `send', etc. accept a bytevector. * libguile/socket.c (scm_recv, scm_send, scm_recvfrom, scm_sendto): Expect the buffer to be a bytevector. Move the string-handling code under `#if SCM_ENABLE_DEPRECATED == 1' and issue a deprecation warning. * test-suite/tests/socket.test ("AF_UNIX/SOCK_DGRAM")["sendto", "sendto/sockaddr"]: Adjust accordingly. * doc/ref/posix.texi (Network Sockets and Communication): Update documentation of `recv!', `send', `recvfrom!', and `sendto'. 2011-01-29 Ludovic Courtès Add `-lgc' to `Libs' in `guile-2.0.pc'. This accounts for the fact that some public Guile macros and inline functions use libgc functions. * meta/guile-2.0.pc.in (Libs.private): Move @BDW_GC_LIBS@ to... (Libs): ... here. Reported by Hans Aberg . * meta/guile-2.0-uninstalled.pc.in: Likewise. 2011-01-28 Andy Wingo update api-evaluation.texi * doc/ref/api-evaluation.texi (Compilation): Update compile-file and compiled-file-name docs. 2011-01-28 Mark H Weaver Fix bugs when negating SCM_MOST_POSITIVE_FIXNUM+1 * libguile/numbers.c (scm_difference, scm_product): Fix bugs when negating SCM_MOST_POSITIVE_FIXNUM+1, aka -SCM_MOST_NEGATIVE_FIXNUM. Previously, these cases failed to normalize the result to a fixnum, causing `=', `eqv?' and `equal?' to fail, e.g.: (= most-negative-fixnum (- 0 (- most-negative-fixnum))) (= most-negative-fixnum (* -1 (- most-negative-fixnum))) (= most-negative-fixnum (* (- most-negative-fixnum) -1)) * test-suite/test/numbers.test: Add test cases to detect bugs when negating SCM_MOST_POSITIVE_FIXNUM+1 and SCM_MOST_NEGATIVE_FIXNUM by various methods. 2011-01-28 Mark H Weaver note inf? / nan? domain in NEWS * NEWS: Add NEWS entry. 2011-01-28 Andy Wingo domain of inf?, finite?, nan? is the real numbers * libguile/numbers.c (scm_inf_p, scm_finite_p, scm_nan_p): The domain of these functions is the real numbers. Error on other input. * doc/ref/api-data.texi (Reals and Rationals): Update the documentation accordingly. * test-suite/tests/numbers.test ("finite?", "inf?"): Update tests. 2011-01-28 Mark H Weaver Remove useless code from do_divide * libguile/numbers.c (do_divide): Remove code which handled a case that never occurs: a zero bignum. 2011-01-28 Mark H Weaver Optimize scm_exact_p by making use of SCM_INEXACTP * libguile/numbers.c (scm_exact_p): Optimize by making use of the SCM_INEXACTP macro. (scm_inexact_p): Move it next to scm_exact_p, and add else's. * test-suite/tests/numbers.test: Add test cases for `exact?' and `inexact?' applied to infinities and NaNs. 2011-01-28 Mark H Weaver Implement `finite?' in core and fix R6RS `finite?' and `infinite?' * libguile/numbers.c (scm_finite_p): Add new predicate `finite?' from R6RS to guile core, which returns #t if and only if its argument is neither infinite nor a NaN. Note that this is not the same as (not (inf? x)) or (not (infinite? x)), since NaNs are neither finite nor infinite. * test-suite/tests/numbers.test: Add test cases for `finite?'. * module/rnrs/base.scm: Import `inf?' as `infinite?' instead of reimplementing it. Previously, the R6RS implementation of `infinite?' did not detect non-real complex infinities, nor did it throw exceptions for non-numbers. (Note that NaNs _are_ considered numbers by scheme, despite their name). Import `finite?' instead of reimplementing it. Previously, the R6RS implementation of `finite?' returned #t for both NaNs and non-real complex infinities, in violation of R6RS. * NEWS: Add NEWS entries, and reorganize existing numerics-related entries together under one subheading. * doc/ref/api-data.texi (Real and Rational Numbers): Add docs for `finite?' and scm_finite_p. 2011-01-28 Mark H Weaver Add SCM_INUM1 to numbers.h, and make use of it and SCM_INUM0 in numbers.c * libguile/numbers.h: Add SCM_INUM1, a name for the fixnum 1. This is analogous to SCM_INUM0, a name for 0, which already existed. * libguile/numbers.c: Change occurrences of SCM_I_MAKINUM (0) and SCM_I_MAKINUM (1) to SCM_INUM0 and SCM_INUM1, respectively. 2011-01-28 Mark H Weaver Fix NEWS entry regarding changes to `expt' for zero base NEWS: Fix NEWS entry regarding changes to `expt' when base is zero Do not apply `inf?' or `nan?' to strings * module/ice-9/format.scm (format): Test to make sure an argument is a number before applying `inf?' and `nan?' to it. Formerly, format would call `inf?' and `nan?' on arguments that might be either a number or a string, although those predicates should ideally throw an exception when applied to non-number objects. Fix incorrect FUNC_NAME for scm_current_processor_count * libguile/posix.c (scm_current_processor_count): Fix incorrect FUNC_NAME (was s_scm_total_processor_count) 2011-01-27 Andy Wingo fix guile-tools getopt * meta/guile-tools.in (getopt): Define a local version of getopt that stops parsing options when it sees a non-option. fix THANKS * THANKS: Fix. 2011-01-27 Andy Wingo for mmap objcodes, store the fd in the third word, as a scheme int This leaves space for native code. * libguile/objcodes.h (SCM_OBJCODE_NATIVE_CODE) (SCM_SET_OBJCODE_NATIVE_CODE): Reserve the fourth word of objcode for "native code", whatever that means. * libguile/objcodes.c: Update a comment. (make_objcode_by_mmap): Put the fd in the third word. 2011-01-27 Andy Wingo objcode type is an enumeration, not flags * libguile/objcodes.h (SCM_OBJCODE_TYPE_MMAP) (SCM_OBJCODE_TYPE_BYTEVECTOR, SCM_OBJCODE_TYPE_SLICE) (SCM_OBJCODE_TYPE_STATIC): Enumerate objcode types instead of expressing them as flags. (SCM_OBJCODE_TYPE): Type is held in bits 8-15. (SCM_OBJCODE_FLAGS): Flags are now shifted by 16 bits, not 8. (SCM_MAKE_OBJCODE_TAG): New helper. * libguile/continuations.c (STATIC_OBJCODE_TAG): * libguile/control.c (STATIC_OBJCODE_TAG): * libguile/foreign.c (STATIC_OBJCODE_TAG): * libguile/gsubr.c (STATIC_OBJCODE_TAG): * libguile/smob.c (STATIC_OBJCODE_TAG): * libguile/objcodes.c (make_objcode_by_mmap, scm_c_make_objcode_slice) (scm_bytecode_to_objcode): : Use SCM_MAKE_OBJCODE_TAG. 2011-01-27 Andy Wingo guile-tools gracefully errors for missing scripts * meta/guile-tools.in (find-script): Use the #:ensure arg of resolve-module. (main): Display a comprehensible error message if we don't find a script. guile-tools uses getopt-long * meta/guile-tools.in: Use getopt-long. guile-tools uses srfi-1 * meta/guile-tools.in (guile-tools): Use srfi-1 here, now that we can. 2011-01-27 Andy Wingo fix error handling in variable-ref family of instructions * libguile/vm-i-system.c (variable-ref, variable-set, variable-bound?): Check that the argument is actually a variable. Thanks to Kevin Holmes for the report. * libguile/vm-engine.c (vm_engine): Error handling down here. * THANKS: Update. 2011-01-27 Ludovic Courtès Use `scm_from_latin1_stringn' in `objcodes.c'. * libguile/objcodes.c (make_objcode_by_mmap): Use `scm_from_latin1_stringn', not `scm_from_locale_stringn', to display the invalid cookie in the error case. Fix buffer overflow in `read-line'. * libguile/rdelim.c (SCM_DEFINE): Compare INDEX to LINE_BUFFER_SIZE, not `sizeof (buf)'. 2011-01-26 Ludovic Courtès Add ECMAScript parser tests. * test-suite/tests/ecmascript.test ("parser"): Add parser tests for the previous fixes. 2011-01-26 Noah Lavine Parse Decimal Numbers * module/language/ecmascript/parse.scm: handle numbers with leading decimals correctly. Fix Hex Constants * module/language/ecmascript/tokenize.scm: hexadecimal constants can now use 'X' in addition to 'x'. Ecmascript Syntax * module/language/ecmascript/tokenize.scm: an unbreakable space counts as whitespace. Ecmascript Syntax Fix * module/language/ecmascript/parse.scm: allow empty function bodies. 2011-01-26 Ludovic Courtès Add a `read-line' benchmark. * benchmark-suite/benchmarks/ports.bm ("rdelim"): New benchmark prefix. Tweak `read-line'. * libguile/rdelim.c (LINE_BUFFER_SIZE): Set to 1 KiB instead of 4 KiB. (scm_read_line): Initialize STRING to #f so we actually use the fast path. 2011-01-26 Andy Wingo more sensible error if compiled-file-name returns false in compile-file * module/system/base/compile.scm (compile-file): Error if no output-file is given and compiled-file-name returns false. fix THANKS * THANKS: Fix Hans' surname. fix error-handling of apply to non-list * libguile/vm-engine.c (vm_error_apply_to_non_list): Sync registers before erroring. Fix type of finish_args. Thanks to Hans Aberg for the report. update README for copyright year ranges * README: Add note about copyright year ranges. Remove reference to guile-tut.info. 2011-01-26 Andy Wingo fix format ~f documentation for width combined with overflowchar * doc/ref/misc-modules.texi (Formatted Output): Adapt ~f documentation to indicate that the output will always have a decimal point. Thanks to Fu-gangqiang for the report. * THANKS: Update. 2011-01-26 Julian Graham Additional documentation for symbol manipulation functions. * doc/ref/api-data.texi (Symbol Primitives): Document `symbol', `list->symbol', and `symbol-append'. 2011-01-26 Ludovic Courtès Rewrite `read-line' in terms of `scm_getc'. As a result `read-line' handles decoding and decoding errors the same way as `scm_getc'. It's also simpler and free of `malloc' calls. * libguile/rdelim.c (scm_do_read_line): Remove. (scm_read_line): Rewrite as a loop that calls `scm_getc'. * test-suite/tests/rdelim.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/rdelim.test'. 2011-01-26 Ludovic Courtès Have `scm_getc' honor the port's conversion strategy. * libguile/ports.c (get_codepoint): Reset `pt->input_cd' upon failure. If `pt->ilseq_handler' is `SCM_ICONVEH_QUESTION_MARK', then return a question mark. [failure]: Use `scm_encoding_error' when raising an error. * test-suite/lib.scm (exception:encoding-error): Adjust regexp. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute"]: New tests. 2011-01-26 Ludovic Courtès Test substitution and escaping on port output. * test-suite/tests/ports.test ("string ports")["wrong encoding, substitute", "wrong encoding, escape"]: New tests. 2011-01-26 Ludovic Courtès Add `scm_{to,from}_utf32_string'. * libguile/strings.c (scm_from_utf32_string, scm_from_utf32_stringn, scm_to_utf32_string, scm_to_utf32_stringn): New functions. * libguile/strings.h (scm_from_utf32_string, scm_from_utf32_stringn, scm_to_utf32_string, scm_to_utf32_stringn): New declarations. * doc/ref/api-data.texi (Conversion to/from C): Document `scm_{to,from}_{utf8,utf32}_stringn'. 2011-01-26 Ludovic Courtès Optimize `scm_{to,from}_latin1_string'. * libguile/strings.c (scm_from_latin1_stringn): Directly return a narrow string instead of going through `scm_from_stringn'. (scm_to_latin1_stringn): Directly return a copy of STR's raw bytes when it's narrow. 2011-01-25 Andy Wingo stexi->shtml supports itemx * module/texinfo/html.scm (entry, rules): Allow @itemx, 2011-01-24 Ludovic Courtès Install the current locale when starting the REPL. * module/ice-9/top-repl.scm (top-repl): Install the current locale. Remove useless branches in the port code. * libguile/ports.c (scm_i_get_port_encoding): Remove useless `if'. (scm_set_port_encoding_x): Remove redundant `find_valid_encoding' call. Always initialize a port's encoding name. * libguile/ports.c (scm_i_set_port_encoding_x): Always initialize PT->encoding to something non-NULL. This fixes callers of `scm_encoding_error' such that they always pass a non-NULL encoding name. Reported by Matei Conovici. 2011-01-24 Andy Wingo update the man page * doc/guile.1: Update a bit. 2011-01-24 Ludovic Courtès Choose the input source file encoding in a locale-independent way. This is so that compiling the same code on environments with different locale settings yields the same result. * module/system/base/compile.scm (compile-file): When ENC if #f, default to "UTF-8" instead of `(fluid-ref %default-port-encoding)'. * doc/ref/api-evaluation.texi (Compilation): Document the default output file name and default source file encoding for `compile-file' and `guile-tools compile'. 2011-01-23 Ludovic Courtès Remove unexpected non-ASCII character. * module/language/tree-il/fix-letrec.scm: Replace U+2019 with an ASCII quote. The iconv implementation on FreeBSD would immediately notice and bail out when reading it under a US-ASCII locale. Rewrite `scm_lfwrite_substr' in terms of `scm_display'. * libguile/ports.c (scm_lfwrite_substr): Rewrite in terms of `scm_display'. 2011-01-23 Ludovic Courtès Remove `scm_lfwrite_str'. * libguile/ports.c (scm_lfwrite_str): Remove. * libguile/ports.h (scm_lfwrite_str): Remove declaration. * libguile/numbers.c (scm_i_print_fraction): Use `scm_display' instead of `scm_lfwrite_str'. 2011-01-23 Ludovic Courtès Augment `THANKS'. 2011-01-23 Ludovic Courtès Hide the string escaping hacks. * libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes): Rename to... (unistring_escapes_to_guile_escapes): ... this. Make `static'. (scm_i_unistring_escapes_to_r6rs_escapes): Rename to... (unistring_escapes_to_r6rs_escapes): ... this. Make `static'. * libguile/strings.h (scm_i_unistring_escapes_to_guile_escapes, scm_i_unistring_escapes_to_r6rs_escapes): Remove declarations. 2011-01-23 Ludovic Courtès Rewrite `read-char', `display', etc. using iconv calls instead of libunistring. Thanks to Bruno Haible for his suggestions. See , for details. * libguile/ports.c (register_finalizer_for_port): Always register a finalizer for PORT. (finalize_port): Close ENTRY->input_cd and ENTRY->output_cd. (scm_new_port_table_entry): Initialize the `input_cd' and `output_cd' fields. (utf8_to_codepoint): New function. (get_codepoint): Rewrite to use `iconv' instead of libunistring. (scm_i_set_port_encoding_x): Initialize the `input_cd' and `output_cd' fields. (update_port_lf): Move upward. Use `switch' instead of `if's. * libguile/ports.h (scm_t_port)[input_cd, output_cd]: New fields. * libguile/print.c (codepoint_to_utf8, display_string): New functions. (display_character): Use `display_string'. (write_combining_character): Likewise. (iprin1): Use `display_string' instead of `scm_lfwrite_str', and `display_character' instead of `scm_putc'. (write_character): Likewise. (write_character_escaped): New function. * test-suite/tests/encoding-escapes.test ("display output escapes")["Rashomon"]: Use lower-case escapes. ["fake escape"]: New test. 2011-01-23 Andy Wingo infinities are no longer integers * libguile/numbers.c (scm_is_integer): Infinities are not integers, per the R6RS. (scm_even_p, scm_odd_p): Passing an infinity to even? or odd? is an error. * test-suite/tests/numbers.test ("integer?"): Adapt test. ("expt"): Add tests for +inf.0 and -inf.0 exponents. * NEWS: Add NEWS entries. 2011-01-22 Andy Wingo web.texi fix * doc/ref/web.texi (HTTP Headers): Fix transfer-encoding example. 2011-01-22 Andy Wingo scm_with_guile calls GC_call_with_gc_active * configure.ac: Check for GC_call_with_gc_active. * libguile/threads.h (scm_i_thread): Remove "top", as it's not used. * libguile/threads.c (with_gc_inactive, with_gc_active): Define shims to GC_do_blocking and GC_call_with_gc_active. (scm_i_init_thread_for_guile): Don't do thread base adjustment here, do it in scm_i_with_guile_and_parent. The previous logic would never be run. (scm_i_with_guile_and_parent): If we enter Guile mode, leave it too. Take care of adjusting the thread stack base here too. Also, call with_gc_active. (scm_without_guile): Refactor. 2011-01-21 Andy Wingo update NEWS for hungry-eol-escapes * NEWS: Update for hungry-eol-escapes. document hungry-eol-escapes * doc/ref/api-data.texi (String Syntax): Document hungry-eol-escapes. * doc/ref/api-evaluation.texi (Scheme Read): * doc/ref/api-options.texi (Runtime Options): Update read-options 'help output. 2011-01-21 Andy Wingo implement r6rs hungry escaped EOL * libguile/private-options.h (SCM_HUNGRY_EOL_ESCAPES_P): New private option. * libguile/read.c: Define SCM_HUNGRY_EOL_ESCAPES_P, defaulting to #f. (skip_intraline_whitespace): New helper. (scm_read_string): If SCM_HUNGRY_EOL_ESCAPES_P, skip_intraline_whitespace after an escaped EOL. * test-suite/tests/reader.test ("read-options"): Add test. 2011-01-21 Andy Wingo implement port-eof? * module/rnrs/io/ports.scm (port-eof?): Implement. * module/rnrs.scm: Re-export port-eof?. * test-suite/tests/r6rs-ports.test ("7.2.5 End-of-File Object"): Add test. Thanks to Göran Weinholt for the report. 2011-01-20 Andy Wingo add NEWS for expt change * NEWS: Update for Mark's expt patch. update NEWS for 1.9.14 * NEWS: Fold 1.9.14 entries into main text. 2011-01-20 Mark H Weaver Fix bugs in expt and integer-expt * libguile/numbers.c (scm_expt): Fix bug that caused expt to throw an exception whenever the base was exact and the exponent was an inexact integer, e.g. (expt 5 6.0). (scm_expt): Fix bug that caused expt to introduce spurious imaginary parts in the result when the base was an inexact negative real and the exponent was an integer, e.g. (expt -1.0 2) (scm_integer_expt, scm_expt): Change behavior of (integer-expt 0 -1), and therefore also (expt 0 -1), to return NaN, per R6RS (actually, R6RS says we should throw an exception or return an "unspecified number object", but for now we use NaN). Formerly we returned 0, per R5RS. R5RS claims that 0^x=0 for all non-zero x, but that's mathematically incorrect, and probably an oversight. (scm_integer_expt): Consistently throw a wrong-argument-type exception when the exponent is inexact. Formerly, it didn't always check this if the base was 0, 1, or -1. * test-suite/tests/numbers.test ("integer-expt", "expt"): Add tests. 2011-01-17 Noah Lavine Add ECMAScript Unicode literal support * module/language/ecmascript/tokenize.scm: add unicode literals * test-suite/tests/ecmascript.test ("parser"): Add new tests for Latin-1 and Unicode escapes in string literals. 2011-01-15 Neil Jerram Add "REPORTING BUGS" and "COPYING" sections to Guile man page Thanks to Mark Harig for the suggestion. * doc/guile.1: Added "REPORTING BUGS" and "COPYING" sections, modelled on those in the Emacs man page. 2011-01-15 Neil Jerram Document missing Guile command line options Thanks to Mark Harig for pointing this out and suggesting the text. * doc/ref/scheme-scripts.texi (Invoking Guile): Mention --autocompile and --no-autocompile. 2011-01-15 Neil Jerram Manual page fixes Thanks to Mark Harig for pointing these out. * doc/guile.1: Remove mention of the tutorial, since it no longer exists (as a separate document). Document the -q option. * THANKS: Add Mark Harig. 2011-01-14 Neil Jerram Confront the MOP * doc/ref/goops.texi (The Metaobject Protocol): Bring forward to before `Class Options', and add intro text to explain why. All of the sections now remaining are ones where the MOP is more likely to be relevant than not. Move `GOOPS Error Handling' to after `Introspection' * doc/ref/goops.texi (GOOPS Error Handling): Move to just after `Introspection'. Move `Handling Slot Access Errors' inside `Accessing Slots' * doc/ref/goops.texi (Accessing Slots): Move `Handling Slot Access Errors' here; update relevant references. Merge small sections into `GOOPS Object Miscellany' * doc/ref/goops.texi (GOOPS Object Miscellany): New section, combining previous `Object Comparison', `Cloning Objects' and `Write and Display'. Replace `Object Comparison' text with something that makes sense. Add a snippet to the end of the write/display section. Remove content-free `Generic Functions and Accessors' * doc/ref/goops.texi (GOOPS): Remove `Generic Functions and Accessors'. There was nothing here that wasn't better covered elsewhere. Move `Accessing Slots' inside `Introspection'. * doc/ref/goops.texi (Introspection): Move `Accessing Slots' into here, and flatten it, except for `Handling Slot Access Errors'. (GOOPS Error Handling): Move `Handling Slot Access Errors' here. Reorder `Introspection' * doc/ref/goops.texi (Instances): Move `Instances' before `Slots', as it feels more important. Edit `Introspection' * doc/ref/goops.texi (Introspection): Make a bit snappier. (Classes): Add intro. Remove "the" and "metaobject" everywhere. Remove `class-environment', since I don't know what it's useful for. (Instances): Remove implementation notes. (Built-in classes): Merge with `Instances'. Reorder text points. (Generic Functions): Add intro. Remove "the" and "metaobject" everywhere. (Generic Function Methods): Merge with `Generic Functions'. Move `Introspection' earlier * doc/ref/goops.texi (Introspection): Move to after `Generic Functions and Methods'. The idea is to have all of that sections that make sense without needing to understand the MOP, before sections that really depend on the MOP. 2011-01-13 Neil Jerram Improve doc on generic functions and inheritance * doc/ref/goops.texi (Methods and Generic Functions): More explanation of generic function invocation. Created (or moved) subsections here to cover material on the following that was previously spread elsewhere: accessors; extending primitives; merging generics; generic function examples; handling invocation errors. Edited for clarity throughout. (Generic functions and methods, Example): Nodes deleted, with their material incorporated above. (Class Precedence List): Edited to improve clarity. (Sorting Methods): New subsection. 2011-01-11 Andy Wingo web.texi defun -> deffn * doc/ref/web.texi (URIs): Change instances of @defun to @deffn with {Scheme Procedure}. more web.texi foo * doc/ref/web.texi (Web Server, Web Examples): Update. update web.text documentation for requests and responses * doc/ref/web.texi (Requests, Responses): Update, and add a note on character encodings. 2011-01-11 Andy Wingo request and response cleanups * module/web/request.scm (build-request): Make URI a positional argument. * module/web/response.scm: Remove extend-response. (read-response): Fix a docstring. * module/web/server.scm (extend-response): Include extend-response here, but not exported. 2011-01-11 Andy Wingo (web response) and (web request): bodies are bytevectors * module/web/request.scm (read-request-body, write-request-body): Rename from read-request-body/bytevector and write-request-body/bytevector. Remove the /latin-1 variants, as they were unused and a bad idea. * module/web/response.scm (read-response-body, write-response-body): Likewise. * module/web/server/http.scm (http-read, http-write): Adapt to request/response change. * test-suite/tests/web-request.test: * test-suite/tests/web-response.test: Update tests. 2011-01-10 Andy Wingo update web.texi for (web http) changes * doc/ref/web.texi (HTTP Headers): Update to reflect current code, and to reformat. Not sure if it's an improvement... parse credentials and challenges * module/web/http.scm (parse-credentials, validate-credentials) (write-credentials, parse-challenge, parse-challenges) (validate-challenges, write-challenge, write-challenges) (declare-credentials-header!, declare-challenge-list-header!): New helpers. ("Authorization", "Proxy-Authorization"): Parse out credentials. ("Proxy-Authenticate", "WWW-Authenticate"): Parse out challenges. 2011-01-09 Andy Wingo more symbols in (web http) * module/web/http.scm (declare-symbol-list-header!): New helper. ("Connection"): Redefine as a header list. ("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol lists. * test-suite/tests/web-http.test: * test-suite/tests/web-response.test: Adapt tests. 2011-01-09 Andy Wingo (web http): keys are always symbols * module/web/http.scm (parse-media-type): Parse media types as symbols. (parse-key-value-list, parse-param-component, parse-param-list): Change kons to val-parser. Always parse keys as symbols, and always either cons, if there is a val, or just have the key, if there is no val. Easier to explain and just as correct. (declare-param-list-header!, declare-key-value-list-header!): Adapt to key-list and param-list kons change. ("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect") ("TE"): Likewise, adapt. ("Content-Type"): Param keys are symbols. update (web http) docs * doc/ref/web.texi (HTTP): Update docs to correspond with current code. 2011-01-08 Andy Wingo (web http): don't expose header-decl objects * module/web/http.scm: Change to not expose the header-decl objects, instead exposing header-parse, header-validator, header-writer et al. Explaining header decls in the manual was too complicated. (string->header, header->string): New helpers. (): Remove the `sym' field. (declare-header!): Adapt to header-decl change, and use string->header. (known-header?, header-parser, header-validator, header-writer): New procedures. Adapt to use the new procedures internally. 2011-01-08 Andy Wingo (web http): header names always represented as symbols * module/web/http.scm (declare-header!): No need to specify `sym', as it can be derived from `name'. Change to take parser, validator, and writer as positional arguments, and multiple? as a keyword. (parse-header): Change to take the header as a symbol already, and just return the parsed value. All headers are symbols now, including unknown headers. I feel OK doing this given that the symbol GC works now. (lookup-header-decl): Only look up headers by symbol. (read-header): Adapt to parse-header change. (valid-header?, write-header): Adapt to all headers being symbols. (split-header-names, list-of-header-names?, write-header-list): Represent all header names as symbols. (declare-opaque-header!, declare-date-header!) (declare-string-list-header!, declare-header-list-header!) (declare-integer-header!, declare-uri-header!) (declare-quality-list-header!, declare-param-list-header!) (declare-key-value-list-header!, declare-entity-tag-list-header!): Change to be functions instead of syntax, and no need to specify the symbolic name. Update all header declarations accordingly. * module/web/request.scm (validate-headers): * module/web/response.scm (validate-headers): Adapt to all headers being symbols. * test-suite/tests/web-http.test (pass-if-parse, pass-if-any-error) (pass-if-parse-error): Update for parse-header change. ("general headers"): Update header list examples to be all symbols. 2011-01-08 Andy Wingo fix scm_from_stringn empty string case * libguile/strings.c (scm_from_stringn): Fix empty string case (oops...). fix tab completion in repl (doh) * libguile/hashtab.c: Fix remaining vector hash table support. * module/ice-9/session.scm (apropos-fold): Use a hash table instead of a vector for the completions. 2011-01-07 Andy Wingo revert unfinished web.texi changes These were prematurely committed in 17072fd2c6acad1d4f2b5c98eb0d62911ea07406. 2011-01-07 Andy Wingo use scm_from_latin1_symboln for string literals and load-symbol * libguile/bytevectors.c: * libguile/eval.c: * libguile/goops.c: * libguile/i18n.c: * libguile/load.c: * libguile/memoize.c: * libguile/modules.c: * libguile/ports.c: * libguile/print.c: * libguile/procs.c: * libguile/programs.c: * libguile/read.c: * libguile/script.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/strings.c: * libguile/throw.c: * libguile/vm.c: Use scm_from_latin1_symboln to make symbols from string literals, because they aren't in the user's locale -- they are in ASCII, and we can optimize this case. * libguile/vm-i-loader.c: Also use scm_from_latin1_symboln when loading narrow symbols. 2011-01-07 Andy Wingo optimize scm_from_latin1_symboln * libguile/symbols.c (lookup_interned_latin1_symbol): New helper. (scm_from_latin1_symboln): Use lookup_interned_latin1_symbol, so we avoid allocating a string in that case. lookup_interned_symbol uses get_handle_by_hash * libguile/symbols.c (lookup_interned_symbol): Change to use scm_hash_fn_get_handle_by_hash. add scm_hash_fn_get_handle_by_hash * libguile/hashtab.h: * libguile/hashtab.c (scm_hash_fn_get_handle_by_hash): New internal procedure, which should make symbol table lookup faster. remove vector hash table code * libguile/hashtab.c: Remove deprecated hash-tables-as-vectors support code. hashtab cleanups * libguile/hashtab.c: Update comments. (hashtable_size): Allow bigger vectors on 64-bit machines. fix symbol garbage collection * libguile/symbols.c (lookup_interned_symbol, intern_symbol): Refactor to use hashtab.[ch] interfaces. add hash functions for locale, latin1, and utf8 strings * libguile/hash.c (scm_i_locale_string_hash) (scm_i_latin1_string_hash, scm_i_utf8_string_hash): New functions. multibyte regex error handling fix * libguile/regex-posix.c (fixup_multibyte_match): Fix mbrlen error handling. hash.c cleanup * libguile/hash.c (scm_hasher): Remove needless remember_upto_here. add scm_from_{latin1,utf8}_symbol{n,} * libguile/symbols.c (scm_from_latin1_symbol, scm_from_latin1_symboln) (scm_from_utf8_symbol, scm_from_utf8_symboln): New functions. 2011-01-07 Andy Wingo add scm_{to,from}_{utf8,latin1}_string{n,} * libguile/strings.h: * libguile/strings.c (scm_from_latin1_string, scm_to_latin1_string): New functions, in terms of the latin1_stringn variants. (scm_from_utf8_string, scm_from_utf8_stringn) (scm_to_utf8_string, scm_to_utf8_stringn): New functions. (scm_i_from_utf8_string, scm_i_to_utf8_string): Removed these internal functions. (scm_from_stringn): Handle -1 as a length. Unlike the previous behavior of scm_from_locale_string (NULL), which returned the empty string, we now raise an error. The null pointer is not the same as the empty string. * libguile/stime.c (scm_strftime, scm_strptime): Adapt to publishing of utf8 functions. 2011-01-07 Andy Wingo read-header returns EOF at end, update (web http) docs * doc/ref/web.texi (HTTP): Add an example for declaring a header, and adapt to read-header change. * module/web/http.scm (read-header): Return EOF for both values if there are no more headers, instead of #f. (read-headers): Adapt. 2011-01-07 Andy Wingo update URI documentation * doc/ref/web.texi (Types and the Web): Fix spacing. (URIs): Give default values, and clarify a number of procedure docs. Update "encoding" name, and string->uri name. uri-encode fast path * module/web/uri.scm (uri-encode): Add a fast-path for the common case in which the string does not contain any reserved characters. uri-decode #:encoding, not #:charset * module/web/uri.scm (call-with-encoded-output-string, encode-string) (decode-string, uri-decode, uri-encode): Change all instances of "charset" to "encoding", as variables and arguments. 2011-01-07 Andy Wingo rename string->uri and uri->string. * module/web/uri.scm (string->uri, uri->string): Rename from parse-uri and unparse-uri. * test-suite/tests/web-uri.test: * module/web/http.scm: All callers changed. 2011-01-07 Andy Wingo clarify uri fragment discussion * doc/ref/web.texi (URIs): Clarify the discussion of URI fragments. rewrite web.texi intro * doc/ref/web.texi (Web): Rewrite the intro. (Types and the Web): New subsection, a mini-rant. 2011-01-05 Ludovic Courtès Tiny style improvement in the ECMAScript compiler. Followup to 8891bd1b166b7210c241a0c1a730fc3af7f45b8a ("Fix ECMAScript object creation."). * module/language/ecmascript/compile-tree-il.scm (comp): Use `@implv' for `new-object'. Suggested by Kan-Ru Chen . 2011-01-05 Ludovic Courtès Change `getaddrinfo' test to handle the GNU-specific `EAI_NODATA'. * doc/ref/posix.texi (Network Databases): Mention `EAI_NODATA'. * libguile/net_db.c (scm_getaddrinfo): Likewise for the docstring. * test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Handle `EAI_NODATA'. 2011-01-04 Noah Lavine Fix ECMAScript object creation. * module/language/ecmascript/compile-tree-il.scm (compile-tree-il): generate correct tree-il for construction of new objects. * test-suite/tests/ecmascript.test (ecompile): Add pattern with EXPECTED omitted. ("compiler"): test whether we generate new objects correctly. 2011-01-04 Ludovic Courtès Document `scm_misc_error' (bug #31969). * doc/ref/api-control.texi (Handling Errors): Add `scm_misc_error'. Suggested by Bake Timmons (bug #31969). 2011-01-04 Ludovic Courtès Improve doc of `string-index', `string-index-right', and `string-rindex'. Suggested by Noah Lavine . * doc/ref/api-data.texi (String Searching): Mention the return value of `string-index', `string-index-right', and `string-rindex' when no match is found. * libguile/srfi-13.c (scm_string_index, scm_string_index_right, scm_string_rindex): Adjust docstring accordingly. 2010-12-23 Neil Jerram Manual typo fix * doc/ref/api-overview.texi (API Overview): bot -> but 2010-12-21 Ludovic Courtès Have `lookahead-u8' and `get-u8' actually do binary input. * libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_get_byte_or_eof' instead of `scm_peek_char'. (scm_get_u8): Likewise. * test-suite/tests/r6rs-ports.test ("7.2.8 Binary Input")["lookahead-u8"]: Fix typo. ["lookahead-u8 non-ASCII"]: New test. 2010-12-20 Ludovic Courtès Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'. See for details. * lib/unistr.in.h: Change #if's into #ifdef's. 2010-12-20 Ludovic Courtès Update Gnulib to v0.0-4544-gce083ca. 2010-12-18 Andy Wingo format handles ~@c better * module/ice-9/format.scm (format): Fix ascii-ism in ~@c. Pull flush-output? into the let*. more format tweaks * module/ice-9/format.scm (format): Strip format: prefix from port and output-col. more format tweaks * module/ice-9/format.scm (format): Move the port and output-col to let* vars, again removing a set!. We will probably move more state vars to the let*, to let the procedures exist in a more fixed-point style. take advantage of letrec* in format * module/ice-9/format.scm (format): Take advantage of letrec* internal expansion, and so have fewer set! invocations. inline format:out into format * module/ice-9/format.scm (format): Inline format:out into the body. more format cleanups * module/ice-9/format.scm (format): Remove the need to save a copy of the incoming arguments, because they are available as local variables. Do the check early for the format-string actually being a string. format's first arg is "destination" * module/ice-9/format.scm: The argument to format is "destination", not "port". Fix this newly reintroduced buglet. inline format:format into format * module/ice-9/format.scm (format): Inline format:format body. 2010-12-18 Andy Wingo deprecate omission of port to ice-9 format * module/ice-9/format.scm (format): Add port and format-string as formal arguments. Seems also to have triggered a reindent. Formally deprecate omitting the port, as it's usually an error. * test-suite/tests/format.test ("format basic output") ("format basic output", "~{ iteration"): Fix up tests that omitted the destination port. 2010-12-18 Andy Wingo letrec -> internal definitions in format.scm * module/ice-9/format.scm (format): Change from letrec to internal definitions, and use the define (foo ...) .. shorthand. No semantic change. format.scm cleanups * module/ice-9/format.scm (format:symbol-case-conv) (format:iobj-case-conv): Remove these exports, they were not used. (format:expch): Remove this one, though it was used. (format:floats, format:complex-numbers, format:radix-pref): Inline these "configuration variables" into the format body. ice-9 format license update * module/ice-9/format.scm: A more standard copyright header, with LGPLv3+ instead of public domain. Update define-module block. 2010-12-17 Ludovic Courtès Bump version number for 1.9.14. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Tweak `NEWS'. * NEWS: Update. futures: Store pending futures in a queue. * module/ice-9/futures.scm (%futures): Change from a list to a queue. (register-future!, process-futures, touch): Adjust accordingly. (unregister-future!): Remove. Clarify doc regarding threading of `par-map' and `par-for-each'. * doc/ref/api-scheduling.texi (Parallel Forms): Refine wording for `par-map' and `par-for-each'. 2010-12-17 Andy Wingo add www-commit rule in doc/ref * doc/ref/Makefile.am (www-commit): Add rule to update docs on web site. 2010-12-17 Ludovic Courtès Remove conflicting `scm_is_string' declaration. * libguile/strings.h: Move `scm_is_string' declaration... * libguile/inline.h: ... here. Reported by Noah Lavine . 2010-12-17 Andy Wingo fix unbound fluid tests * test-suite/tests/fluids.test: Fix tests. update NEWS * NEWS: Update. guile-user has no filename * module/ice-9/boot-9.scm (guile-user): Set #:filename to #f for guile-user module, as guile-user isn't really associated with any file. 2010-12-17 Andy Wingo add ,reload meta-command and document it and reload-module * module/ice-9/boot-9.scm (reload-module): Add docstring. * module/system/repl/command.scm (reload): New meta-command. * doc/ref/scheme-using.texi (Module Commands): Document the ,reload meta-command. * doc/ref/api-modules.texi (Module System Reflection): Document reload-module. 2010-12-17 Andy Wingo document variable-unset! * doc/ref/api-modules.texi (Variables): Document variable-unset!. * NEWS: Update. 2010-12-17 Andy Wingo document make-unbound-fluid et al * doc/ref/api-scheduling.texi (Fluids and Dynamic States): Document the new fluid routines. * NEWS: Update. 2010-12-17 Andy Wingo rename make-undefined-fluid to make-unbound-fluid * libguile/fluids.c (scm_make_unbound_fluid): Rename from scm_make_undefined_fluid. * libguile/fluids.h: * module/language/elisp/runtime.scm: Update referrers. 2010-12-17 Andy Wingo multicast manual updates * doc/ref/posix.texi (Network Sockets and Communication): Add IP_MULTICAST_TTL and IP_MULTICAST_IF docs, from the docstring. * NEWS: Update. 2010-12-17 Andy Wingo more web.texi "hacking" * doc/ref/web.texi (Web Server, Web Examples): Finish these sections. build-response validates headers * module/web/response.scm (build-response): Add some validation, like for build-request. 2010-12-16 Ludovic Courtès Implement `(ice-9 threads)' high-level constructs in terms of futures. * module/ice-9/threads.scm (parallel, par-mapper): Rewrite in terms of `future' and `touch'. * test-suite/tests/threads.test ("par-map", "par-for-each"): New test prefixes. * doc/ref/api-scheduling.texi (Parallel Forms): Add cross-ref to futures. Recommend against the `n-' variants. 2010-12-16 Ludovic Courtès futures: Support multiple-value returns. * module/ice-9/futures.scm (process-future!): Use `call-with-values' when invoking `(future-thunk future)'. * test-suite/tests/future.test ("futures")["multiple values"]: New test. 2010-12-16 Ludovic Courtès futures: Fix potential deadlock. * module/ice-9/futures.scm (process-futures): Fix potential deadlock, whereby %FUTURES-MUTEX would be acquired *after* FUTURE's mutex. Rehash weak hash tables less frequently. * libguile/hashtab.c (weak_bucket_assoc): Call `scm_i_rehash' only when REMAINING is below `SCM_HASHTABLE_LOWER (table)'. 2010-12-16 Ludovic Courtès Fix `hash' for pointer objects. Previously all pointer objects would hash to the same value. * libguile/hash.c (scm_hasher): Add case for `scm_tc7_pointer'. 2010-12-16 Ludovic Courtès Inline `scm_is_string'. * libguile/strings.c (scm_is_string): Move to... * libguile/inline.h (scm_is_string): ... here. Inline. 2010-12-16 Ludovic Courtès Add `compose', `negate', and `const'. * module/ice-9/boot-9.scm (compose, negate, const): New procedures. * doc/ref/api-procedures.texi (Higher-Order Functions): New node. * test-suite/Makefile.am (SCM_TESTS): Add `tests/procs.test'. * test-suite/tests/procs.test: New file. 2010-12-16 Andy Wingo update web-response tests for http header parsing change * test-suite/tests/web-response.test ("example-1"): Update for change in parsing Vary header. update NEWS * NEWS: Update for Web documentation. more web.texi work * doc/ref/web.texi (Requests, Responses): Flesh out. (Web Examples): New section, replacing "Web Handlers". The only one that's not really written yet. add section on format of parsed http headers * doc/ref/web.texi (HTTP Headers): New section. Needs some examples, though. 2010-12-16 Andy Wingo http: lists of header names parse better * module/web/http.scm (list-of-strings?, write-list-of-strings): Move definitions up. (split-header-names, list-of-header-names?, write-header-list): New helpers. (declare-header-list-header): New helper. (cache-control): Use split-header-names for private and no-cache. (trailer): Use declare-header-list-header to parse known headers to symbols. (vary): Likewise, use split-header-names et al. * test-suite/tests/web-http.test ("general headers"): Add a test. 2010-12-16 Andy Wingo better cache-control: private, no-cache parsing * module/web/http.scm (cache-control): Parse private and no-cache better. * test-suite/tests/web-http.test ("general headers"): Update. fix web.texi * doc/ref/web.texi: Texinfo syntax fixen! update web.texi * doc/ref/web.texi (URIs, HTTP): Update these sections. 2010-12-16 Andy Wingo add web.texi to manual * doc/ref/web.texi: New file, here to document the various (web ...) modules. Quite a rough beginning, but it is a start... * doc/ref/guile.texi: * doc/ref/Makefile.am: Add to manual. 2010-12-16 Andy Wingo (web server) docstrings * module/web/server.scm: Docstrings in the house. docstrings in (web request) and (web response) * module/web/request.scm: * module/web/response.scm: Add docstrings. (web http) docstrings * module/web/http.scm: Add docstrings all around. document (web uri), and simplify uri-encode * module/web/uri.scm: Add docstrings. (uri-encode): Simplify. Not sure what I was thinking before. 2010-12-13 Andy Wingo update NEWS * NEWS: Update. fix bugs in primitive-poll * libguile/poll.c (scm_primitive_poll): Only mark POLLOUT for output ports. Don't override results from the syscall, add to them. 2010-12-12 Andy Wingo fix testing code in web/server * module/web/server.scm (call-with-encoded-output-string): Fix some code I accidentally left in while testing. Re-tested the difference in speed; pleasantly surprised. * module/web/uri.scm: Make the same change here. 2010-12-12 Andy Wingo foreign: c-struct parsing simplification * module/system/foreign.scm: Revert much of fb636a1cce. Short et al are not distinct types -- they are all aliases to e.g. int16. The only case that was not covered before was the pointer case. (bytevector-pointer-ref, bytevector-pointer-set!): Implement these, and use them for pointers. 1.9.13 news to main body * NEWS: Fold 1.9.13 text into the main text. http-read robustness * module/web/server/http.scm (http-read): Record the client index in more cases in which code could throw an error. 2010-12-11 Andy Wingo (web uri) can uri-decode non-utf-8 payloads * module/web/uri.scm (call-with-encoded-output-string, encode-string): Copy from server.scm (decode-string): Copy from tekuti. (uri-decode): The #:charset arg is a string, like port-encoding. Support other charsets. (uri-encode): Charset is a string. Other encodings still not nicely supported. Hmm. 2010-12-10 Andy Wingo add return/values hack to compile-glil for lua * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add a hack like 'return but for multiple values, for lua. rnrs control only depends on (guile) * module/rnrs/control.scm: Depend only on (guile). 2010-12-10 Andy Wingo fix self-tail-calls for lexical procs with optional, rest, or kwargs * module/language/tree-il/compile-glil.scm (flatten-lambda): Don't emit a self-label, because when we can't match the args for a lexical call, we have no space to shuffle args and jump. (flatten): Apply the self-tail-call optimization to optional args too, but only if the procedure is fix-allocated. If we can't apply the optimization, use the normal tail-call sequence. * test-suite/tests/optargs.test ("lambda* inits"): Add tests. 2010-12-09 Andy Wingo clarify compile-glil error messages * module/language/tree-il/compile-glil.scm (vars->bind-list, flatten): Make internal self-checking error messages more clear, for implementors of other languages. 2010-12-07 Andreas Rottmann Get rid of `define-macro' in the SRFI 26 implementation * module/srfi/srfi-26.scm (cut, cute): Implement using `syntax-case'. The new implementation is mostly just a transcription of the old code; the reference implementation which relies only on `syntax-rules' may (or may not) be considered more elegant :-). 2010-12-07 Ludovic Courtès Use `current-processor-count' to determine the number of future-workers. * module/ice-9/futures.scm (%worker-count): Use `current-processor-count'. * doc/ref/api-scheduling.texi (Futures): Add note about side-effects and I/O. Mention `current-processor-count'. 2010-12-07 Ludovic Courtès Add `total-processor-count' and `current-processor-count'. * libguile/posix.c (scm_total_processor_count, scm_current_processor_count): New functions. * libguile/posix.h (scm_total_processor_count, scm_current_processor_count): New declarations. * test-suite/tests/posix.test ("nproc"): New test prefix. * doc/ref/posix.texi (Processes): Document `total-processor-count' and `current-processor-count'. 2010-12-07 Ludovic Courtès Improve doc of `getaffinity' and `setaffinity'. * doc/ref/posix.texi (Processes): Add cross-reference from `setaffinity' and `getaffinity' to the corresponding node in the glibc manual. * libguile/posix.c (scm_getaffinity, scm_setaffinity): Likewise. 2010-12-07 Ludovic Courtès Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'. See for details. * lib/unistr.in.h: Change #if's into #ifdef's. 2010-12-07 Ludovic Courtès Use Gnulib's `nproc'. This updates Gnulib to v0.0-4496-g6491120. * m4/gnulib-cache.m4: Add `nproc'. 2010-12-07 Ludovic Courtès Build dlopenable modules with `-module'. * test-suite/standalone/Makefile.am (libtest_asmobs_la_LDFLAGS, libtest_ffi_la_LDFLAGS, libtest_extensions_la_LDFLAGS): Add `-module'. Add a record type printer for vlists/vhashes. * module/ice-9/vlist.scm (): Add a record type printer. 2010-12-07 Brian Templeton lexical function binding for elisp * module/language/elisp/compile-tree-il.scm (access-variable) (reference-variable, set-variable!): Handle globally-bound non-special variables. (bind-lexically?): Create lexical bindings for flet and flet*. * module/language/elisp/runtime.scm (reference-variable, set-variable!): Handle globally-bound non-special variables. (built-in-func): Set the variable directly instead of storing the function in a fluid. * module/language/elisp/runtime/subrs.scm (funcall): Call apply directly. * test-suite/tests/elisp-compiler.test ("Function Definitions")["flet and flet*"]: 2010-12-07 Brian Templeton use unbound fluids instead of `void' sentinel value * module/language/elisp/compile-tree-il.scm (reference-with-check) (compile-without-void-checks, want-void-check?): Remove. (compile-function, compile-pair): Use `reference-variable' instead of `reference-with-check'. (compile-defvar): Only set `sym' if `sym' is not bound to a bound fluid, rather than requiring that its value be `void'. (process-options!): Remove `#:disable-void-check' option handling. * module/language/elisp/runtime.scm (void) (reference-variable-with-check): Remove. (ensure-fluid!): Use an undefined fluid as the initial value for global variables. * module/language/elisp/runtime/function-slot.scm (without-void-checks): Don't import or re-export. * module/language/elisp/runtime/macros.scm (prog1, cond, or, dolist): Don't use `without-void-checks'. * module/language/elisp/runtime/subrs.scm (symbol-value) (symbol-function, apply): Use `reference-variable' instead of `reference-variable-with-check'. (makunbound, fmakunbound, boundp, fboundp): Unset the variable's fluid (or the variable itself, if it isn't bound to a fluid). * test-suite/tests/elisp-compiler.test ("Variable Setting/Referencing")["disabled void check (all)", "disabled void check (symbol list)", "without-void-checks"]: Remove. 2010-12-07 Brian Templeton function's argument can be a symbol * module/language/elisp/compile-tree-il.scm (compile-function): the form `(function SYMBOL)' evaluates to the functional value of SYMBOL allow `(setcar nil nil)' and `(setcdr nil nil)' * module/language/elisp/runtime/subrs.scm (setcar, setcdr): Allow setting the car or cdr of `nil' to `nil'. support "#'" syntax for function expressions * module/language/elisp/lexer.scm (lex): * module/language/elisp/parser.scm (get-expression): Support sharpsign single-quote syntax as an abbreviation for `function' expressions. setq can take any number of arguments * module/language/elisp/compile-tree-il.scm (compile-setq): Return nil if called with no arguments, and set the last variable to nil if its value is omitted. 2010-12-07 Brian Templeton use correct names for quasiquotation operators Use #{`}#, #{,}# and #{,@}# as the quasiquote, unquote and unquote-splicing operators, respectively. Previously they were named escaping. * module/language/elisp/compile-tree-il.scm (unquote?): Change "\," to "#{,}#". (unquote-splicing): Change "\,@" to "#{,@}#". (#{compile-`}#): Rename from #{compile-\`}#. * module/language/elisp/runtime/function-slot.scm: Import #{compile-`}# instead of #{compile-\`}#, and re-export as #{`}# instead of as #{\`}#. * module/language/elisp/parser.scm (quotation-symbols): * test-suite/tests/elisp-compiler.test ("Eval", "Quotation"): * test-suite/tests/elisp-reader.test ("Parser"): Change "\`", "\,", and "\,@" to "#{`}#", "#{,}#" and "#{,@}#", respectively. 2010-12-07 Brian Templeton store special operators in the function slot If the function slot of a symbol contains a pair with `special-operator' in the car and a procedure in the cdr, the procedure is called to compile the form to Tree-IL. This is similar to other Emacs Lisp implementations, in which special operators are subrs. * module/language/elisp/compile-tree-il.scm: Restructured to store special operator definitions in the function slot. Import `(language elisp runtime)' for `defspecial'. Export special operators so that `(language elisp runtime function-slot)' can re-export them. (backquote?): Removed; the backquote symbol is defined as a special operator, so it's no longer used in `compile-pair'. (is-macro?, get-macro): Replaced by `find-operator'. (find-operator): New procedure. (compile-progn, compile-if, compile-defconst, compile-defvar, compile-setq, compile-let, compile-lexical-let, compile-flet, compile-let*, compile-lexical-let*, compile-flet*, compile-without-void-checks, compile-with-always-lexical, compile-guile-ref, compile-guile-primitive, compile-while, compile-function, compile-defmacro, compile-defun, #{compile-`}#, compile-quote): New special operators with definitions taken from the pmatch form in `compile-pair'. There is no special operator `lambda'; it is now a macro, as in other Elisp implementations. (compile-pair): Instead of directly compiling special forms, check for a special operator object in the function slot. * module/language/elisp/runtime.scm: Export `defspecial'. (make-id): New function. (built-in-macro): Prefix macros with `macro-'. (defspecial): New syntax. * module/language/elisp/runtime/function-slot.scm: Import and re-export special operators. Rename imported special operators and macros to remove prefixes. Re-export new macro `lambda'. * module/language/elisp/runtime/macros.scm (macro-lambda): New Elisp macro. 2010-12-07 Brian Templeton update elisp reader tests to handle EOF tokens * test-suite/tests/elisp-reader.test (lex-all, "end-of-input", "lexer/1"): Check for an EOF token instead of the symbol `*eoi*'. make user-defined macros available at runtime * module/language/elisp/compile-tree-il.scm (ensuring-globals): New procedure. (define-macro!): Remove. (compile-pair) : Make macro available at runtime, not only during compilation. (compile-tree-il): Use `ensuring-globals'. allow fluid macro bindings * module/language/elisp/compile-tree-il.scm (define-macro!, get-macro): Allow fluid macro bindings. new `load' subr * module/language/elisp/runtime/subrs.scm: Define new subr `load'. * module/language/elisp/runtime/function-slot.scm: Re-export `load'. Ignore #:warnings compiler option * module/language/elisp/compile-tree-il.scm (process-options!): Ignore #:warnings compiler option. handle EOF correctly in parser and lexer * module/language/elisp/lexer.scm (lex, get-lexer/1): Return a valid token at EOF. * module/language/elisp/parser.scm (get-expression): Raise an error if EOF is reached. (read-elisp): If at EOF, return the EOF object instead of attempting to read an expression. 2010-12-07 Brian Templeton store macro definitions in the function slot Guile Emacs Lisp previously kept macros in a separate macro slot; now macros are stored as macro objects in the function slot for compatibility with other implementations. * module/language/elisp/compile-tree-il.scm (macro-slot): Remove. (is-macro?): Check that the argument is a symbol. Now-unnecessary check removed in `compile-tree-il'. (macro?, define-macro!, get-macro): Store macro definitions in the function slot, not in a separate macro slot. * module/language/elisp/runtime.scm (built-in-macro): Wrap the macro function in a macro object (i.e., cons the symbol `macro' onto it). * module/language/elisp/runtime/function-slot.scm: Move contents to "subrs.scm". Re-export function and macro definitions instead of defining functions directly in this module. * module/language/elisp/runtime/macro-slot.scm: Move contents to "macros.scm" and remove. * module/language/elisp/runtime/macros.scm: New file containing macro definitions from "macro-slot.scm". * module/language/elisp/runtime/subrs.scm: New file containing function definitions from "function-slot.scm". 2010-12-07 Brian Templeton use existing bindings record for defmacro * module/language/elisp/compile-tree-il.scm (compile-pair): Use existing bindings record during macro definition. use tree-il's support for optional arguments * module/language/elisp/compile-tree-il.scm (compile-lambda): Use Tree-IL's support for optional arguments. (process-optionals, process-rest): Remove. make `pass-if-equal' literal in `compile-test' * test-suite/tests/elisp-compiler.test (compile-test): Add `pass-if-equal' to the list of literal identifiers reindent * module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: * module/language/elisp/spec.scm: Reindent. reformat comments * module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: * module/language/elisp/runtime/value-slot.scm: Reformat comments. whitespace changes * module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: Ensure that all top-level forms and comments are separated by exactly one newline. Remove blank lines in most procedure bodies. Delete trailing whitespace. autoload compile-file in (guile-user) * module/ice-9/boot-9.scm (guile-user): Autoload `compile-file'. variable-unset! * libguile/variable.c (scm_variable_unset_x): New function. * libguile/variable.h (scm_variable_unset_x): New prototype. 2010-12-07 Brian Templeton unbound fluids * libguile/fluids.c (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New functions. (fluid_ref): New function; like scm_fluid_ref, but will not throw an error for unbound fluids. (scm_fluid_ref, swap_fluid): Use `fluid_ref'. * libguile/fluids.h (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New prototypes. * libguile/vm-i-system.c (fluid_ref): If fluid is unbound, jump to `vm_error_unbound_fluid'. * libguile/vm-engine.c (VM_NAME)[vm_error_unbound_fluid]: New error message. * test-suite/tests/fluids.test ("unbound fluids")["fluid-ref of unbound fluid", "fluid-bound? of bound fluid", "fluid-bound? of unbound fluid", "unbound fluids can be set", "bound fluids can be unset"]: New tests. 2010-12-07 Andy Wingo better unbound variable errors in the vm * libguile/vm-i-system.c (variable-ref, toplevel-ref) (long-toplevel-ref): Fixup callers. * libguile/vm-engine.c (vm_error_unbound): Don't use vm-error for unbound vars, use misc-error. Don't include VM: in the string. Take the name directly in finish_args, not as a list. 2010-12-07 Brian Templeton make guile-test work without configuration * test-suite/guile-test: Use "../meta/guile" as the interpreter instead of "../libguile/guile". (default-test-suite): New function, replacing the variable of the same name. Look for tests in the same directory as the guile-test script. Throw an error if not invoked as `guile-test'. (test-suite): The old default value of `default-test-suite' could now throw an error, and this already gets initialized in `main', so don't provide an initial value. 2010-12-07 Neil Jerram Put `figures' into standard texinfo form * doc/ref/goops.texi (Example, Inheritance): Remove unnecessary figure references. Use @float and @ref. (Class precedence list): Ditto. 2010-12-06 Neil Jerram Merge `tutorial' and `reference' treatments of the same basic GOOPS material * doc/ref/goops.texi (GOOPS): Move use of (oop goops) here. (Class Definition): Merged with `Defining New Classes' (Instance Creation): Insert before covering slot options. Merge in material from `Creating Instances'. (Slot Options): Merged some better wording and index entries from the tutorial version. (Slot Description Example): New node, containing the material from the tutorial. (Methods and Generic Functions, Inheritance): Tutorial sections moved into main line of the manual. * doc/ref/goops-tutorial.texi: Nothing left here now. 2010-12-06 Neil Jerram Minor textual markups * doc/ref/goops-tutorial.texi (Class definition): No reason to assume particular familiarity with CLOS. (Instance creation and slot access): Remove a couple of words. 2010-12-06 Andy Wingo scm_setvbuf doesn't throw away current buffers * libguile/ports.c (scm_drain_input): Slight optimization. * libguile/fports.c (scm_setvbuf): If there is buffered output, flush it. If there is input, drain it, and then unread it after updating the buffers. Much more sensible than dropping it silently... 2010-12-06 Andy Wingo http-read calls setvbuf only once * module/web/server/http.scm (http-read): Don't play the setvbuf dance, it was throwing away buffered input. Instead just call setvbuf once before doing any reads or writes. 2010-12-06 Andy Wingo ice-9 poll handles buffered io too * libguile/poll.c (scm_primitive_poll): Account for buffered I/O. * module/ice-9/poll.scm (poll): Adapt to call primitive-poll with the port vector too. 2010-12-06 Andy Wingo fix name... * module/web/request.scm (read-request-body/latin-1): Fix name... fix read-{request,response}-body/latin-1 * module/web/request.scm (read-response-body/latin-1): * module/web/response.scm (read-response-body/latin-1): Avoid the craziness of the read-delimited! interface and hand-roll our own. Fixes errors if read-delimited returns #f or EOF. update read-delimited! docs * doc/ref/api-io.texi (Line/Delimited): Update the read-delimited! docs. 2010-12-06 Andy Wingo leniency regarding quality values in http.scm * module/web/http.scm: Add commentary. (parse-quality): Allow .NNN to be interpreted as 0.NNN. * test-suite/tests/web-http.test ("request headers"): Add a test. 2010-12-06 Andy Wingo fix entity tag writing * module/web/http.scm (write-entity-tag): Fix writing of entity tags (strong versus weak). more robustness in http-read * module/web/server/http.scm (http-read): If there was an error reading the request, be sure to close the request port. 2010-12-05 Andy Wingo http doesn't keep-alive requests for which there was an error * module/web/server/http.scm (keep-alive?): Don't keep the client around if there is an error. 2010-12-04 Andy Wingo (web server http) comment * module/web/server/http.scm: Add comment about charsets. fix error handling in read-{request,response}-body/latin-1 * module/web/request.scm (read-request-body/latin-1): * module/web/response.scm (read-response-body/latin-1): Detect short reads instead of returning a full buffer with the last bits zeroed out. (Before the make-string commit, they contained uninitialized memory, which was a fairly serious error.) 2010-12-04 Andy Wingo make-string et al nulls memory if not given an initializer * libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the memory block, so users need to make sure it is initialized. * libguile/bitvectors.c (scm_c_make_bitvector): * libguile/bytevectors.c (scm_make_bytevector): * libguile/strings.c (scm_c_make_string): If no initializer is given, initialize the bytes to 0. Prevents information leakage if an app uses make-string et al without initializers. * libguile/foreign.c (make_cif): Initialize this too, to prevent leakage in the struct holes. Paranoia... 2010-12-03 Andy Wingo read-delimited is clearer and conses less * module/ice-9/rdelim.scm (read-delimited): Clarify and somewhat optimize implementation. http server impl reads body as a bytevector by default * module/web/server/http.scm (http-read): Read body as a bytevector by default. That way we punt encoding issues to the app. remove redundant error-handling block * module/web/server/http.scm (http-read): No need for a call-with-error-handling block here, as the read impl is itself within an error-handling block. web server micro-tuning * module/web/server/http.scm (http-open): Allow up to 128 pending connections -- the default value for somaxconn on a number of machines. This is from the HOP paper. (http-read): Set the send buffer to 12 KB, also from the HOP paper. reverse order of poll-set traversal in http-read * module/web/server/http.scm (http-read): Rewrite to iterate down the pollset, so the vector shuffles touch less memory and the end condition of the loop is clearer. 2010-12-03 Andy Wingo (web server) punts keep-alive to impls; http server uses (ice-9 poll) * module/web/server.scm: Rewrite to remove the extra "keep-alive" parameter. Instead, since the server is an essentially stateful object, have clients that want to do keep-alive manage that set as part of the server state. Also avoids imposing a particular data structure on the server implementation. * module/web/server/http.scm: Adapt to the new server interface. Also, use a poll set instead of select and lists. Makes handling 1000 clients at a time much more possible. 2010-12-03 Andy Wingo ASYNC_TICK after catching EINTR in SCM_SYSCALL * libguile/_scm.h (SCM_SYSCALL): As in scm_syserror, do a SCM_ASYNC_TICK before resuming the syscall after an EINTR. 2010-12-03 Andy Wingo add (ice-9 poll), a poll wrapper * libguile/poll.c: * libguile/poll.h: * module/ice-9/poll.scm: New module, (ice-9 poll). * module/Makefile.am: * libguile/init.c: * libguile/Makefile.am: Adapt. * configure.ac: Check for poll.h and poll. 2010-12-03 Ludovic Courtès Add `(ice-9 futures)'. * doc/ref/api-scheduling.texi (Threads): Add short introduction. Mention the `threads' feature. Add cross-reference to futures. (Futures): New node. * module/Makefile.am (ICE_9_SOURCES): Add `ice-9/futures.scm'. * module/ice-9/futures.scm: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/future.test'. * test-suite/tests/future.test: New file. 2010-12-03 Ludovic Courtès Add bindings to GNU `sched_setaffinity' and `sched_getaffinity'. * configure.ac: Add checks for `sched_setaffinity' and `sched_getaffinity'. * doc/ref/posix.texi (Processes): Document `getaffinity' and `setaffinity'. * libguile/posix.c (cpu_set_to_bitvector, scm_getaffinity)[HAVE_SCHED_GETAFFINITY]: New functions. (scm_setaffinity)[HAVE_SCHED_SETAFFINITY]: New function. * libguile/posix.h (scm_getaffinity, scm_setaffinity): New declarations. * test-suite/tests/posix.test ("affinity"): New test prefix. 2010-12-02 Andy Wingo no need for fport_fill_input to select() before read() * libguile/fports.c (fport_fill_input): Likewise to the previous commit, no need to select() before read(). scm_accept no longer leaves guile mode * libguile/socket.c (scm_accept): Revert 7d1fc8721724ab64ccdc44d6f4f84abad43751b4. Now that we don't need to leave guile mode in order for GC to happen, don't do so, as we assume that anyone who cares has already done a select() beforehand. sxml->xml fix * module/sxml/simple.scm (attribute-value->xml): Whoops, fix null case. sxml->xml writes directly to a port * module/sxml/simple.scm: Remove "universal-sxslt-rules" -- it was a bad interface, and I couldn't find any users of it. (sxml->xml): Rewrite so that instead of generating another tree of data, we write the data directly to a port. add some debugging to (web server) * module/web/server.scm: Add some basic elapsed-time debugging, but only if you flip a switch to turn it on at expand-time. better socket buffering on http web server backend * module/web/server/http.scm (http-read, http-write): Line-buffer the port while we're reading the request, and block-buffer it otherwise Use the default block size. indentation fix in ports.c * libguile/ports.c (scm_i_get_conversion_strategy): Indentation fix. (web server) supports non-utf-8 charsets * module/web/server.scm (sanitize-response): Support charsets other than utf-8. Oddly collecting a string and converting it to utf-8 appears to be faster than collecting a utf-8 bytevector directly. 2010-12-02 Andy Wingo add simple web app examples * examples/web/hello.scm: * examples/web/debug-sxml.scm: New examples, for simple web applications. * examples/README: * examples/Makefile.am: Add new files. 2010-12-01 Andy Wingo http web server impl ignores SIGPIPE * module/web/server/http.scm (http-open): Ignore SIGPIPE. Keeps the server from dying in some circumstances. 2010-12-01 Andy Wingo stub fixes to http 1.0 support in the web server * module/web/server.scm (read-client): Fix number of returned values in the case in which there is an error reading the client. (sanitize-response): Add a case to adapt the reponse to the request version. (handle-request): Sanitize the response within an error-handling block. (serve-one-client): Move sanitation out of here. * module/web/server/http.scm (keep-alive?): A more proper detection on whether we should support persistent connections. * module/web/response.scm (adapt-response-version): New routine, to adapt a response to a given version. Currently a stub. 2010-11-25 Andreas Rottmann Some tweaks to the R6RS support * module/rnrs/base.scm (error, assert): Define -- they were missing. (assertion-violation): Properly treat a #f `who' argument. * module/rnrs/conditions.scm (condition): Use `assertion-violation' instead of the undefined `raise'. (define-condition-type): Fix for multiple fields. * test-suite/tests/r6rs-conditions.test: Test accessors of a multiple-field condition. Also import `(rnrs base)' to allow stand-alone running of the tests; apparently the `@' references scattered throughout the R6RS modules make the libraries sensitive to their load order -- for instance, trying to load `(rnrs conditions)' before `(rnrs base)' is loaded fails. * module/rnrs/records/inspection.scm: Use `assertion-violation' instead of an explicit `raise'. * module/rnrs/records/syntactic.scm (process-fields): Use `syntax-violation' instead of bogus invocations of `error'. 2010-11-24 Ludovic Courtès Fix `regexp.test' when the "en_US.utf8" locale isn't available. * test-suite/tests/regexp.test ("nonascii locales"): Move `with-locale' within the body of `pass-if' so that `unresolved' is caught. 2010-11-24 Ludovic Courtès Honor R6RS transcoder error handling modes, when possible. * module/rnrs/io/ports.scm (transcoded-port): Change RESULT's conversion strategy based on TRANSCODER's error-handling mode. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]", "transcoded-port [error handling mode = replace]"]: New tests. 2010-11-24 Andreas Rottmann Add implementation of "transcoded ports" * libguile/r6rs-ports.c (make_tp, tp_write, tp_fill_input, tp_flush) (tp_close, initialize_transcoded_ports, scm_i_make_transcoded_port): New functions. (scm_init_r6rs_ports): Call `initialize_transcoded_ports'. * module/rnrs/ports.scm (transcoded-port): Actually implement, using `%make-transcoded-port'. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports"): Added a few tests for `transcoded-port'. 2010-11-24 Andreas Rottmann Work towards a more complete implementation of `(rnrs io ports)' * module/rnrs/io/ports.scm: (file-options, buffer-mode, eol-style) (error-handling-mode, make-transcoder, native-transcoder) (latin-1-codec, utf-8-codec, utf-16-codec) (call-with-bytevector-output-port, open-file-input-port) (open-file-output-port, make-custom-textual-output-port) (flush-output-port, put-char, put-datum, put-string, get-char) (get-datum, get-line, get-string-all, lookahead-char) (standard-input-port, standard-output-port, standard-error-port): Define all of these. (call-with-port): Don't use `dynamic-wind', as it is against its specification in R6RS 8.2.6. * module/rnrs.scm: Export procedures added. * module/rnrs/io/simple.scm (call-with-input-file) (call-with-output-file): Define these in terms of R6RS procedures to get correct exception behavior. 2010-11-24 Andreas Rottmann Reorganize the R6RS I/O condition types Move the I/O condition types from `(rnrs conditions)', where they were not exported, to `(rnrs files)', where they are. * module/rnrs/conditions.scm: Remove definition of I/O condition types. * module/rnrs/files.scm: Replace references to I/O condition types inside `(rnrs conditions)' with the actual definitions. * module/rnrs/io/simple.scm: Don't `@@'-reference the I/O condition types, just imported them from `(rnrs files)'. 2010-11-24 Andreas Rottmann Turn `(rnrs io ports)' into an R6RS library * module/rnrs/io/ports.scm: Change into an R6RS library from a "regular" Guile module, so the bookkeeping for #:re-export and #:replace is done automatically and we gain control over the imports from `(guile)'. 2010-11-23 Andy Wingo fix regexp matches to refer to chars, not bytes * libguile/regex-posix.c (fixup_multibyte_match): Fixup the match structure to refer to character offsets, not byte offsets. Fixes bug 31650. * test-suite/tests/regexp.test: Add a test. 2010-11-23 Andy Wingo fix web server bugs * module/web/http.scm (valid-quality?): * module/web/server.scm (sanitize-response): Fix a couple bugs. 2010-11-22 Andy Wingo fix up a couple content-length issues in web/server.scm:sanitize-response * module/web/server.scm (sanitize-response): Allow body to be #f. Don't require or insert a content-length if there is no body. 2010-11-21 Julian Graham Enumeration set universe comparisons should be done with `equal?' * module/rnrs/enums.scm (enum-set-union, enum-set-intersection, enum-set-difference): Compare enum-set universes with `equal?' to support sets generated using constructor syntax bound by `define-enumeration'. * test-suite/tests/r6rs-enums.test (enum-set-union, enum-set-intersection, enum-set-difference): New test cases for syntactically-generated sets. 2010-11-20 Andreas Rottmann Fix missing port-table locking and bytevector output port segfault * libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Lock the port table. * libguile/r6rs-ports.c (make_bop): Let the returned extraction procedure refer to the port's buffer instead of the port itself. This fixes a segfault if the port is closed before the extraction procedure is called. (bop_proc_apply): Adapt accordingly. * test-suite/tests/r6rs-ports.test (8.2.10 Output ports): Add testcase for extraction after close. 2010-11-20 Andreas Rottmann Allow user-defined meta-commands Besides allowing user-defined meta-commands, this change also refactors the meta-command machinery to split reading a command's arguments from the procedure actually implementing it, and hence allows nesting meta-commands. As an example of such a command, ",in" is added as a new meta-command. * module/system/repl/command.scm: Export `define-meta-command'. (*command-module*): Replaced by the hash table `*command-infos*'. (command-info, make-command-info, command-info-procedure) (command-info-arguments-reader): New procedures, encapsulating the information about a meta-command. (command-procedure): Adapted to use the `command-info' lookup procedure. (read-command-arguments): New auxiliary procedure invoking a command's argument reader procedure. (meta-command): Adapted to the split of reading arguments and executing a command. (add-meta-command!): New auxiliary procedure, registers a meta command's procedure and argument reader into `*command-infos* and `*command-table*. (define-meta-command): Extended to allow specification of the command's category; split the argument reader and actual command procedure. (guile:apropos, guile:load, guile:compile-file, guile:gc): Remove these aliases, they are unnecessary as we now use a hash table instead of the module to store the commands. (in): New meta-command, which evaluates an expression, or alternatively executes another meta-command, in the context of a specific module. * doc/ref/scheme-using.texi (Module Commands): Document the `in' meta-command. 2010-11-20 Andy Wingo announce flex version in autogen.sh * autogen.sh: Announce flex version. Has the side-effect of checking for flex when building from git. 2010-11-20 Andreas Rottmann Allow specifying load extensions on the command line Add a new command-line switch `-x', which manipulates the %load-extensions list. * libguile/script.c (scm_compile_shell_switches): Process the new "-x" switch. (scm_shell_usage): Mention the "-x" switch. * doc/ref/scheme-scripts.texi (Invoking Guile): Add "-x" switch to the list of command-line switches. 2010-11-20 Ludovic Courtès Use `define-module*' in (ice-9 history). * module/ice-9/history.scm: Use `define-module*' instead of `process-define-module'. 2010-11-19 Andy Wingo bump objcode version * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the process-define-module deprecation means that outside compiled code won't find process-define-module in the (guile) module, as they would before. 2010-11-19 Andy Wingo fix string-filter and string-delete argument order * libguile/srfi-13.h: * libguile/srfi-13.c (scm_string_filter, scm_string_delete): Swap char_pred and s argument order, to comply with SRFI-13. There is a back-compat shim that will detect programs that used the old, erroneous interface, while giving a warning. * doc/ref/api-data.texi: Update docs. 2010-11-19 Andy Wingo deprecate process-define-module * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (process-define-module): Deprecate. define-module compiles to define-module* * module/ice-9/boot-9.scm (define-module): Compile down to a call to define-module*, not process-define-module. scm_c_define_module uses define-module* * libguile/modules.c (scm_c_define_module): * module/ice-9/boot-9.scm: Update to have the C function call define-module*. make module definition procedure more structured * module/ice-9/boot-9.scm (define-module*): New procedure, like process-define-modules but more structured. (process-define-module): Reimplement in terms of define-module*. relax sizeof(long) restriction in configure.ac * configure.ac: Relax the sizeof(long)==sizeof(void*) restriction, instead asserting that the sizeof(long)<=sizeof(void*). There will still be problems on nonstandard platforms related to the interface with gmp, but those are confined to numbers.c. 2010-11-19 Andy Wingo fix a number of assuptions that a long could hold an inum * libguile/bytevectors.c: * libguile/goops.c: * libguile/instructions.c: * libguile/numbers.c: * libguile/random.c: * libguile/read.c: * libguile/vm-i-scheme.c: Fix a number of assumptions that a long could hold an inum. This is not the case on platforms whose void* is larger than their long. * libguile/numbers.c (scm_i_inum2big): New helper, only implemented for sizeof(void*) == sizeof(long); produces a compile error on other platforms. Basically gmp doesn't have a nice interface for converting between mpz values and intmax_t. 2010-11-19 Andy Wingo simpos tweak * libguile/simpos.c (scm_system_star): Use scm_from_ulong, as we do cast to ulong. fix a number of assumptions that a pointer could fit into a long * libguile/debug.c: * libguile/eval.c: * libguile/frames.c: * libguile/objcodes.c: * libguile/print.c: * libguile/programs.c: * libguile/read.c: * libguile/struct.c: * libguile/vm.c: Fix a number of instances in which we assumed we could fit a pointer into a long. 2010-11-19 Ludovic Courtès Fix incorrect uses of en-dashes and em-dashes in the intro. * doc/ref/intro.texi (Introduction): Use commas instead of en-dashes around "for example". Use em-dashes instead of en-dashes around parenthetical phrases. Remove spaces around em-dashes. 2010-11-19 Ludovic Courtès Include wherever `alloca' is used. Patch provided by (tiny change). * libguile/control.c, libguile/fluids.c, libguile/foreign.c, libguile/hashtab.c, libguile/strings.c: Include . 2010-11-19 Ludovic Courtès Optimize fixnum comparison. * libguile/vm-i-scheme.c (REL): Don't untag X and Y since tagging preserves ordering. Add fixnum arithmetic benchmarks. * benchmark-suite/benchmarks/arithmetic.bm ("fixnum")["*", "/"]: New benchmarks. 2010-11-19 Ludovic Courtès Add optimized tagged integer addition/subtractions for x86_64. This results in a 17% improvement in the execution time of the "+" and "-" benchmarks for fixnums. * libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB)[defined __x86_64__ && SCM_GNUC_PREREQ (4, 5)]: New macros. (add)[defined ASM_ADD]: Use `ASM_ADD' for the fast path. (sub)[defined ASM_SUB]: Use `ASM_SUB' for the fast path. * test-suite/tests/numbers.test ("+")["fixnum + fixnum = bignum (32-bit)", "fixnum + fixnum = bignum (64-bit)", "bignum + fixnum = fixnum", "wrong type"]: New tests. ("-")["fixnum - fixnum = bignum (32-bit)", "fixnum - fixnum = bignum (64-bit)", "bignum - fixnum = fixnum", "wrong type"]: New tests. * test-suite/tests/00-initial-env.test ("goopsless")["+ wrong type argument"]: Use `with-test-prefix/c&e' instead of `with-test-prefix'. ["- wrong type argument"]: New test prefix. 2010-11-19 Ludovic Courtès Use the `with-test-prefix/c&e' for the `1+' and `1-' tests. * test-suite/tests/numbers.test ("1+"): Use `with-test-prefix/c&e' instead of `with-test-prefix'. Provide a name to each `pass-if' invocation. ("1-"): Likewise. Move `with-test-prefix/c&e' to `(test-suite lib)'. * test-suite/tests/bytevectors.test (c&e, with-test-prefix/c&e): Move... * test-suite/lib.scm: ... here. (with-test-prefix): Rewrite using `syntax-rules'. Add `SCM_GNUC_PREREQ'. * libguile/__scm.h (SCM_GNUC_PREREQ): New macro. Use it in this file in lieu of hand-written GCC version tests. 2010-11-18 Andy Wingo add `reload-module' to boot-9 * module/ice-9/boot-9.scm (reload-module): New procedure, programmatically reloads the source file corresponding to the given module. numbers.test expects lower-case hexadecimals * test-suite/tests/numbers.test ("number->string"): Expect lower-case hexidecimals. read-set! takes effect at expand time * module/ice-9/boot-9.scm (define-option-interface): The set! command goes in an eval-when to be run at expand-time, so that (read-set! keywords 'prefix) does what it used to in 1.8 (mostly). 2010-11-18 Andy Wingo repl read/write using current ports, not captured ports Fixes bug in repl meta-commands after activating readline, which changes the current input port. * module/system/repl/common.scm (): Remove inport and outport fields. (make-repl): Adapt. (repl-read, repl-print): Just read and write to the current ports. * module/system/repl/repl.scm (meta-reader): Meta-read from the current input port. * module/system/repl/command.scm (read-command, define-meta-command): Read from the current input port. 2010-11-18 Andy Wingo lower-case hexadecimal digits again * libguile/numbers.c: Default to lower-case hexadecimal digits again. better errors for ecmascript parser too * module/language/ecmascript/parse.scm (syntax-error): Better errors here too. ecmascript tokenization errors report source location * module/language/ecmascript/tokenize.scm (syntax-error): Report source locations. Adapt all callers to pass source locations. add source-location->source-properties to lalr * module/system/base/lalr.scm (source-location->source-properties): New public function, to produce source properties that can be given to the compiler. more ecmascript testing * test-suite/tests/ecmascript.test (eread/1, parse): Also check read-ecmascript/1, which uses tokenize/1. fix ecmascript at the repl * module/language/ecmascript/tokenize.scm (syntax-error): Reorder args to throw vals in the right order. (make-tokenizer/1): Fix. Broken since the lalr refactor... repl.scm displays syntax errors on read as well * module/system/repl/repl.scm (prompting-meta-read): Use display-syntax-error as appropriate. 2010-11-18 Andy Wingo deprecate cuserid * libguile/posix.c: * libguile/posix.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only returns 8 bytes of a user's login. * doc/ref/posix.texi: Remove cuserid from docs. 2010-11-18 Andy Wingo adapt tests to new syntax-error form * test-suite/tests/syntax.test (pass-if-syntax-error): Fix up for new form of syntax errors. Adapt all tests. * test-suite/tests/srfi-17.test: Likewise. 2010-11-17 Julian Graham Add exports for missing functions from `(rnrs base)'. * module/rnrs.scm (boolean=?): New export. Fix typo in export of`integer-valued?'. * module/rnrs/base.scm: Add exports for `exact' and `inexact'. (boolean=?, symbol=?, infinite?, finite?, exact-integer-sqrt, integer-valued?, rational-valued?, real-valued?): New functions. * test-suite/tests/r6rs-base.test (boolean=?, symbol=?, infinite?, finite?, exact-integer-sqrt, integer-valued?, rational-valued?, real-valued?): New test prefixes and tests. 2010-11-16 Andy Wingo fix the C syntax-error pretty-printer * libguile/throw.c (handler_message): Fix up a bit. 2010-11-16 Andy Wingo add proper pretty-printing for syntax errors * module/system/repl/repl.scm (display-syntax-error): New helper, displays a syntax error. (abort-on-error, run-repl): Use it. * libguile/throw.c (handler_message): Re-code the same thing in C. 2010-11-16 Andy Wingo remove syntax-error and call-with-compile-error-catch from compile.scm * module/system/base/compile.scm: Remove unused syntax-error and call-with-compile-error-catch exports. ecmascript syntax errors throw to 'syntax-error * module/language/ecmascript/parse.scm (syntax-error): * module/language/ecmascript/tokenize.scm (syntax-error): Throw to 'syntax-error as psyntax does. 2010-11-16 Andy Wingo syntax-violation uses lambda*, throws a structured message * module/ice-9/psyntax.scm (syntax-violation): Use lambda* for subform arg. Instead of using scm-error, just throw to 'syntax-error with all we got. * module/ice-9/psyntax-pp.scm (#{and-map*\ 37}): Regenerated. 2010-11-15 Andy Wingo fix string->number for bases > 16 * libguile/numbers.c (scm_iuint2str): Add an assertion on the domain of the radix. Use the number_chars table to write the string, instead of doing strange math. Same effect, though. (mem2uinteger, char_decimal_value): Change logic to allow all ascii alphabetic chars as decimals, not just a-f. Thanks to Nils Gey for the report. * test-suite/tests/numbers.test ("number->string"): Add some tests. 2010-11-14 Neil Jerram Expression-oriented readline history * guile-readline/ice-9/readline.scm (make-readline-port): Instead of calling add-history after every %readline call, do it only when starting a new read. Other times, append the line just read to an internal buffer. 2010-11-13 Andy Wingo flesh out (web server)'s sanitize-response * module/web/server.scm (sanitize-response): Flesh out. If we get a string, we encode it to a bytevector using the encoding snarfed from the response. We should check the request, though... add extend-response. * module/web/response.scm (extend-response): New utility. 2010-11-13 Andy Wingo (web http) parses content-type as "foo/bar", not "foo" "bar" * module/web/http.scm (parse-media-type, validate-media-type, (content-type): Change to represent media types as ("foo/bar" ("param" . "val") ...) instead of ("foo" "bar" ("param" . "val") ...). Seems to be more in line with what people expect. * test-suite/tests/web-http.test ("entity headers"): Add content-type test. * test-suite/tests/web-response.test ("example-1"): Adapt expected parse. 2010-11-12 Andy Wingo NUL vs NULL fix * libguile/read.c (scm_i_scan_for_encoding): Fix NUL rather than NULL. remove (web toy-server) * module/Makefile.am * module/web/toy-server.scm: Remove. It's not so much that the new (web server) stuff is not a toy, it's that users are expected to use the new backends (mod-lisp, etc) in "production". 2010-11-12 Andy Wingo add generic web server with http-over-tcp backend * module/web/server.scm: New generic web server module, with support for different backends. An HTTP-over-TCP backend is the only one included with Guile, though one can imagine FastCGI, mod-lisp, mongrel2/0mq etc backends as well. * module/web/server/http.scm: The aforementioned HTTP backend. 2010-11-12 Andy Wingo add request-meta * module/web/request.scm (): Add `meta' field and accessor, for metadata like the server IP, the client IP, CGI environment variables, etc. (build-request): Add meta kwarg. (read-request): Add meta optional arg. (write-request): Adapt. more (web http) exports for parsing request components * module/web/http.scm (lookup-header-decl): New exported function. (parse-http-version, parse-http-method, parse-request-uri): Export these functions. call-with-error-handling pass-keys w/ procedural handlers fix * module/system/repl/error-handling.scm (call-with-error-handling): Respect the pass-keys set for procedural on-error and post-error handlers. unparse-uri avoids serializing e.g. :80 in http:// uris * module/web/uri.scm (declare-default-port!): New function, declares a default port for a scheme. Predeclare default ports for http and https. (unparse-uri): If the port is the default port for the given scheme, don't serialize the port part of the URI. 2010-11-12 Julian Graham Fix buffer over-read in port encoding scan. * libguile/read.c (scm_i_scan_for_encoding): Add a NULL terminator to the end of header to prevent over-read by subsequent call to strstr. 2010-11-11 Ludovic Courtès Add FFI tests for `sizeof' and structs. * test-suite/tests/foreign.test ("structs")["sizeof { int8, double }", "sizeof { short, int, long, pointer }"]: New tests. 2010-11-11 Ludovic Courtès Add FFI support for `short' and `unsigned short'. * libguile/foreign.c (sym_short, sym_unsigned_short): New variables. (scm_init_foreign): Define Scheme variables SYM_SHORT and SYM_UNSIGNED_SHORT. * module/system/foreign.scm (short, unsigned-short): New exports. (integer-ref, integer-set): Support (= (sizeof TYPE) 2). (%read-short, %write-short!, %read-unsigned-short, %write-unsigned-short!): New variables. (*writers*): Add support for `short' and `unsigned-short'. (*readers*): Likewise. * test-suite/tests/foreign.test ("structs")["int8, pointer, short, double"]: New test. 2010-11-11 Ludovic Courtès Have `parse-c-struct' and `make-c-struct' support `int', pointers, etc. Reported by Tristan Colgate . * module/system/foreign.scm: Call `load-extension' at compile-time too. (compile-time-value): New macro. (integer-ref, integer-set): New procedures. (define-integer-reader, define-integer-writer): New macros. (%read-int, %read-long, %write-int!, %write-long!, %read-unsigned-int, %read-unsigned-long, %write-unsigned-int!, %write-unsigned-long!, %read-size_t, %write-size_t!, %read-pointer, %write-pointer!): New procedures. (*writers*): Add writers for `int', `unsigned-int', `long', `unsigned-long', `size_t', and `*'. (*readers*): Likewise. * test-suite/tests/foreign.test ("structs")["int8, pointer", "unsigned-long, int8, size_t", "long, int, pointer"]: New tests. 2010-11-11 Ludovic Courtès FFI: Honor alignment constraints in `parse-c-struct'. * module/system/foreign.scm (parse-c-struct): Honor alignment constraints for TYPE. * test-suite/tests/foreign.test ("structs")["alignment constraints honored"]: New test. 2010-11-09 Michael Gran Use ellipsis character in truncated pretty-print of sequences * module/ice-9/pretty-print.scm (print-sequence): use ellipsis when available 2010-11-08 Mike pretty-print print-sequence width error Avoid the "expected a positive width" display error when printing sequences with no width remaining. * module/ice-9/pretty-print (print-sequence): test for zero width when printing sequences 2010-11-07 Ludovic Courtès Fix `reader.test'. This is a followup to a4e472294423bb796db3132c73027384fdfff820 ("need read error for extra closing square brackets".) * test-suite/tests/reader.test (exception:unexpected-rsqbracket): New variable. ("reading")["paren mismatch (2)"]: Change exception type to EXCEPTION:UNEXPECTED-RSQBRACKET. ["paren mismatch (3)", "paren mismatch (4)"]: New tests. ("mismatching parentheses")["closing square bracket following mismatched opening"]: New test. 2010-11-07 Ludovic Courtès pretty-print: Suitably indent macro-related constructs. * module/ice-9/pretty-print.scm (generic-write)[pp-SYNTAX-CASE]: New procedure. [style]: Add support for `define-public', `define-syntax', `let-syntax', `letrec-syntax', `syntax-rules', and `syntax-case'. 2010-11-06 Andy Wingo fix up toy-server error handling * module/web/toy-server.scm (serve-client): Fix up error handling, so we catch errors when reading, handling, and writing. If we run interactively, an error will enter the debugger. 2010-11-05 Michael Gran need read error for extra closing square brackets * libguile/read.c (scm_read_expression): add test 2010-11-05 Ludovic Courtès Improve handling of read macros in `pretty-print'. * module/ice-9/pretty-print.scm (generic-write)[wr]: Handle read macros that appear in the middle of a list. * test-suite/tests/print.test (prints?): New macro. ("pretty-print"): New test prefix. 2010-11-05 Andy Wingo add toy web server * module/web/toy-server.scm: New module, a toy web server. * module/Makefile.am: Adapt. 2010-11-05 Andy Wingo add HTTP response module * module/web/response.scm: New module, for HTTP responses. * test-suite/tests/web-response.test: Test suite. * module/Makefile.am: * test-suite/Makefile.am: Adapt. 2010-11-05 Andy Wingo add HTTP request module * module/web/request.scm: Add HTTP request module. * test-suite/tests/web-request.test: Test cases. * module/Makefile.am: * test-suite/Makefile.am: Adapt. 2010-11-04 Andy Wingo add HTTP module * module/web/http.scm: New module, declares known HTTP headers, and their parsers and unparsers. * test-suite/tests/web-http.test: Add test suite. * module/Makefile.am: * test-suite/Makefile.am: Adapt. 2010-11-04 Andy Wingo URI parsing errors throw to `uri-error' * module/web/uri.scm (uri-error): New proc, throws to 'uri-error. (validate-uri, uri-decode, uri-encode): Use uri-error. * test-suite/tests/web-uri.test: Update for uri-error. 2010-11-04 Neil Jerram Finish adding api-regex.texi * doc/ref/Makefile.am (guile_TEXINFOS): Add api-regex.texi, so that it gets into distributions. 2010-11-03 Andreas Rottmann Add implementation of SRFI 38 * module/srfi/srfi-38.scm: New file, partly based on the reference implementation and on Alex Shinn's public-domain implementation for Chicken. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-38.scm. * test-suite/tests/srfi-38.test: New file, minimal test suite for SRFI 38. * test-suite/Makefile.am (SCM_TESTS): Added tests/srfi-38.test. * doc/ref/srfi-modules.texi: Add a node for SRFI 38. 2010-11-03 Andreas Rottmann Use a fluid for the list of the reader's "hash procedures" This allows customizing the reader behavior for a dynamic extent more easily. * libguile/read.c (scm_read_hash_procedures): Renamed to `scm_i_read_hash_procedures'. (scm_i_read_hash_procedures_ref, scm_i_read_hash_procedures_set_x): New (internal) accessor functions for the fluid. (scm_read_hash_extend, scm_get_hash_procedure): Use these accessor functions. (scm_init_read): Create the fluid, named `%read-hash-procedures' instead of the previous plain list `read-hash-procedures'. * test-suite/tests/reader.test: Adapt the "R6RS/SRFI-30 block comment syntax overridden" test to make use of the fluid. * module/ice-9/deprecated.scm (read-hash-procedures): New identifier macro -- backward-compatibility shim. 2010-10-31 Neil Jerram Manual sections don't need a page break before * doc/ref/api-coverage.texi (Code Coverage): Remove @page. * doc/ref/api-foreign.texi (Foreign Function Interface): Ditto. * doc/ref/api-lalr.texi: (LALR(1) Parsing): Ditto. * doc/ref/api-macros.texi (Macros): Ditto. 2010-10-31 Neil Jerram Add ref to new location for regex doc * doc/ref/api-data.texi: Add ref to new location for regex doc. Also correct other refs to say section rather than chapter. 2010-10-31 Neil Jerram Promote regex doc out of the `Simple Data Types' section Because that probably isn't where people will look for it. Thanks to Noah Lavine for the idea. * doc/ref/api-regex.texi (Regular Expressions): New file, containing the regex doc (promoted one level) that used to be in api-data.texi. * doc/ref/guile.texi (API Reference): Include new file, and add menu entry for the new section. * THANKS: Add Noah. 2010-10-28 Ludovic Courtès Fix typo in the (system base lalr) documentation. * doc/ref/api-lalr.texi (LALR(1) Parsing): "The tokenizer should be a unary procedure" -> "thunk". Patch by Noah Lavine . 2010-10-27 Andreas Rottmann Extend the #:replace list of the SRFI 69 module * module/srfi/srfi-69.scm: Add `make-hash-table' and `hash-table?' to the #:replace list of the module definition. 2010-10-27 Ludovic Courtès Have "frisk" recognize `#:use-module' and `#:autoload'. * module/scripts/frisk.scm (grok-proc): Support keywords `#:use-module' and `#:autoload'. Augment `arithmetic.bm'. * benchmark-suite/benchmarks/arithmetic.bm (repeat): Change the syntax. Add support for binary OP. ("fixnum")["1+", "1-"]: Adjust accordingly. ["+", "-"]: New benchmarks. 2010-10-26 Neil Jerram Fix manual typo * doc/ref/api-foreign.texi: "prodedures" -> "procedures". 2010-10-22 Julian Graham Improve performance of R6RS records implementation Reimplement record-type descriptors as vtables for record structs, saving us what was an expensive inspection of a record's vtable layout string to determine its type. * module/rnrs/records/inspection.scm (record-field-mutable?): Check mutability using the bit field stored in the record-type descriptor instead of the record struct's vtable. * module/rnrs/records/procedural.scm (record-internal?): Reimplement as a delegation to a check of the passed struct's vtable against `record-type-descriptor?'. (record-type-vtable): Modify to include base vtable layout as a prefix of the record-type-descriptor layout so that all record-type instances are now also vtables. (make-record-type-descriptor): Remove field vtable; build up a mutability bit field to use for fast mutability checks. (record-accessor, record-mutator): Use field struct and mutability bit field. 2010-10-20 Ludovic Courtès Tweak `-Wunused-variable' and `-Wunused-toplevel' for special names. * module/language/tree-il/analyze.scm (gensym?): New procedure. (unused-variable-analysis): Ignore variables whose name passes `gensym?' or is `_'. (unused-toplevel-analysis): Ignore variables whose name passes `gensym?'. * test-suite/tests/tree-il.test ("warnings")["unused-variable"]("special variable names"): New test. ["unused-toplevel"]("special variable names"): New test. 2010-10-20 Ludovic Courtès Add `Libs.private' to the `.pc' files. * meta/guile-2.0-uninstalled.pc.in (Libs): Remove @GUILE_LIBS@. (Libs.private): New field. * meta/guile-2.0.pc.in (Libs): Remove @GUILE_LIBS@. (Libs.private): New field. 2010-10-20 Ludovic Courtès configure: Don't needlessly augment $LIBS (and $GUILE_LIBS.) * configure.ac: Don't augment $LIBS with $LTLIBUNISTRING and $BDW_GC_LIBS. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Remove @LTLIBINTL@. Add $(BDW_GC_LIBS). 2010-10-20 Tristan Colgate-McFarlane Add support for more multicast sockopts. * libguile/socket.c: Add support for IP_MULTICAST_TTL and IP_MILTICAST_IF sockopts. Fix detection of struct ip_mreq * configura.ac: netinet/in.h is required to complete definition of struct ip_mreq. 2010-10-19 Andy Wingo rdelim cleanups * module/ice-9/rdelim.scm: Clean up export list. (read-line!, read-delimited!, read-delimited, read-line): Use define*. 2010-10-18 Andy Wingo more -Wundef on darwin fixes * libguile/threads.c: * libguile/posix.c: Change a couple #if HAVE_FOO to #ifdef HAVE_FOO to pacify -Wundef. Some vars are defined or not, whereas some are always defined to 0 or 1. The inconsistency is unfortunate. uninitialized var in scm_read_character * libguile/read.c (scm_read_character): Fix error condition where charname could be uninitialized. _scm GUILE_USE_64_CALLS compilation warning fix * libguile/_scm.h: Check that GUILE_USE_64_CALLS is defined. Fixes an error on i386-apple-darwin9.8.0. 2010-10-17 Andy Wingo web/uri: reimplement for rfc 3986, add tests * module/web/uri.scm: Reimplement for RFC 3986. * module/Makefile.am: Add to build. * test-suite/Makefile.am: * test-suite/tests/web-uri.test: Add tests. 2010-10-17 Andy Wingo import uri.scm from tekuti, from guile-www 2010-10-15 Ludovic Courtès Bump version number for 1.9.13. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Update `cpp-E.syms' and `cpp-SIG.syms'. * libguile/cpp-E.syms, libguile/cpp-SIG.syms: Update on a Glibc 2.11.1 system. Fix the `chknew-E' and `chknew-SIG' rules. * libguile/Makefile.am (chknew-E chknew-SIG): Run gcc without `-undef' since otherwise it ends up trying to include headers that are not available (e.g., on an x86_64-linux-gnu system.) 2010-10-15 Michael Gran Unresolved var errors don't work for top-level vars * libguile/vm-i-system.c (toplevel_ref, long_toplevel_ref): modified Update charsets to Unicode 6.0.0 * libguile/srfi-14.i.c: regenerated 2010-10-14 Andy Wingo re-implement srfi-34's guard with syntax-case * module/srfi/srfi-34.scm (guard): Re-implement using syntax-case. ssax: add procs to define parsed entities * module/sxml/ssax.scm (reset-parsed-entity-definitions!) (define-parsed-entity!): New heavy-handed knobs for adding to the set of parsed entity definitions. 2010-10-14 Neil Jerram Nuke GOOPS `Quick Start' section, in favour of the `Tutorial' These sections are pretty similar in aim, but `Tutorial' is mostly better material. * doc/ref/goops-tutorial.texi (Class definition): Add a sentence about what slots are. * doc/ref/goops-tutorial.texi (Tutorial): Remove repetition of the Stk origin, and index entries that are overly general in the context of the whole Guile manual. (Generic functions): Add text here about the nature of methods, previously in Quick Start. * doc/ref/goops.texi (Quick Start): Move `Built-in classes' subsection to be part of `Introspection'. Delete the rest, apart from snippets moved into Tutorial. 2010-10-13 Andy Wingo fix bug in with-fluids in a non-tail position * libguile/vm-i-system.c (VM_DEFINE_INSTRUCTION): Drop the stack items corresponding the the with-fluids object. Thanks very much to Stefan Israelsson Tampe for the fix. 2010-10-13 Ludovic Courtès Optimize `1+' and `1-' on fixnums. * libguile/vm-i-scheme.c (INUM_MAX, INUM_MIN): New macros. (add1, sub1): Add/subtract without untagging the operand. This leads to a 44% run time improvement compared to the previous implementation. * libguile/vm.c: Include . * test-suite/tests/numbers.test ("1+", "1-"): Add tests for MOST-POSITIVE-FIXNUM, resp. MOST-NEGATIVE-FIXNUM, for 32-bit and 34-bit values thereof. * benchmark-suite/benchmarks/arithmetic.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add it. 2010-10-13 Neil Jerram Edit `Adding Methods to Generic Functions' * doc/ref/goops.texi (Adding Methods to Generic Functions): Move the bit about no applicable methods to `Invoking Generic Functions'. Other minor edits. (Basic Method Definition): Flattened into parent. (Method Definition Internals): Moved to MOP section at end of chapter. Two very small edits * doc/ref/goops.texi (User-defined classes): Remove brackets around `formally', for better flow. (Creating Instances): Lengthen hyphen. Edit `Generic Functions and Accessors' * doc/ref/goops.texi (Generic Function Internals): Moved to MOP section at end of chapter. (Basic Generic Function Creation): Flattened into parent, and text simplified. (Extending Primitives): Renamed from `Extending Guiles Primitives'; removed `generic-capability?', which is no longer available; simplified a bit. (Merging Generics): New subsection for the material about merging; text simplified a bit. 2010-10-13 Ludovic Courtès Allocate complex numbers in contiguous pointer-less memory. * libguile/numbers.h (SCM_COMPLEX_MEM): Remove. (SCM_COMPLEX_REAL): Change to just fetch the `real' field of the pointed-to `scm_t_complex'. (SCM_COMPLEX_IMAG): Likewise. (scm_t_complex)[type, pad]: New fields. * libguile/numbers.c (scm_c_make_rectangular): Allocate the whole complex contiguously, with `scm_gc_malloc_pointerless'. 2010-10-13 Ludovic Courtès Allocate inexact numbers in pointer-less memory. * libguile/numbers.c (scm_from_double): Use `scm_gc_malloc_pointerless' instead of `scm_double_cell'. Placate `-Wformat'. * module/scripts/compile.scm (fail): Use a fancy format string instead of a non-literal one. 2010-10-12 Andy Wingo update NEWS for 1.9.13 * NEWS: Update for 1.9.13. 2010-10-12 Neil Jerram Add TeX form of jao's name * doc/ref/scheme-using.texi: Add TeX equivalent for José. 2010-10-12 Andy Wingo fold old news items into main news body * NEWS: Fold 1.9.12 items into the main body. 2010-10-12 Andy Wingo ,frame and related commands handle for-trap? appropriately * module/system/repl/debug.scm (print-frame): Add #:next-source? arg, for when print-frame should use frame-next-source instead of frame-source. (print-frames): Add #:for-trap? arg. If true, the 0th frame should be printed with frame-next-source. * module/system/repl/command.scm (define-stack-command): Introduce for-trap? into the lexical env. (backtrace, up, down, frame): Update to do the right thing regarding #:for-trap?. 2010-10-12 Andy Wingo don't warn for (format #t fmt) -- format string actually named fmt * module/language/tree-il/analyze.scm (format-analysis): Don't warn on non-literal format string if the format string is a lexical ref to a variable named "fmt". A slight hack, but effective :) * module/system/repl/command.scm (display-stat): Rename the format string to "fmt". 2010-10-12 Andy Wingo debug has for-trap? field * module/system/repl/debug.scm (): New field, `for-trap?'. True if the stack is for a trap, and thus the top frame should use frame-next-source instead of frame-source. * module/system/repl/command.scm (repl-pop-continuation-resumer) (repl-next-resumer): * module/system/repl/error-handling.scm (call-with-error-handling): Update callers. 2010-10-12 Andy Wingo remove gds docs, telling users instead to use geiser and paredit * doc/ref/scheme-using.texi (Using Guile in Emacs): Remove GDS docs, as we don't have GDS any more. Instead of surveying the field, be opinionated and tell users what to use: Geiser and Paredit. minor doc fixups * doc/ref/scheme-scripts.texi (Invoking Guile): Some typos. * doc/ref/tour.texi (Running Guile Scripts): More typos and PDF improvements. * doc/ref/scheme-using.texi (Readline, Value History): Minor rewording. (Help Commands): Minor fixup. 2010-10-11 Andy Wingo add --listen docs * doc/ref/scheme-scripts.texi (Invoking Guile): Add --listen documentation. preface contributors tweaks * doc/ref/preface.texi (Contributors): A couple tweaks update preface.texi contributors * doc/ref/preface.texi (Contributors): Rewrite and update. 2010-10-11 Ludovic Courtès Allow arbitrary code in ASSOC procedures for weak hash tables (bug #29616). * libguile/hashtab.c (struct t_assoc_args, do_weak_bucket_assoc): Remove. (struct t_fixup_args): New type. (do_weak_bucket_fixup): New function. (weak_bucket_assoc): Use it. Keep strong references to BUCKET's entries in STRONG_REFS. Call ASSOC once the alloc lock has been released. This fixes bug #29616. * test-suite/tests/weaks.test ("assoc can do anything"): New test. 2010-10-11 Ludovic Courtès Fix a bug in weak hash table bucket fixup. * libguile/hashtab.c (scm_fixup_weak_alist): Keep the value of PREV unchanged after a nullified pair is deleted; this fixes a bug whereby if several successive nullified pairs were encountered, not all of them would be removed, and the assertion in `weak_bucket_assoc' would be hit. In addition, remove the `scm_is_pair (pair)' test. 2010-10-10 Ludovic Courtès Fix typo. * module/system/repl/command.scm (repl-pop-continuation-resumer): Remove extraneous argument to `format'. 2010-10-10 Ludovic Courtès Add warnings for obvious syntax errors in format strings. * module/language/tree-il/analyze.scm (&syntax-error): New variable. (format-string-argument-count): Throw to &SYNTAX-ERROR when a syntax error in a format string is encountered. (format-analysis): Catch &SYNTAX-ERROR and convert as a warning of the appropriate type. * module/system/base/message.scm (%warning-types)[format]: Handle `syntax-error' warnings. * test-suite/tests/tree-il.test ("warnings")["conditionals"]("unterminated", "unexpected ~;", "unexpected ~]"): New tests. ["unterminated ~{...~}"]: New test. 2010-10-10 Ludovic Courtès Add new `format' warnings. * module/language/tree-il/analyze.scm (format-analysis): Add new sub-warnings: `wrong-port', `wrong-format-string', `non-literal-format-string', and `wrong-num-args'. * module/system/base/message.scm (%warning-types)[format]: Handle them. * test-suite/tests/tree-il.test ("warnings")["wrong port arg", "wrong format string", "non-literal format string", "wrong number of args"]: New tests. 2010-10-10 Ludovic Courtès Compile with `-Wformat'. * am/guilec (GUILE_WARNINGS): Add `-Wformat'. 2010-10-10 Ludovic Courtès Implement fancy format string analysis. * module/language/tree-il/analyze.scm (format-string-argument-count): Return two values, the minimum and maximum number of arguments. Add support for most of `format' escapes, including conditionals. (format-analysis): Adjust accordingly. * module/system/base/message.scm (%warning-types)[format]: Take two arguments, MIN and MAX, instead of EXPECTED. Display warning accordingly. * test-suite/tests/tree-il.test ("warnings")["format"]("~%, ~~, ~&, ~t, ~_, and ~\\n", "~{...~}", "~{...~}, too many args", "~@{...~}", "~@{...~}, too few args", "~(...~)", "~v", "~v:@y", "~*", "~?", "complex 1", "complex 2", "complex 3"): New tests. ("conditionals"): New test prefix. 2010-10-10 Ludovic Courtès Escape newlines from format strings in warnings. * module/system/base/message.scm (%warning-types)[format]: Escape newlines from FMT. 2010-10-10 Andy Wingo add --listen command line argument. * libguile/script.c (scm_shell_usage, scm_compile_shell_switches): Add a --listen argument to spawn a REPL server, possibly specifying the port or path to listen on. The goal is for this to be the default way to allow debugging via Emacs or simply using netcat. 2010-10-10 Andy Wingo add (system repl server) * module/system/repl/server.scm: New module, listens on a socket for connections, then serves repls to those sockets. * module/Makefile.am: Add repl server. 2010-10-10 Andy Wingo fix segfaults when closing the current input port * libguile/ports.c (scm_char_ready_p, scm_peek_char, scm_unread_char) (scm_unread_string): Always validate the port, even in the case that we get it the default current-input-port. Otherwise the following causes a segfault: (begin (close-port (current-input-port)) (peek-char)) 2010-10-10 Andy Wingo readline repl-reader falls back to boot-9 definition for other ports * guile-readline/ice-9/readline.scm (readline-repl-reader): Pull definition out of activate-readline. If the current input port is not the readline port, fall back to the boot-9 repl reader. (activate-readline): Adapt. interrupted syscalls run asyncs before throwing syserror * libguile/error.c (scm_syserror, scm_syserror_msg): Run pending pending asyncs before throwing the error, as one of the asyncs might be a signal handler. But there is unfortunately a race here, as noted in a comment. 2010-10-08 Andy Wingo further repl tweaks * module/system/repl/error-handling.scm (error-string): Refactor a little. (call-with-error-handling): Ensure a trailing newline when printing the error-msg. * module/system/repl/repl.scm (run-repl): We don't know the name of the meta-command here. 2010-10-08 Ludovic Courtès Improve pretty-printing of tree-il objects. * module/language/tree-il.scm (print-tree-il): Print the AST with ~S instead of ~A. 2010-10-08 Ludovic Courtès Add `-Wformat'. * module/language/tree-il/analyze.scm (format-string-argument-count): New procedure. (format-analysis): New tree analysis. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `format'. * module/system/base/message.scm (%warning-types): Add `format'. * test-suite/tests/tree-il.test (%opts-w-format): New variable. ("warnings")["format"]: New test prefix. * doc/ref/api-evaluation.texi (Compilation): Mention `format' warnings. 2010-10-08 Ludovic Courtès Fixlets for REPL error handling. * module/system/repl/error-handling.scm (error-string): Don't call `display-error' when STACK is empty. (call-with-error-handling): Display ERROR-MSG instead of using `format', since ERROR-MSG may contain `format' escapes. * module/system/repl/repl.scm (run-repl): Add missing argument to `format'. 2010-10-08 Ludovic Courtès SRFI-1: Rewrite `split-at' and `split-at!' in Scheme. This partially reverts commit bb560b9c16893f762699ba5a3109c8367fff8dfc (Tue Mar 15 2005). * module/srfi/srfi-1.scm (out-of-range, split-at, split-at!): New procedures. * libguile/srfi-1.c (scm_srfi1_split_at, scm_srfi1_split_at_x): Remove. * libguile/srfi-1.h (scm_srfi1_split_at, scm_srfi1_split_at_x): Ditto. 2010-10-08 Ludovic Courtès SRFI-1: Rewrite `filter-map' in Scheme. This partially reverts commit c16359466bcc3f2ebf6d750c069f787f629fc625 (Thu Mar 17 2005). * libguile/srfi-1.c (scm_srfi1_filter_map): Remove. * libguile/srfi-1.h (scm_srfi1_filter_map): Ditto. * module/srfi/srfi-1.scm (filter-map): New procedure. 2010-10-08 Ludovic Courtès SRFI-1: Make `fold-right' tail-recursive. * module/srfi/srfi-1.scm (fold-right): Make tail-recursive. * test-suite/tests/srfi-1.test ("fold-right"): New test prefix. 2010-10-08 Ludovic Courtès SRFI-1: Make `unfold' tail-recursive (fix bug #30071). * module/srfi/srfi-1.scm (unfold): Make tail-recursive, following a suggestion by Szavai Gyula. * test-suite/tests/srfi-1.test ("unfold"): New test prefix. 2010-10-08 Ludovic Courtès Register `scm_init_r6rs_ports' as an extension. * libguile/r6rs-ports.c (scm_register_r6rs_ports): New function. * libguile/r6rs-ports.h (scm_register_r6rs_ports): New declaration. * libguile/init.c (scm_i_init_guile): Call it. 2010-10-08 Ludovic Courtès Always run at least the ASCII regexp tests. * test-suite/tests/regexp.test (with-ascii-or-latin1-locale): New macro. ("regexp-quote"): Use it instead of `with-latin1-locale'. 2010-10-08 Andy Wingo fix a bug in `finish' * module/system/repl/command.scm (repl-pop-continuation-resumer) (finish): Fix a bug printing return values. stepping traps use frame-next-source, not frame-source * module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Use frame-next-source in stepping traps. 2010-10-08 Andy Wingo add program-sources-pre-retire to core and define frame-next-source * libguile/programs.h: * libguile/programs.c (scm_program_source): Add an optional arg, the sources table to traverse. Defaults to the result of scm_program_sources. * module/system/vm/program.scm (program-sources-pre-retire): Move definition here from (system vm traps), and export. * module/system/vm/traps.scm: Adapt. * module/system/vm/frame.scm (frame-next-source): New exported binding, returns the source line corresponding to the next instruction instead of the previous instruction. 2010-10-08 Andy Wingo fix error in frame-return-values * module/system/vm/frame.scm (frame-return-values): Fix off-by-one error. fix tracing of mv returns * module/system/vm/trace.scm (print-return): Fix multiple-value-return printing. 2010-10-08 Andy Wingo more inlining in psyntax * module/ice-9/psyntax.scm (make-wrap, wrap-marks, wrap-subst): Use identifier syntax here too. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-10-08 Andy Wingo inline symbol? and vector? to opcodes, and a psyntax inlining tweak * libguile/vm-i-scheme.c (symbol?, vector?): New instructions. Renumbered the rest. * libguile/vm-i-system.c: Renumber instructions. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * module/ice-9/psyntax.scm (binding-type, binding-value): Define using macros so that we inline to car and cdr opcodes. Oh, for an inliner :) * module/language/tree-il/compile-glil.scm (*primcall-ops*) * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*) (*effect+exception-free-primitives*): Add symbol? and vector? inlines. 2010-10-08 Andy Wingo add repl debugging command docs * doc/ref/scheme-using.texi (Debug Commands): Add docs for new debugging commands (break, step, registers, etc). proof-reading fixen in api-debug * doc/ref/api-debug.texi (Trap States, High-Level Traps): A couple of proof-reading fixes. finish traps documentation * doc/ref/api-debug.texi (Low-Level Traps, Tracing Traps, Trap States): Add notes on using modules. (High-Level Traps): Combine "Trap Handlers" and "Setting Traps" here. Flesh out docs. 2010-10-07 Andy Wingo remove old debugging examples from api-debug * doc/ref/api-debug.texi (Debugging Examples): Remove section, as the tracing bits are adequately covered in tracing, and the breakpoints and such will get covered in the debugging meta-commands section. 2010-10-07 Andy Wingo document trap states * module/system/vm/trap-state.scm: Export add-trap!. * doc/ref/api-debug.texi (Trap States): Document. 2010-10-07 Andy Wingo document tracing traps * doc/ref/api-debug.texi (Tracing Traps): Document the traps. finish documenting low-level traps, other api-debug.texi fixes * doc/ref/api-debug.texi (Stack Capture): Rename from "Capturing the Stack or Innermost Stack Frame". Move start-stack docs here. (Frames): Document accessors for fp, sp, ip, et al. (Source Properties): Raise to a subsection. (VM Hooks): Add notes about the VM trace level within hook firing. (Low-Level Traps): Flesh out. 2010-10-07 Andy Wingo update traps documentation (unfinished) * doc/ref/Makefile.am: * doc/ref/guile.texi: * doc/ref/scheme-debugging.texi: Remove scheme-debugging.texi, which only described tracing. Tracing documentation is now in api-debugging. * doc/ref/scheme-using.texi (Evaluating Scheme Code): Remove reference to source traps, as that section is going away. * doc/ref/api-modules.texi (Included Guile Modules): Remove reference to Tracing. This section is a little silly, anyway... * doc/ref/api-evaluation.texi (VM Behaviour): Remove section, it is in api-debugging now. * doc/ref/api-debug.texi (Stacks, Frames): Rename sections from "Examining the Stack" and "Examining Stack Frames", respectively. (Traps): Update for current API. A big and not-quite-finished update. 2010-10-07 Andy Wingo update docs regarding --debug * doc/ref/scheme-scripts.texi (Invoking Guile): Update docs on --debug. 2010-10-07 Andy Wingo rename vm-trace to call-with-trace * module/system/vm/trace.scm (print-application, print-return): Change to add more whitespace, as (ice-9 debug) did. (call-with-trace): Rename from vm-trace, and make the vm a keyword argument. * module/system/repl/command.scm: Don't autoload (system vm profile). (trace): Update for call-with-trace name change. 2010-10-06 Andy Wingo update (system repl debug) todo * module/system/repl/debug.scm: Update todo. 2010-10-06 Andy Wingo add ,step ,stepi ,next and ,nexti * module/system/vm/traps.scm (trap-matching-instructions): New trap, just installs a next hook and runs the handler when a predicate succeeds. * module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): New procedure, uses trap-matching-instructions with an appropriate predicate to handle step, stepi, next, and nexti repl metacommands. * module/system/repl/command.scm (step, step-instruction, next) (next-instruction): New repl debugger commands. 2010-10-06 Andy Wingo cleanups to ,finish * module/system/repl/command.scm (repl-pop-continuation-resumer): Factor out of finish. (finish): Adapt. * module/system/vm/trap-state.scm (add-ephemeral-trap-at-frame-finish!): Rename to add "ephemeral" to the name. * module/system/vm/traps.scm (trap-calls-to-procedure): Remove unused #:width kwarg. 2010-10-06 Andy Wingo build guile-readline/ after module/ * Makefile.am (SUBDIRS): Build module/ before guile-readline/. Reformat. 2010-10-05 Andy Wingo add ,finish repl meta-command * module/system/repl/command.scm (finish): New REPL meta command. Uses fancy prompt stuff. 2010-10-05 Andy Wingo (system vm trap-state): add-trap-at-frame-finish! * module/system/vm/traps.scm: Fix a comment. * module/system/vm/trap-state.scm (): Add next-ephemeral-idx slot. (wrapper-at-index): Use eqv? instead of = to avoid type errors in user inputs. (next-ephemeral-index!, ephemeral-handler-for-index): New functions, allocate ephemeral trap ids for functions to be called only once. (add-trap-at-frame-finish!): New export, traps when a frame finishes. 2010-10-05 Andy Wingo (system vm frame): frame-return-values * module/system/vm/frame.scm (frame-return-values): New exported function, gives the return values for a frame. * module/system/vm/trace.scm: Remove frame-return-values from here. debug-trap-handler ephemeral trap enhancement * module/system/repl/error-handling.scm (call-with-error-handling): If the given index is false, assume this was an ephemeral trap, and don't print a welcome message or reference the trap by index. (system repl debug): add frame->stack-vector * module/system/repl/debug.scm (frame->stack-vector): New public function. fix embarrassing error preventing ,del from working * module/system/vm/trap-state.scm (remove-trap-wrapper!): Oops, fix newbie error regarding delq and mutation. system repl repl comments * module/system/repl/repl.scm (meta-reader): Add a comment about peek, read, and the EOF object. bugfixes and simplifications to ice-9 buffered-input. * module/ice-9/buffered-input.scm (make-buffered-input-port): Simplify, and fix one case in which we would buffer the EOF object. 2010-10-05 Andy Wingo guile-readline slight modernization * guile-readline/Makefile.am: Update to use am/guilec. * guile-readline/ice-9/readline.scm (activate-readline): Update to use a lambda*. 2010-10-04 Andy Wingo Revert "repl.scm next-char needed to read EOF from port" Actually peek-char => EOF does not guarantee that read-char => EOF. I don't know what to do about this. This reverts commit 6e1dccc42f9ec81e04524ccc0956c692ee423576. 2010-10-04 Neil Jerram Edit section on generic functions * doc/ref/goops.texi (Generic Functions and Accessors): Renamed from `Creating Generic Functions'. Explain what an accessor is. (Basic Generic Function Creation): Clarify the point of the text about generics having short names. Edit section on slot access * doc/ref/goops.texi (Instance Slots): Remove a little verbosity. (Class Slots): Correct one `slot-missing' to `slot-unbound'. Typeset Ludo's name correctly * doc/ref/history.texi (A Scheme of Many Maintainers): Add TeX-specific version of `Courtès'. 2010-10-03 Andy Wingo avoid some double-breaks in trap-at-procedure-ip-in-range * module/system/vm/traps.scm (trap-at-procedure-ip-in-range): Rework not to call the handler when returning to a frame that was already entered. So now breaking at foo.scm:1234 doesn't break when returning to that line. repl.scm next-char needed to read EOF from port * module/system/repl/repl.scm (next-char): Actually read off the EOF if we got one. Interesting, this. 2010-10-03 Andreas Rottmann Add implementation of SRFI 45 * module/srfi/srfi-45.scm: New file, containing the reference implementation of SRFI 45, slightly adapted to use SRFI-9. * module/Makefile.am (SRFI_SOURCES): Added srfi/srfi-45.scm. * test-suite/tests/srfi-45.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-45.test. * doc/ref/srfi-modules.texi (SRFI-45): New node and subsection; essentially a shortended transcript of the SRFI-45 specification. 2010-10-03 Michael Gran Add v1.8.x backward compatiblity to GUILE_SITE_DIR * meta/guile.m4 (GUILE_SITE_DIR): use pkgdatadir if no sitedir 2010-10-03 Andy Wingo srfi-67 #:replace work * module/srfi/srfi-67.scm (string-compare, string-compare-ci): #:replace these bindings. 2010-10-03 Andreas Rottmann Add implementation of SRFI-67 * module/srfi/srfi-67/compare.scm: New file; reference implementation of SRFI 67. * module/srfi/srfi-67.scm: New module; includes the refernce implementation. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-67.scm. (NOCOMP_SOURCES): Add srfi/srfi-67/compare.scm. * test-suite/tests/srfi-67.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-67.test. 2010-10-03 Andreas Rottmann Add implementation of SRFI 42 * module/srfi/srfi-42/ec.scm: New file; reference implementation of SRFI 42. * module/srfi/srfi-42.scm: New file; module for SRFI 42. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-42.scm. (NOCOMP_SOURCES): Add srfi/srfi-42/ec.scm. * test-suite/tests/srfi-42.test: New file; test suite for SRFI 42. * test-suite/Makefile.am: SCM_TESTS: Add tests/srfi-42.test. 2010-10-03 Andreas Rottmann Reference original specification in SRFI 27 documentation * doc/ref/srfi-modules.texi (SRFI-27): Link to the original specification of SRFI-27. 2010-10-03 Andy Wingo bugfixen in source breakpoints and in-procedure traps * module/system/vm/traps.scm (trap-in-procedure): If we are (re-)entering the procedure from a return, call the enter-proc with the returnee, not the returner. (in-range?): Tighten up a bit. (program-sources-before-retire): New helper, like program-sources but indexed before instructions are retired instead of after. (program-sources-by-line): Use program-sources-before-retire so that we can break on instructions by source line *before* those instructions are executed. 2010-10-02 Neil Jerram Flatten `Miscellaneous Functions' * doc/ref/goops.texi (Miscellaneous Functions): Delete this container section, and promote its subsections. 2010-10-02 Neil Jerram Customizing Instance Creation to metaobject protocol section * doc/ref/goops.texi (Customizing Instance Creation): Moved from `Creating Instances' to `The Metaobject Protocol'. * doc/ref/goops.texi (Basic Instance Creation): Flattened into parent `Creating Instances', refs updated accordingly. 2010-10-02 Neil Jerram Remove goops-version, which is no longer defined * doc/ref/goops.texi (Administrative Functions): Removed. * module/oop/goops.scm (oop): Don't export `goops-version'. 2010-10-02 Neil Jerram Remove doc of STKlos compatibility As module/oop/goops/stklos.scm, the available compatibility is superficial only, so it isn't worth documenting. * doc/ref/goops.texi (STKlos Compatibility): Removed. 2010-10-02 Neil Jerram Continue separating simple and more complex GOOPS doc * doc/ref/goops.texi (Defining New Classes): Move `Class Definition Internals' and `Customizing Class Definition' notes to the metaobject protocol section. 2010-10-01 Andy Wingo source breakpoints accept user line numbers * module/system/vm/trap-state.scm (add-trap-at-source-location!): * module/system/vm/traps.scm (trap-at-source-location): Rename "line" argument to "user-line", indicating that the line is one-based instead of zero-based. Decrement the line before handing off to source-closures-or-procedures and source->ip-range. 2010-10-01 Andy Wingo add source:line-for-user, returning a 1-indexed line number * module/system/vm/program.scm (source:line-for-user): New exported procedure, returns a 1-indexed line, suitable for presentation to a user. (write-program): Use source:line-for-user when making fallback names. * module/system/vm/coverage.scm (coverage-data->lcov): * module/language/assembly/disassemble.scm (source->string): * module/system/repl/debug.scm (print-frame): Use source:line-for-user. 2010-10-01 Andy Wingo api-debug tweak * doc/ref/api-debug.texi (Debug Options): Fix wording. update api-debug.texi discussion of stack overflow * doc/ref/api-debug.texi (Debug Options): Update stack overflow discussion. 2010-10-01 Andy Wingo c stack overflow checked for, once more * libguile/stackchk.h: Include private-options.h if we are building guile. * libguile/vm.c (scm_c_vm_run): Check for C stack overflow before entering the engine. 2010-10-01 Andy Wingo scm_report_stack_overflow eventually resets scm_stack_checking_enabled_p * libguile/stackchk.c (scm_report_stack_overflow): Surround in a dynwind, so that scm_stack_checking_enabled_p is reset when the error throws. 2010-10-01 Neil Jerram Fix typo in configure.ac Fixes an error when running ./configure: ./configure: line 31873: text: command not found * configure.ac: Change "text" to "test", in libltdl-related code. 2010-10-01 Andy Wingo deprecate turn-on-debugging, it is obsolete * libguile/script.c (scm_compile_shell_switches): Don't generate calls to turn-on-debugging. * module/ice-9/boot-9.scm (turn-on-debugging): Remove. * module/ice-9/deprecated.scm (turn-on-debugging): Add deprecated shim. 2010-10-01 Andy Wingo scm_debug_opts to debug.c, backtrace on by default, scm_*_opts internal linkage * libguile/eval.c: * libguile/debug.c (scm_debug_opts): Move here, from eval.c. Change SCM_BACKTRACE_P to 1, initially. * libguile/private-options.h: Make all options vars private. 2010-10-01 Andy Wingo document call-with-error-handling * doc/ref/api-debug.texi (Pre-Unwind Debugging): Document call-with-error-handling. api-debug.texi refactors * doc/ref/api-debug.texi (Programmatic Error Handling): Rename from "Debug on Error". Reorganize subsections according to when the error is handled. * doc/ref/api-options.texi: Adapt xref. update tour.texi * doc/ref/tour.texi (Using the Guile Module System): Remove "in flux" language. Update examples to use #:export instead of (export ...). 2010-10-01 Andy Wingo finish cleaning out api-options.texi * doc/ref/api-debug.texi (Debug on Error): Move debug options here (for now). Leave debug-options-interface undocumented. * doc/ref/api-options.texi (Runtime Options): Remove debug options. Link to the sections where the options documentation is now. Update the options example transcript. 2010-10-01 Andy Wingo debug and readline options doc tweak * doc/ref/api-options.texi (Debugger options): * doc/ref/repl-modules.texi (Readline Options): Use 'help instead of 'full (they are entirely equivalent right now). Update output to show options in the right order. 2010-10-01 Andy Wingo move read and print options docs to the procedures they parameterize * doc/ref/api-evaluation.texi (Scheme Read): Fold all reader options docs into this section. Undocument read-options-interface. (Scheme Write): New section for `write' and `display', and the print options. print-enable/print-disable are not documented, as there are no boolean print options. print-options-interface is likewise undocumented. * doc/ref/api-options.texi: Remove discussion of options in general. Move read options to Scheme Read, and print options to Scheme Write. * doc/ref/api-io.texi (Reading): Link to Scheme Read. (Writing): Move write and display to Scheme Write, and link there. * doc/ref/srfi-modules.texi: * doc/ref/api-debug.texi: * doc/ref/api-data.texi: Update xrefs. 2010-10-01 Andy Wingo remove elisp-strings and elisp-vectors read options * libguile/private-options.h (SCM_ELISP_VECTORS_P, SCM_ESCAPED_PARENS_P): * libguile/read.c (scm_read_opts): Remove unused elisp-vectors option, and the elisp-strings option (which allowed \( and \) escapes in strings). (scm_read_string): Remove the elisp-strings case. * doc/ref/api-options.texi (Reader options): Update, and update wording of the case-insensitive bit. 2010-10-01 Andy Wingo (foo-options 'full) displays options doc in correct order * libguile/options.c (get_documented_option_setting): Reverse options interface list before returning, so that they are in the original order. remove unused print-options * libguile/private-options.h (SCM_PRINT_CLOSURE, SCM_PRINT_SOURCE_P): * libguile/print.c (scm_print_opts): * doc/ref/api-options.texi (Printing options): Remove source and closure-hook print options. 2010-09-30 Andy Wingo add ,registers * libguile/frames.h: * libguile/frames.c (scm_frame_stack_pointer): New function. * module/system/repl/debug.scm (print-registers): New function, prints out registers. * module/system/repl/command.scm (registers): New debugging meta-command. (inspect): Not a stack-command, a normal meta-command. 2010-09-28 Andy Wingo fix check-guile.in for default vm change * check-guile.in: Make the --debug fix in the source file, not the generated file. Grr. 2010-09-28 Andy Wingo default to regular vm for noninteractive use * libguile/script.c (scm_compile_shell_switches): Select the debugging VM in the cases that we previously would select deval -- when running interactively without --no-debug, or otherwise with --debug. * libguile/vm.c: Default to the regular engine. (scm_c_set_vm_engine_x): Remove requirement for the VM to have no pending computations. 2010-09-27 Ludovic Courtès Fix pattern variable extraction in `match' with `..1'. * module/ice-9/match.upstream.scm (match-extract-vars): Support `..1'. 2010-09-27 Ludovic Courtès Add support for `..1' to `match'. Patch accepted upstream: . * module/ice-9/match.upstream.scm (match-two): Add support for `..1'. * test-suite/tests/match.test ("matches")["list ..1", "list ..1, with predicate"]: New tests. ("doesn't match")["list ..1", "list ..1, with predicate"]: New tests. 2010-09-27 Andreas Rottmann Add implementation of SRFI 27 * module/srfi/srfi-27.scm: New file; implementation of SRFI 27 in terms of the existing random number generator. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-27.scm. * test-suite/tests/srfi-27.test: New file; minimal test suite for SRFI 27. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-27.test. * doc/ref/srfi-modules.texi: Add subsection on SRFI-27 based on the specification. 2010-09-27 Andy Wingo add call-with-vm; remove thread-vm bits; remove vm-apply; engines settable. * libguile/vm.h (scm_c_vm_run): Make internal. * libguile/vm.c (vm_default_engine): New static global variable. (make_vm): Set vp->engine based on (scm_vm_apply): Remove in favor of call-with-vm. (scm_thread_vm, scm_set_thread_vm_x): Remove these, as they did not have a well-defined meaning, and were dangerous to call on other threads. (scm_the_vm): Reinstate previous definition. (symbol_to_vm_engine, vm_engine_to_symbol) (vm_has_pending_computation): New helpers. (scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): New accessors for VM engines. (scm_c_set_default_vm_engine_x, scm_set_default_vm_engine_x): New setters for the default VM engine. (scm_call_with_vm): New function, applies a procedure to arguments in a context in which a given VM is current. * libguile/eval.c (eval, scm_apply): VM dispatch goes through scm_call_with_vm. * test-suite/tests/control.test ("the-vm"): * module/system/vm/coverage.scm (with-code-coverage): Use call-with-vm. * module/system/vm/vm.scm: Update exports. * test-suite/vm/run-vm-tests.scm (run-vm-program): * test-suite/tests/compiler.test ("current-reader"): Just rely on the result of make-program being an applicable. * test-suite/tests/eval.test ("stack overflow"): Add a note that this test does not test what it should. 2010-09-27 Ludovic Courtès Fix bignum memory leak. The `mpz_t' associated with a bignum would never be freed, so an expression like `(while #t (expt 2 5000))' would quickly lead to memory exhaustion. * libguile/numbers.c (finalize_bignum): New function. (make_bignum): Register it as a finalizer for P. 2010-09-27 Ludovic Courtès Allocate bignums in pointer-less memory. * libguile/numbers.c (make_bignum): New function. (scm_i_mkbig, scm_i_long2big, scm_i_ulong2big, scm_i_clonebig, scm_i_dbl2big, scm_i_mpz2num): Use it. Remove `scm_t_aligned_cell'. * libguile/_scm.h (scm_aligned_cell, scm_t_aligned_cell): Remove. The whole approach was misguided as the compiler can't guarantee absolute alignment on the stack. Fix argument passing in VM hooks. * libguile/vm.c (vm_dispatch_hook): Take care of FRAME's alignment explicitly so that it's correct even if the current stack frame isn't 8-byte aligned (as can be the case on i686--the SysV i386 ABI just says that the stack is word-aligned.) 2010-09-27 Ludovic Courtès Have `@abort' honor VM changes by winds. * libguile/control.c (scm_c_abort): Update VM after the `scm_dowinds' call. * test-suite/tests/control.test ("the-vm"): New test prefix. 2010-09-26 Michael Gran Favor non-hex string escapes over hex escapes when writing strings The characters U+0007 to U+000D have non-hex forms for their escapes when in written strings. * libguile/print.c (write_character): use non-hex escapes * test-suite/tests/reader.test (write R6RS string escapes): adjust test 2010-09-26 Neil Jerram Edit define-class doc * doc/ref/goops.texi (Defining New Classes): Remove "fixme" text (saying we should have something that we in fact already have). A few minor edits throughout. (Basic Class Definition): Move content up into `Defining New Classes'. (Class Options): Move after `Slot Options' (because slot options are more important). Remove doc of the #:environment option, since I believe it's now fictitious. (Slot Options): Reorder the options so that the most commonly used ones come first. 2010-09-26 Neil Jerram Remove unwarranted para * doc/ref/goops.texi (Metaobjects and the Metaobject Protocol): Remove para about GOOPS classes belonging to the usual Scheme namespace. Interest doesn't justify the space that it takes. Edit text about the MOP * doc/ref/goops.texi (The Metaobject Protocol, Metaobjects and the Metaobject Protocol): Minor edits. Start separating doc of the metaobject protocol from that of basic GOOPS usage * doc/ref/goops.texi (Introductory Remarks): Node deleted, with material moved to... (The Metaobject Protocol): ...here. (MOP Specification): Moved to become a subnode of `The Metaobject Protocol'. 2010-09-26 Neil Jerram Promote subsections inside the GOOPS "Reference Manual" section * doc/ref/goops.texi (Reference Manual): Node deleted, with content promoted up to... * doc/ref/goops.texi (GOOPS): ...here. 2010-09-25 Michael Gran Incorrect parsing of NaN complex numbers * libguile/numbers.c (mem2complex): modified * test-suite/tests/reader.test: new complex NaN reader test 2010-09-25 Andy Wingo remove vm-version, vm options * libguile/vm.h (struct scm_vm): Remove "options" member. * libguile/vm.c (scm_vm_version, scm_vm_option, scm_set_vm_option_x): Remove. * module/system/vm/vm.scm (vm-version, vm-option, set-vm-option!): Remove. (vms:time, vms:clock): Remove these unused definitions. (vm-load): Remove. "Load" should be reserved for things that exist on disk, methinks. 2010-09-25 Andy Wingo fix up options.test * test-suite/tests/options.test (test-suite): Fix up for removal of maxdepth debug option. statprof test traps fix; re-enable accurate call counting test * test-suite/tests/statprof.test: Remove needless debug-enable / trap-enable calls. ("accurate call counting"): Fix this test. Whee :) fix eval.test for procnames eval option * test-suite/tests/eval.test ("define set procedure-name"): Fix needless use of removed 'procnames eval option. 2010-09-24 Andy Wingo remove a number of debug options * libguile/private-options.h (SCM_BREAKPOINTS_P, SCM_TRACE_P) (SCM_REC_PROCNAMES_P, SCM_BACKTRACE_INDENT, SCM_N_FRAMES) (SCM_BACKTRACE_MAXDEPTH, SCM_DEVAL_P): Remove these internal names. * libguile/eval.c (scm_debug_opts): Remove the corresponding debug options -- breakpoints, trace, procnames, indent, frames, maxdepth, and debug. * libguile/debug.c (scm_debug_options): Remove SCM_N_FRAMES check. * test-suite/lib.scm (with-debugging-evaluator*): * module/scripts/summarize-guile-TODO.scm: * module/statprof.scm (statprof-reset): * module/ice-9/boot-9.scm (turn-on-debugging): Remove useless debug-enable 'debug calls. * module/ice-9/deprecated.scm (debug-enable): As it seems that 'debug is a particulatly common option that we just removed, add a deprecation shim. * doc/ref/api-options.texi (Debugger options): Update the set of debug options. 2010-09-24 Andy Wingo remove evaluator-traps-interface * libguile/debug.h: * libguile/debug.c (scm_with_traps): * libguile/eval.c (scm_evaluator_traps, scm_evaluator_trap_table): Remove these procedures. Note that scm_evaluator_traps was known in Scheme as `evaluator-traps-interface'. * libguile/private-options.h (SCM_TRAPS_P, SCM_ENTER_FRAME_P) (SCM_APPLY_FRAME_P, SCM_EXIT_FRAME_P, SCM_ENTER_FRAME_HDLR) (SCM_APPLY_FRAME_HDLR, SCM_EXIT_FRAME_HDLR, SCM_MEMOIZE_P) (SCM_MEMOIZE_HDLR): Remove these private interfaces. * module/ice-9/boot-9.scm (traps, trap-enable, trap-disable, trap-set!): Remove. * module/ice-9/scm-style-repl.scm (error-catching-loop): Remove with-traps wrap. * doc/ref/api-options.texi (Low level options interfaces): (User level options interfaces, Evaluator trap options) * doc/ref/api-evaluation.texi (Evaluator Behavior): Remove references to the evaluator traps interface. 2010-09-24 Andy Wingo remove GDS It is with a sigh that I do this. Farewell, old friend GDS; your bits will live on, reclaimed and reused in the new debugger. * module/Makefile.am: * module/ice-9/gds-client.scm: * module/ice-9/gds-server.scm: Remove these; we favor Geiser now. * emacs/Makefile.am: * emacs/gds-faq.txt: * emacs/gds-scheme.el: * emacs/gds-server.el: * emacs/gds-test.el: * emacs/gds-test.sh: * emacs/gds-test.stdin: * emacs/gds-tutorial.txt: * emacs/gds.el: Remove GDS files. The docs are still around, as they need to be folded into the docmentation of the new debugger. 2010-09-24 Andy Wingo remove (ice-9 debugger) and (ice-9 debugging) * module/ice-9/debugger.scm: * module/ice-9/debugger/command-loop.scm: * module/ice-9/debugger/commands.scm: * module/ice-9/debugger/state.scm: * module/ice-9/debugger/trc.scm: * module/ice-9/debugger/utils.scm: * module/ice-9/debugging/breakpoints.scm: * module/ice-9/debugging/example-fns.scm: * module/ice-9/debugging/ice-9-debugger-extensions.scm: * module/ice-9/debugging/load-hooks.scm: * module/ice-9/debugging/steps.scm: * module/ice-9/debugging/trace.scm: * module/ice-9/debugging/traps.scm: * module/ice-9/debugging/trc.scm: Remove these files, as we will favor the REPL's implementation of a debugger, and (system vm traps) and (system vm trap-state). But these old files will continue to inspire the rest of the new debugger interface. 2010-09-24 Andy Wingo remove eval-options * libguile/eval.c: * libguile/private-options.h (scm_eval_opts, scm_eval_options_interface) (SCM_EVAL_STACK): Remove these private interfaces. * module/ice-9/boot-9.scm (eval-options, eval-enable, eval-disable) (eval-set!): Remove these procedures. * doc/ref/api-evaluation.texi: * doc/ref/api-options.texi: Remove references to eval options. 2010-09-24 Andy Wingo api-debug.texi updates * doc/ref/api-debug.texi (Debugging, Evaluation Model) (Source Properties): Fixes. fix ,traps REPL command * module/system/repl/command.scm (traps): Fix this REPL meta-command. 2010-09-24 Andy Wingo remove srcprop.[ch] things that have to do with breakpoints * libguile/eval.c: Mark "breakpoints", "trace", and "procnames" debug options as obsolete. There is lots of work left to do here, though. * libguile/srcprop.h (scm_sym_breakpoint) (scm_c_source_property_breakpoint_p, SRCBRKP): Remove these definitions, without replacements. * libguile/srcprop.c: Remove all code that has to do with breakpoints. 2010-09-24 Ludovic Courtès Make `procedure-execution-count' fail gracefully when no source info is available. * module/system/vm/coverage.scm (procedure-execution-count): Handle the case where (null? (program-sources PROC)). 2010-09-24 Ludovic Courtès Fix coverage analysis of procedures called from C. * module/system/vm/coverage.scm (with-code-coverage): Switch current thread to VM, using `set-thread-vm!'. * test-suite/tests/coverage.test ("procedure-execution-count")["called from C"]: New test. 2010-09-24 Ludovic Courtès Remove unused declarations. * libguile/vm.h (scm_vm_option_ref, scm_vm_option_set_x): Remove. 2010-09-24 Ludovic Courtès Add `thread-vm' and `set-thread-vm!'. * libguile/vm.c (thread_vm, scm_thread_vm, scm_set_thread_vm_x): New functions. (scm_the_vm): Add docstring. Use `thread_vm'. * libguile/vm.h (scm_thread_vm, scm_set_thread_vm_x): New declarations. * module/system/vm/vm.scm: Export `thread-vm' and `set-thread-vm!'. 2010-09-24 Andy Wingo procedure traps can fire on nested procedures * module/system/vm/traps.scm (frame-matcher): New helper. (trap-at-procedure-call, trap-in-procedure, trap-in-dynamic-extent) (trap-calls-in-dynamic-extent, trap-instructions-in-dynamic-extent) (trap-instructions-in-procedure, trap-at-procedure-ip-in-range): Add ability to trap on procedures that are closures. (trap-at-source-location): Check source-closures first, to catch source locations that are in nested procedures. 2010-09-24 Andy Wingo system xref maintains source mapping for nested procedures too * module/system/xref.scm (*closure-sources-db*): New global, like *sources-db* but for nested procedures. It's a separate map because these procs need to be treated differently in trap handlers -- you match on the bytecode, not on the program object. (add-source, forget-source): Take the db as an argument (the normal db or the closures db). (add-sources, forget-sources): Record sources for nested procedures to in *closures-db*. (untaint-sources, ensure-sources-db): Adapt for new closures db. (lookup-source-procedures): Factored out. (source-closures): New exported procedure, returns closures at the given source location. 2010-09-24 Ludovic Courtès Fix typo in `weaks.test'. * test-suite/tests/weaks.test (valid?): Check for `value', not `val'. 2010-09-23 Ludovic Courtès Fix bug #31081 (`lookahead-u8' returns an s8.) Reported by Göran Weinholt . * libguile/r6rs-ports.c (scm_lookahead_u8): Return an unsigned byte. * test-suite/tests/r6rs-ports.test ("7.2.8 Binary Input")["lookahead-u8: result is unsigned"]: New test. 2010-09-23 Ludovic Courtès Fixlet in `coverage.test'. * test-suite/tests/coverage.test ("line-execution-counts")["several times"]: Add missing `else' clause. Strengthen the weak hash table tests. * test-suite/tests/weaks.test: Enclose in a module. (valid?): New procedure. ("weak-hash")["weak-key dies, "weak-value dies", "double-weak dies"]: Check that all the values are `valid?', in addition to checking that at least one of them is #f. 2010-09-23 Ludovic Courtès Fix weak-value hash tables. * libguile/hashtab.c (scm_hash_fn_set_x): Register a disappearing link to VAL when TABLE is weak-value. * test-suite/tests/weaks.test ("weak-hash")["weak-key dies", "weak-value dies", "doubly-weak dies"]: Use `hash-set!' and `hash-ref', not `hashq-set!' and `hashq-ref', otherwise these tests would always succeed because (eq? "this" "this") => #f. ["lives"]: Use `hash-ref' and `hash-set!' too for consistency. 2010-09-23 Ludovic Courtès Define `equal?' for pointer objects. * libguile/eq.c (scm_equal_p): Handle pointer objects. * test-suite/tests/foreign.test ("make-pointer")["equal?", "equal? modulo finalizer", "not equal?"]: New tests. 2010-09-23 Andy Wingo add ,break-at-source * module/system/vm/trap-state.scm (add-trap-at-source-location!): New proc. * module/system/repl/command.scm (break-at-source): New repl meta-command. Doesn't work as well as it could now because it doesn't know about nested functions, but that's coming. another trap printing tweak * module/system/vm/trap-state.scm (add-trap-at-procedure-call!): (add-trace-at-procedure-call!): Breakpoint / tracepoint name tweaks. 2010-09-23 Andy Wingo list-traps just returns trap identifiers, not names * module/system/vm/trap-state.scm (list-traps): Just return the integers identifying the traps; people can use trap-name to get the names. * module/system/repl/command.scm (traps): Adapt. 2010-09-23 Andy Wingo trace printing tweak * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Tweak to the #:prefix string. more uniform break / tracepoint printing in repl * module/system/repl/command.scm (break, tracepoint): In the message, use the trap-name. add trap-name procedure * module/system/vm/trap-state.scm (trap-name): New proc. 2010-09-23 Andy Wingo tracepoints print their trap number * module/system/vm/trace.scm (print-application, print-return): Add a prefix before the printout. (trace-calls-to-procedure, trace-calls-in-procedure): Add prefix keyword args. * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Give a useful prefix for tracepoint printouts. 2010-09-23 Andy Wingo add repl ,tracepoint command * module/system/vm/trace.scm (print-return, print-application) (frame-return-values): Factored out of other things. (trace-calls-to-procedure): New proc, installs a trap tracing only calls to the given proc. (trace-calls-in-procedure): Refactor a bit. * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): New proc. * module/system/repl/command.scm (tracepoint): New command, installs a tracepoint on a procedure. 2010-09-23 Andy Wingo avoid traps in repl except when evaluating the expression * module/system/vm/trap-state.scm (with-default-trap-handler): Don't enable traps if we are setting a handler of #f. * module/system/repl/error-handling.scm (call-with-error-handling): Add #:trap-handler arg. * module/system/repl/repl.scm (run-repl): Only have traps enabled while running the thunk. Otherwise we trace on procedures called as part of the repl. 2010-09-23 Andy Wingo add trap-calls-to-procedure * module/system/vm/traps.scm (trap-frame-finish): Use frame-address instead of frame-dynamic-link. (trap-calls-to-procedure): New proc, traps on procedure calls and their corresponding returns. add scm_frame_address / frame-address * libguile/frames.h: * libguile/frames.c (scm_frame_address): New accessor, returns a frame's fp. 2010-09-23 Andy Wingo tracing in terms of traps * module/system/vm/traps.scm (trap-frame-finish) (trap-in-dynamic-extent, trap-calls-in-dynamic-extent) (trap-instructions-in-dynamic-extent): New traps, for implementing tracing, and the `finish' command. * module/system/vm/trace.scm (trace-calls-in-procedure) (trace-instructions-in-procedure): New tracing traps. (vm-trace): Reimplement in terms of the new traps. * module/system/vm/trap-state.scm (add-trap!): New helper; not used in this commit, though. 2010-09-22 Neil Jerram Explain examples of user-defined classes * doc/ref/goops.texi (User-defined classes): New text added to explain the example code. Explain built-in classes like * doc/ref/goops.texi (Built-in classes): New node. (User-defined classes): Show is-a? v and class-of v here, instead of in next node. (Asking for the class of an object): Deleted, no longer needed. 2010-09-22 Neil Jerram Improve GOOPS `Quick Start' doc * doc/ref/goops.texi (Quick Start): Remove words that only reiterate "quick start". * doc/ref/goops.texi (Methods, User-defined classes, Asking for the class of an object): Say "class" instead of "type". They are called classes elsewhere, and in an object-oriented system, people expect classes! 2010-09-22 Neil Jerram Move GOOPS chapter's Stk copyright notice upfront So as to enable more free refactoring of the rest of the chapter * doc/ref/goops.texi (Copyright Notice): New section containing the Stk copyright. * doc/ref/goops-tutorial.texi (Copyright): Equivalent section here deleted. 2010-09-22 Neil Jerram GOOPS doc simplification * doc/ref/goops.texi (GOOPS): Simplify the introductory blurb. 2010-09-21 Andy Wingo (system repl command) cleanups * module/system/repl/command.scm (profile, trace, inspect) (pretty-print): Use repl-prepare-eval-thunk instead of the lower-level compile and make-program. 2010-09-21 Andy Wingo breakpoints from recursive prompts work * module/system/vm/traps.scm (new-disabled-trap): Don't manipulate the VM trace level in the enable and disable handlers. Unfortunately, this makes traps not work unless you enable hooks, but given that vm_dispatch_hook has to set trace-level to 0, there needs to be an object with a broader view of what traps are enabled. That object is the hook state. * module/system/vm/trap-state.scm (trap-state->trace-level): New procedure. (with-default-trap-handler): Add an optional trap-state argument. Now makes sure that the vm-trace-level is set appropriately during the execution of the thunk, allowing for breakpoints from recursive prompts. 2010-09-20 Ludovic Courtès SRFI-1: Rewrite `alist-copy' in Scheme. This partially reverts commit b1fff4e793619b20342cba0015b9367680d3a0bd (Sat Apr 2 2005). * libguile/srfi-1.c (scm_srfi1_alist_copy): Remove. * libguile/srfi-1.h (scm_srfi1_alist_copy): Remove declaration. * module/srfi/srfi-1.scm (alist-copy): New procedure. 2010-09-20 Ludovic Courtès Remove the SRFI-1 C proxies. * libguile/srfi-1.c (srfi1_module, CACHE_VAR): Remove. (scm_srfi1_break, scm_srfi1_break_x, scm_srfi1_car_plus_cdr, scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_eighth, scm_srfi1_fifth, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_lset_adjoin, scm_srfi1_ninth, scm_srfi1_not_pair_p, scm_srfi1_reduce, scm_srfi1_reduce_right, scm_srfi1_seventh, scm_srfi1_sixth, scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x, scm_srfi1_tenth, scm_srfi1_xcons): Remove. * libguile/srfi-1.h: Remove the corresponding declarations. 2010-09-19 Andy Wingo default-trap-handler bugfix * module/system/vm/trap-state.scm (default-trap-handler): Fix thinko. 2010-09-19 Göran Weinholt Fix make-variable-transformer export * module/rnrs/syntax-case.scm: Add make-variable-transformer to the imports. This was causing an unbound variable error even though (rnrs) had been imported. 2010-09-19 Andy Wingo add ,traps ,delete ,disable ,enable * module/system/repl/command.scm (traps, delete, disable, enable): New meta-commands. 2010-09-19 Andy Wingo implement breakpoints in the repl * module/system/vm/trap-state.scm: New file, tracks a VM-specific set of traps. * module/Makefile.am: Add trap-state.scm. * module/system/repl/error-handling.scm: While in a with-error-handling block, bind a default trap handler that invokes a recursive prompt. * module/system/repl/command.scm: Add a `break' repl meta-command. 2010-09-17 Andy Wingo add (system vm traps) * module/system/vm/traps.scm: New module, implements higher-level traps based on the VM hooks. Inspired by (ice-9 debugging traps). Instead of the ice-9's variety, these traps have a procedural interface instead of a GOOPS interface. * module/Makefile.am: Add the new module. 2010-09-17 Andy Wingo vm hooks run without hooks * libguile/vm.c (vm_dispatch_hook): Run hooks with the trace-level set to 0. We really don't want hooks running while hooks are running. 2010-09-16 Andy Wingo fix bad Makefile.am addition instruction tracing tweak * module/system/vm/trace.scm (vm-trace): No need to output the opcode number, and display the ip as a decimal, not a hexidecimal. only trace instructions inside the thunk * module/system/vm/trace.scm (vm-trace): Only trace instructions when we're in the dynamic extent of the thunk. update vm hooks doc * doc/ref/api-evaluation.texi (VM Behaviour): Half-hearted doc update. 2010-09-16 Andy Wingo add vm-abort-continuation-hook, vm-restore-continuation-hook * libguile/vm-i-system.c (call_cc, tail_call_cc): Call the new RESTORE_CONTINUATION_HOOK when a continuation is restored. (prompt): Call the new ABORT_CONTINUATION_HOOK when entering the abort handler's continuation. * libguile/vm-engine.h (ABORT_CONTINUATION_HOOK) (RESTORE_CONTINUATION_HOOK): * libguile/vm.h (SCM_VM_ABORT_CONTINUATION_HOOK) (SCM_VM_RESTORE_CONTINUATION_HOOK): * libguile/vm.c: (scm_vm_abort_continuation_hook): New hook, called when entering an abort handler. (scm_vm_restore_continuation_hook): New hook, called after returning to a continuation. * module/system/vm/vm.scm: Add hooks to export list. 2010-09-16 Andy Wingo trim our set of vm hooks * libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK) (SCM_VM_POP_CONTINUATION_HOOK): New hooks, to replace enter/exit/return. (SCM_VM_BOOT_HOOK, SCM_VM_HALT_HOOK, SCM_VM_BREAK_HOOK): Remove these useless hooks. * libguile/vm.c (scm_vm_push_continuation_hook) (scm_vm_pop_continuation_hook): New accessors. * libguile/vm-i-system.c: Remove boot, halt, break, enter, exit, and return hooks. Also remove the break instruction. Instead now when we push a new continuation onto the stack we call PUSH_CONTINUATION_HOOK, and when we pop via a return we call POP_CONTINUATION_HOOK. APPLY_HOOK is now decoupled from continuation pushes and pops. * libguile/vm-engine.h: * libguile/vm-engine.c: Adapt for hooks. * module/system/vm/trace.scm (vm-trace): Adapt for hooks. Also revive the #:instructions? #t mode. * module/system/vm/vm.scm: Adapt exports for new set of hooks. 2010-09-16 Andy Wingo remove unused (system vm profile) * module/Makefile.am: * module/system/vm/profile.scm: Remove (system vm profile). We use statprof. 2010-09-15 Ludovic Courtès Fix write-beyond-end-of-string error in the conversion to R6RS string escapes. Reported by Mike Gran . * libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes, scm_i_unistring_escapes_to_r6rs_escapes): Augment comments. (scm_to_stringn): When `handler == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE && SCM_R6RS_ESCAPES_P', realloc BUF so that it's large enough for the worst case. * libguile/print.c (display_character): When `result != NULL && strategy == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE && SCM_R6RS_ESCAPES_P', make LOCALE_ENCODED large enough to hold an R6RS escape. 2010-09-15 Ludovic Courtès Optimize `peek-char'. This makes `peek-char' 40x faster on a port whose encoding is faster on a UTF-8 port containing multi-byte codepoints. The `xml->sxml' procedure is 4x faster on a 2.7 MiB XML file. * libguile/ports.c (get_codepoint): New procedure, moved here from `scm_getc', with the additional BUF and LEN parameters. (scm_getc): Use it. (scm_peek_char): Use it instead of the `scm_getc'/`scm_ungetc' sequence. * test-suite/tests/ports.test ("string ports")["peek-char [latin-1]", "peek-char [utf-8]"]: New tests. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/ports.bm'. * benchmark-suite/benchmarks/ports.bm: New file. 2010-09-15 Ludovic Courtès Fix copyright year and module name of `write.bm'. * benchmark-suite/benchmarks/write.bm: Fix copyright year and module name. 2010-09-15 Ludovic Courtès Re-introduce pretty-printing of combining characters. This had been removed by commit 07f49ac786e0f1c007eb336e2fb7a572e8405316 ("Factorize and optimize `write' for strings and characters."). Thanks Mike! * libguile/print.c (write_combining_character): New procedure. (write_character): Use it. * test-suite/tests/chars.test ("basic char handling")["combining accent is pretty-printed", "combining X is pretty-printed"]: New tests. * test-suite/tests/encoding-iso88591.test ("characters")["write A followed by combining accent"]: New test. * test-suite/tests/encoding-utf8.test ("characters")["write A followed by combining accent"]: New test. 2010-09-14 Ludovic Courtès Remove commented out code from `print.c'. * libguile/print.c (scm_write, scm_display, scm_write_char): Remove `#if 0'-d code. 2010-09-14 Ludovic Courtès Factorize and optimize `write' for strings and characters. According to `write.bm', this makes `write' 2.6 times faster for strings. * libguile/print.c (iprin1): Use `write_character' when `SCM_WRITINGP (pstate)' and `SCM_CHARP (exp)' or `scm_is_string (exp)'. (scm_i_charprint): Remove. (display_character, write_character): New functions. (scm_write_char): Use `display_character' instead of `scm_i_charprint'. * libguile/print.h (scm_i_charprint): Remove declaration. * benchmark-suite/benchmarks/write.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/write.bm'. 2010-09-14 Ludovic Courtès Internally expose `scm_i_unistring_escapes_to_{guile,r6rs}_escapes'. * libguile/strings.c (unistring_escapes_to_guile_escapes): Rename to... (scm_i_unistring_escapes_to_guile_escapes): ... this. Change `char **bufp' to `char *buf'; leave realloc responsibility to the caller. Update caller. (unistring_escapes_to_r6rs_escapes): Rename to... (scm_i_unistring_escapes_to_r6rs_escapes): ... this. Likewise. 2010-09-12 Andy Wingo doc/ref lib-version.texi removal * doc/ref/.gitignore: * doc/ref/Makefile.am: * doc/ref/guile.texi: Remove rules for generating an unused lib-version.texi. libguile gitignore * libguile/.gitignore: Fix for recent cpp-{E,SIG} change. build tweak to remove SRFI version definitions * GUILE-VERSION: Remove SRFI version definitions, as they are no longer needed. 2010-09-12 Andy Wingo move srfi-1 and srfi-60 C impl to libguile, without public C api * libguile/srfi-1.c: * libguile/srfi-1.h: * libguile/srfi-60.c: * libguile/srfi-60.h: * libguile/ChangeLog-srfi: Move here, from the srfi/ dir. The C API is internal. Add API to register the extensions, called by init.c. * libguile/init.c: Verily, register srfi extensions. * libguile/Makefile.am: Add srfi files. * module/srfi/srfi-1.scm: * module/srfi/srfi-60.scm: Update load-extension invocation. * Makefile.am: * configure.ac: Remove srfi/ dir. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-srfi-1.c: Remove srfi-1 C test, we don't support this API any more. 2010-09-12 Andy Wingo remove empty srfi-4, srfi-13, and srfi-14 shlibs * srfi/srfi-13.c: * srfi/srfi-13.h: * srfi/srfi-14.c: * srfi/srfi-14.h: * srfi/srfi-4.c: * srfi/srfi-4.h: * srfi/Makefile.am: * configure.ac: Remove empty shlibs and headers for srfis 4, 13, and 14. The "version" was never programmatically exported, so there's no possible way people could have used these. 2010-09-12 Neil Jerram Create tags for Scheme source * am/guilec: Set ETAGS_ARGS. * module/Makefile.am: When adding sources to EXTRA_DIST, add them to ETAGS_ARGS too. 2010-09-12 Michael Gran Provide non-locale C/Scheme string conversion functions * doc/ref/api-data.texi: document scm_to_stringn, scm_from_stringn, scm_to_latin1_stringn, and scm_from_latin1_stringn * libguile/strings.h (scm_to_stringn): make public (scm_to_latin1_stringn): new declaration (scm_from_latin1_stringn): new declaration * libguile/strings.c (scm_to_latin1_stringn): new function (scm_from_latin1_stringn): new function 2010-09-11 Neil Jerram Document scm_wrong_type_arg_msg * doc/ref/api-control.texi: New def for scm_wrong_type_arg_msg. Remove non-existent *environment* APIs from api-undocumented.texi * doc/ref/api-undocumented.texi: Remove entries for the never used, and now removed, environment API. Remove unnecessary blank "Indices" page. * doc/ref/guile.texi: Remove `Indices' heading. 2010-09-10 Andy Wingo new procedure: source-procedures * module/system/xref.scm (source-procedures): New public procedure, gives the procedures defined at a given source location. (system xref) uses module-submodules * module/system/xref.scm (ensure-callers-db): Fix up to use module-submodules. regenerate psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate. simplify module/Makefile.am rules to not require touch * module/Makefile.am (ice-9/psyntax-pp.go, ice-9/psyntax-pp.scm.gen) (ice-9/eval.go): Simplify rules to not require `touch', now that .go files are checked for freshness, not for synchronicity. 2010-09-08 Ludovic Courtès Clarify feature macro conditionals. * libguile/numbers.c (scm_log10): Check whether `HAVE_COMPLEX_DOUBLE' and `HAVE_CLOG10' are defined instead of checking whether they are non-zero. (scm_sqrt): Likewise for `HAVE_COMPLEX_DOUBLE' and `HAVE_USABLE_CSQRT'. 2010-09-08 Ludovic Courtès Use Gnulib's `isnan' and `isinf' modules. This updates Gnulib to v0.0-4219-g84cdd8b. * m4/gnulib-cache.m4: Add `isinf' and `isnan'. * configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and `nan.h'. * libguile/gen-scmconfig.c (main): Remove definitions of `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and `SCM_HAVE_NAN_H'. * libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove. (isinf)[SCO && !HAVE_ISINF]: Remove. (xisinf, xisnan): Remove. Change callers to use `isinf' and `isnan'. (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define HAVE_ISNAN' conditions. * libguile/numbers.h: Remove code conditional on `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'. 2010-09-06 Ludovic Courtès Use `have-lib' when checking for libltdl. Suggested by primus . * configure.ac: Use `AC_LIB_HAVE_LINKFLAGS' when checking for libltdl. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): Add $(LTLIBLTDL). * README: Update to make it clear that libgc and libffi don't have a `--with-XXX-prefix' option. 2010-09-06 Ludovic Courtès Rename `make-foreign-function' to `pointer->procedure'. * libguile/foreign.c (scm_make_foreign_function): Rename to... (scm_pointer_to_procedure): ... this. * libguile/foreign.h: Adjust accordingly. * module/system/foreign.scm: Likewise. * test-suite/standalone/test-ffi: Likewise. * test-suite/tests/foreign.test: Likewise. * doc/ref/api-foreign.texi: Likewise. 2010-09-06 Andy Wingo fix to program-module * libguile/programs.c (scm_program_module): Fix an edge case in which this function returned non-modules. Thanks to José Antonio Ortega Ruiz, Caballero del Cálculo Lambda for the report. 2010-09-04 Ludovic Courtès Add `.version' to the distribution. * Makefile.am (EXTRA_DIST): Add `.version'. Remove `m4/autobuild.m4'. Bump version number for 1.9.12. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2010-09-04 Andy Wingo fix guile-tools --help and --version * meta/guile-tools.in: Fix --help and --version. boot-9 refactor * module/ice-9/boot-9.scm (make-root-module, make-scm-module): Remove these functions; they are only called once, so we inline them at their call sites. (the-root-module, the-scm-module): The aforementioned call sites. 2010-09-04 Ludovic Courtès Update `NEWS' for 1.9.12. * NEWS: Update. Don't say "source file is newer" when either file is inaccessible. * libguile/load.c (compiled_is_fresh): Don't emit "source file is newer" warning when either FULL_FILENAME or COMPILED_FILENAME could not be stat'd. This is consistent with what load/compiled-file-name do. 2010-09-04 Ludovic Courtès Compare source/compiled file timestamps with nano-second resolution. * libguile/load.c (compiled_is_fresh): Rename `res' to `compiled_is_newer'. Use `get_stat_mtime' to compare with nano-second resolution when available. * module/ice-9/boot-9.scm (load)[fresh-compiled-file-name]: Likewise, using `stat:mtimensec'. 2010-09-04 Ludovic Courtès Use Gnulib's `stat-time' module; update Gnulib. This updates Gnulib files to v0.0-4207-gc82b481. * m4/gnulib-cache.m4: Add `stat-time'. 2010-09-04 Ludovic Courtès Add an entertaining `procedure->pointer' test. * test-suite/tests/foreign.test ("procedure->pointer")["bijection"]: New test. 2010-09-03 Ludovic Courtès Fix the `put-bytevector' tests. * libguile/vports.c (sf_write): Add comment about what happens when DATA contains binary data. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector [2 args]", "put-bytevector [3 args]", "put-bytevector [4 args]"]: Require a Latin-1 locale. 2010-09-03 Ludovic Courtès Add license header to `test-ffi'. * test-suite/standalone/test-ffi: Add license header. 2010-09-03 Ludovic Courtès Add `procedure->pointer' to the FFI. * libguile/foreign.c (make_cif): New procedure, with code formerly in `scm_make_foreign_function'. (scm_make_foreign_function): Use it. (invoke_closure, scm_procedure_to_pointer)[FFI_CLOSURES]: New functions. * libguile/foreign.h (scm_procedure_to_pointer): New declaration. * module/system/foreign.scm: Export `procedure->pointer' when available. * test-suite/standalone/test-ffi (f-callback-1, f-callback-2): New procedures and related tests. * test-suite/standalone/test-ffi-lib.c (test_ffi_callback_1, test_ffi_callback_2): New functions. * test-suite/tests/foreign.test ("procedure->pointer"): New test prefix. * doc/ref/api-foreign.texi (Dynamic FFI): Document `procedure->pointer'. 2010-09-03 Jose A. Ortega Ruiz Fix for `submodules' in (ice-9 session) (closes #30062) * module/ice-9/session.scm (submodules): replace implementation to use `module-submodules' instead of `module-obarray' (the latter doesn't include submodules anymore). * test-suite/tests/session.test: new test suite for session, checking the exported procedures that use `submodules'. 2010-09-03 Andy Wingo module-ref-submodule deprecation fixes * module/ice-9/boot-9.scm (module-ref-submodule) (module-define-submodule!): Pull deprecated shims here, as we need them before loading (ice-9 deprecated). Also bugfix to only define the module if there is no local variable, even if it is unbound. * module/ice-9/deprecated.scm: Remove from here. 2010-09-03 Andy Wingo back-compat in (rnrs) for deprecated modules-in-value-namespace * module/rnrs.scm (rnrs): Work around some unavoidable (I think) behavior when back-compatible unified namespaces are enabled; see comments in source. module-local-variable optimization * libguile/modules.c (scm_module_local_variable): An optimization in the common no-module-binder case. 2010-09-02 Ludovic Courtès Fix memory leak in `lock-mutex' (aka. `scm_lock_mutex'.) The memory leak is trivially reproducible with: (define m (make-mutex)) (let loop () (lock-mutex m) (unlock-mutex m) (loop)) or similarly with: (define p (delay (+ 1 2))) (let loop () (force p) (loop)) since `force' acquires P's mutex. It could also lead to premature release of a thread waiting in `fat_mutex_lock' when a former owner's `do_thread_exit' is run. * libguile/threads.c (fat_mutex_unlock): When `m->level' becomes 0, remove MUTEX from `t->mutexes'. (fat_mutex_lock): Update comment above the `t->mutexes' assignment. (do_thread_exit): Add an assertion making sure that each mutex in `t->mutexes' is owned by T. 2010-09-02 Ludovic Courtès Avoid calls to `scm_current_thread' in `fat_mutex_unlock'. * libguile/threads.c (fat_mutex_unlock): Use `t->handle' instead of calling `scm_current_thread'. 2010-09-02 Ludovic Courtès Fix typos. * module/system/repl/repl.scm (run-repl): Fix variable name: `k', not `key'. * module/texinfo/docbook.scm: Use `(srfi srfi-1)' for `fold'. 2010-09-02 Ludovic Courtès SRFI-1: Rewrite `drop-right!', `drop-while', `reduce', etc. in Scheme. This partially reverts commit e9508fbb7df0b1ead007637f16d80cf831776307 (May 3 2005). * module/srfi/srfi-1.scm (take!, drop-right!, reduce, reduce-right, take-while, take-while!, drop-while, span, span!, lset-adjoin): New procedures. * srfi/srfi-1.c (scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_lset_adjoin, scm_srfi1_reduce, scm_srfi1_reduce_right, scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x): Rewrite as proxies to the corresponding Scheme procedures. * benchmark-suite/benchmarks/srfi-1.bm ("drop-while"): New benchmark prefix. 2010-09-01 Ludovic Courtès Rewrite `fport_flush' using Gnulib's `full_write'. * libguile/fports.c (fport_flush): Rewrite using `full_write'. popen.test: Don't auto-compile `popen-child.scm'. * test-suite/tests/popen.test ("open-output-pipe")["no duplicate"]: Disable auto-compilation of `popen-child.scm'. Add `test-suite/tests/popen-child.scm' to the distribution. * test-suite/Makefile.am (SCM_TESTS): Add `tests/popen-child.scm'. 2010-08-31 Jose A. Ortega Ruiz Add new debug meta-command ,error-message * module/system/repl/error-handling.scm: use the error string to construct the instance. * module/system/repl/command.scm: new debug command `error-message' that extracts the new field, available to stack commands as `message'. * doc/ref/scheme-using.texi: documentation for new command. * module/system/repl/debug.scm: stores the error string in a new field. 2010-08-30 Andy Wingo fix #y back-compat shim * module/ice-9/deprecated.scm (#\y): #y was in fact a syntax for s8vectors, not bitvectors. Fix. 2010-08-30 Andy Wingo bitvector work * test-suite/Makefile.am: * test-suite/tests/bitvectors.test: Add a new file to test bitvectors. * libguile/uniform.c (scm_c_uniform_vector_length): Don't call scm_uniform_vector_elements, as we don't need to be able to access the elements with pointers to bytes. Fixes uniform-vector-length on bitvectors. 2010-08-30 Andy Wingo docstrings in syntax-rules * module/ice-9/psyntax.scm (syntax-rules): Allow a docstring between the literals and the first clause. 2010-08-29 Andy Wingo define* usage in boot-9 * module/ice-9/boot-9.scm (make-module, make-mutable-parameter): Use define*. 2010-08-29 Andy Wingo add flag to vtables to indicate that their layout is valid * libguile/struct.h (SCM_VTABLE_FLAG_VALIDATED): New flag, indicates that the layout of a vtable has been validated. The other flags have been renumbered. * libguile/struct.c (scm_i_struct_inherit_vtable_magic): Set the VALIDATED flag if everything goes through. (scm_struct_vtable_p): If the struct should be a vtable but isn't validated, throw an error. (scm_make_vtable_vtable): Validate the incoming user_fields layout bit. Set the VALIDATED flag. (scm_c_make_structv): Add a comment about the case in which we delay scm_i_struct_inherit_vtable_magic. 2010-08-28 Andy Wingo deprecate passing a number as the destination to `format' * module/ice-9/format.scm (format): Deprecate having a number as the destination. * doc/ref/misc-modules.texi (Formatted Output): Update docs. threadsafety in deprecation, extensions * libguile/deprecation.c (scm_c_issue_deprecation_warning): * libguile/extensions.c (scm_c_register_extension, load_extension): Add locks around global data structures. net-db.test tweak * test-suite/tests/net-db.test: Throw 'unresolved if we have a crap DNS that is returning results for all addresses. threadsafe object properties * libguile/objprop.c: Add locking around the properties weak hash, to avoid corrupting the whash. README fix for PKG_CONFIG=true * README: Add note that if you override pkg-config, you need to set libffi flags as well. Thanks to Mark Weaver. 2010-08-28 Andreas Rottmann Several fixes to R6RS libraries * module/rnrs/arithmetic/fixnums.scm (fixnum-width): Make this return an an exact integer instead of an inexact number. * module/rnrs/base.scm (assertion-violation): Implement. * module/rnrs/conditions.scm (simple-conditions): Allow also simple conditions as argument. * module/rnrs/enums.scm (define-enumeration): Properly construct empty enumeration sets. * module/rnrs/exceptions.scm (guard): Don't restrict the body to a single expression. * module/rnrs/records/syntactic.scm (define-record-type0): Expand into a series of definitions only. 2010-08-27 Andy Wingo Revert "don't autocompile while snarfing" This reverts commit 176ee5c82a9e6c775722cfe96711f2a02cdb7672, which added autocomp inhibitions in the wrong place. 2010-08-27 Andy Wingo Revert "[build] Rewrite guile-func-name-check in Scheme, adding features." This reverts commit 6832604efa0f175a70be700624c365547fb27878. Not only does this fail on a fresh build due to a lack of "guile", but even if it did have its Makefile fixed, it would take too long to run, because the rest of Guile isn't compiled. The right thing is to avoid invoking Guile until after at least psyntax and boot-9 have been compiled. This commit can be reinstated if we move doc snarfing to a phase that happens after module/ is compiled. 2010-08-27 Andy Wingo don't autocompile while snarfing * am/snarf (GUILE_SNARF): Don't autocompile while snarfing, as we probably don't have a compiled Guile at this point. 2010-08-27 Ludovic Courtès Document (ice-9 match). * doc/ref/Makefile.am (guile_TEXINFOS): Add `match.texi'. * doc/ref/guile.texi (Guile Modules): Include `match.texi'. * doc/ref/match.texi: New file. * doc/ref/sxml-match.texi (sxml-match): Add xref to `match.texi'. * module/ice-9/match.scm: Note lack of support for `(pat => exp)'. 2010-08-27 Ludovic Courtès SRFI-1: Choose better benchmark names. * benchmark-suite/benchmarks/srfi-1.bm ("fold"): Rename sub-tests to "big" and "small". 2010-08-27 Ludovic Courtès SRFI-1: Rewrite `break' and `break!' in Scheme. This partially reverts commit 6e9f3c2676c0101590d4229653e9c628cb293064 (Tue May 3 2005). * module/srfi/srfi-1.scm (break, break!): New procedures. * srfi/srfi-1.c (scm_srfi1_break, scm_srfi1_break_x): Rewrite as proxies to the corresponding Scheme procedures. * test-suite/standalone/test-srfi-1.c (failure): New function. (tests): Add `scm_srfi1_break' test. Use `failure'. 2010-08-27 Ludovic Courtès SRFI-1: Rewrite `fifth', `sixth', etc. in Scheme. This partially reverts commit 03731332d5dc8d650b947f5126427402c2b1d8bb (Tue May 3 2005). * module/srfi/srfi-1.scm (fifth, sixth, seventh, eighth, ninth, tenth): New procedures. * srfi/srfi-1.c (scm_srfi1_fifth, scm_srfi1_sixth, scm_srfi1_seventh, scm_srfi1_eighth, scm_srfi1_ninth, scm_srfi1_tenth): Rewrite as proxies to the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("eighth")["() -1"]: Change exception type to `exception:wrong-type-arg'. ("fifth")["() -1"]: Likewise. ("ninth")["() -1"]: Likewise. ("seventh")["() -1"]: Likewise. ("sixth")["() -1"]: Likewise. ("tenth")["() -1"]: Likewise. 2010-08-27 Ludovic Courtès Remove unneeded #:use-module. * module/system/vm/frame.scm: Remove use of (srfi srfi-1). 2010-08-27 Ludovic Courtès Assorted `syntax-check' fixes. * doc/ref/Makefile.am ($(snarf_doc).am): Untabify. * libguile/eval.c: Remove unnecessary inclusion. * .x-sc_m4_quote_check: Update. * libguile/error.c (scm_error_scm): Use `EXIT_FAILURE' instead of 1. * libguile/init.c (fixconfig, scm_boot_guile): Likewise. * libguile/null-threads.h (scm_i_pthread_exit): Likewise. * libguile/script.c (scm_compile_shell_switches): Likewise. * test-suite/standalone/test-conversion.c: Likewise. * test-suite/standalone/test-list.c: Likewise. * test-suite/standalone/test-unwind.c: Likewise. * libguile/async.c: Remove unnecessary inclusion of . * NEWS: "filesystem" -> "file system". * doc/ref/r6rs.texi: Ditto. * cfg.mk (local-checks-to-skip): New variable. * .x-sc_m4_quote_check, .x-sc_obsolete_symbols, .x-sc_program_name, .x-sc_prohibit_atoi_atof, .x-sc_prohibit_magic_number_exit: New files. * .gitignore: Update. 2010-08-27 Andy Wingo fix docs * doc/ref/compiler.texi (Tree-IL): Fix docs for external representation of letrec. Thanks to No Itisnt. 2010-08-26 Thien-Thi Nguyen [build] Rewrite guile-func-name-check in Scheme, adding features. * libguile/guile-func-name-check: Rewrite in Scheme; add inhibition directives, string-literal handling, failureful exit on error. * libguile/guile-snarf-docs.in: Use ‘@top_builddir@/meta/guile’. * libguile/pairs.c: Add guile-func-name-check inhibition directive. [build] Refine libguile/*.doc snarfing. * libguile/guile-snarf-docs.in: Rewrite to incorporate all three phases of snarfing: func-name check, cpp, tokenization. Also, require/check new command-line syntax. * libguile/Makefile.am (AM_V_FILTER): Delete var. (AM_V_FILTER_, AM_V_FILTER_0): Likewise. (.c.doc): Run ./guile-snarf-docs; use new command-line syntax. 2010-08-25 Andy Wingo consolidate sitedir definition * configure.ac (sitedir): Fix definition to point to the version-specific sitedir. * libguile/Makefile.am (libpath.h): Take sitedir definition from configure.ac. 2010-08-25 Andy Wingo update download location in manual * doc/ref/intro.texi (Obtaining and Installing Guile): Update download location. 2010-08-19 Thien-Thi Nguyen [build] Use AM_SILENT_RULES for generating cpp-E.c, cpp-SIG.c. * libguile/Makefile.am (.syms.c): Prefix first command with $(AM_V_GEN); unconditionally silence second command. 2010-08-19 Andy Wingo objcodes.c comments * libguile/objcodes.c: Comments from Noah Lavine 2010-08-19 Noah Lavine Whitespace fix Add a space in libguile/objcodes.c to comply with the GNU Coding Standards. 2010-08-18 Thien-Thi Nguyen [build] Fix sed portability bug: Don't use '\n' in sed script. Regression introduced 2010-07-22, "[build] Overhaul , cpp symbol extraction/checking". See: * libguile/Makefile.am (.syms.c): Convert one-liner sed script to while-read-echo loop. 2010-08-18 Thien-Thi Nguyen [build] Create libguile/version.h using the configure script. * configure.ac (AC_CONFIG_FILES): Add libguile/version.h. * libguile/Makefile.am (version.h): Delete target. (EXTRA_DIST): Remove version.h.in. (BUILT_SOURCES): Remove version.h. (MOSTLYCLEANFILES): Remove version.h, version.h.tmp. * libguile/version.h.in (SCM_MAJOR_VERSION): Use conventional @VAR@ instead of @-VAR-@ for ‘GUILE_MAJOR_VERSION’. (SCM_MINOR_VERSION, SCM_MICRO_VERSION, SCM_EFFECTIVE_VERSION): Likewise for ‘GUILE_MINOR_VERSION’, ‘GUILE_MICRO_VERSION’, ‘GUILE_EFFECTIVE_VERSION’. 2010-08-17 Andy Wingo update scsh doc * doc/ref/scsh.texi (The Scheme shell (scsh)): Remove broken link to arglist.com/guile/, and add note about bitrotting. further discouraged excision * libguile/gen-scmconfig.h.in: Remove a DISCOURAGED define. 2010-08-17 Andy Wingo a number of doc fixes * doc/ref/api-control.texi (Handling Errors): Update docs for display-error. * libguile/backtrace.h (scm_i_display_error): Change prototype to s/stack/frame/. * libguile/throw.c (handler_message): Change invocation of scm_i_display_error to pass a frame. * doc/ref/api-deprecated.texi (Deprecation): Update wording. * doc/ref/api-evaluation.texi (Local Evaluation): Remove section on local-eval. * doc/ref/api-macros.texi: Fix a couple typos. * doc/ref/api-memory.texi (Objects): Remove terrible section. * doc/ref/api-procedures.texi (Procedure Properties): Remove docs for closure?. (Compiled Procedures): Update wording. * doc/ref/guile.texi (API Reference): Remove reference to "Objects". 2010-08-17 Andy Wingo minor NEWS tweaks * NEWS: Minor tweaks. reindent psyntax.scm * module/ice-9/psyntax.scm: Reindent. 2010-08-17 Andy Wingo update comments in psyntax.scm * module/ice-9/psyntax.scm: Update comments. Fix a couple of needless conses in and-map. * module/ice-9/psyntax-pp.scm (#{and-map*\ 35}): Regen. 2010-08-17 Andy Wingo @apply for multiple args in the boot memoizer * libguile/memoize.c (m_apply): Fix for multiple arguments, as in (@apply proc foo bar baz). 2010-08-16 Ludovic Courtès Fix i18n tests when no French locale is available. * test-suite/tests/i18n.test ("number->locale-string")["French"]: Move `under-french-locale-or-unresolved' within each `pass-if'. 2010-08-15 Andreas Rottmann Link test-srfi-1 to libguile as well With an installed copy of libguile in place, test-srfi-1 would be run using that instead of the in-tree libguile. * test-suite/standalone/Makefile.am (test_srfi_1_LDADD): Add libguile. 2010-08-15 Ludovic Courtès Add `string->pointer' and `pointer->string' to the FFI. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): New functions. * libguile/foreign.h (scm_string_to_pointer, scm_pointer_to_string): New declarations. * module/system/foreign.scm: Export `string->pointer' and `pointer->string'. * test-suite/tests/foreign.test ("pointer<->string"): New test prefix. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Add `string->pointer' and `pointer->string'. 2010-08-15 Ludovic Courtès Add `number->locale-string' tests. * test-suite/tests/i18n.test ("number->locale-string"): New test prefix. 2010-08-09 Julian Graham Explicit definitions for `memp' and `assp' in `(rnrs list)'; the predicate argument to Guile's `member' and `assoc' functions has a different expected arity. * module/rnrs/lists.scm (memp, assp): Wrap the predicate function with a two-argument wrapper before calling Guile's underlying implemenation. * test-suite/Makefile.am: Add test-suite/tests/r6rs-lists.test to SCM_TESTS. * test-suite/tests/r6rs-lists.test: New file. Explicit definitions for `vector-for-each' and `vector-map'; Guile's SRFI-1 `for-each' and `map' implementations do not operate on lists and vectors interchangeably. * module/rnrs/base.scm (vector-for-each, vector-map): New functions. * test-suite/Makefile.am: Add test-suite/tests/r6rs-base.test to SCM_TESTS. * test-suite/tests/r6rs-base.test: New file. 2010-08-08 Andy Wingo further rnrs incompat note * doc/ref/r6rs.texi: Note about rnrs io ports. 2010-08-08 Andy Wingo loose ends from "discouraged" removal * README: Remove docs on "discouraged". * configure.ac: Remove one more "discouraged" thing. * doc/ref/api-deprecated.texi: Rename from api-discdepr.texi, and remove sections on "discouraged". * doc/ref/Makefile.am: * doc/ref/guile.texi: Update referrers. 2010-08-08 Andy Wingo remove "discouraged" infrastructure * libguile/discouraged.h: Remove. * libguile/deprecated.c (scm_internal_select, scm_thread_sleep) (scm_thread_usleep): Deprecate formerly discouraged names. * libguile/eq.h (SCM_EQ_P): * libguile/pairs.h (SCM_NULLP, SCM_NNULLP, SCM_CONSP, SCM_NCONSP): * libguile/boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_BOOL): (SCM_NEGATE_BOOL, SCM_BOOL_NOT): Undiscourage these names, because I'm not sure deprecating them will do any good. * libguile.h: * libguile/gen-scmconfig.c: * libguile/numbers.c: * libguile/init.c: * libguile/Makefile.am: * configure.ac: Remove bits that referenced discouraged.h, and dealt with the "discouraging" system. 2010-08-08 Andy Wingo deprecated all discouraged functions * libguile/Makefile.am: * libguile/discouraged.c: Remove discouraged.c. * libguile/deprecated.c: * libguile/deprecated.h: * libguile/discouraged.h: All functions and declarations moved from discouraged.[ch] to deprecated.[ch], adding deprecation warnings. * libguile/init.c: Remove discouraged init. * libguile/numbers.c (scm_num2float, scm_num2double): Deprecate. * test-suite/standalone/test-num2integral.c: Port to modern API. 2010-08-08 Andy Wingo more r6rs incompat * doc/ref/r6rs.texi (R6RS Incompatibilities): Add section on string syntax. add section on toplevel expansion to r6rs incompatibilities * doc/ref/r6rs.texi (R6RS Incompatibilities): Add a section about toplevel expansion, before taking a look at fixing it... 2010-08-06 Andy Wingo more NEWS updates * NEWS: Update some more. fix stack narrowing for tail-call to throw * module/system/repl/debug.scm (narrow-stack->vector): Fix for the tail-call to `throw' case, as in `(quit)'. ,x unbound does not quit repl * module/system/repl/repl.scm (run-repl): Catch errors executing metacommands. Feature on top of feature... update NEWS for 1.9.12 (mostly) * NEWS: Update for 1.9.12. 2010-08-06 Andy Wingo add docs for extensiondir; misc other fixes * libguile/foreign.c (scm_i_pointer_print): Print in hexadecimal. * doc/ref/api-foreign.texi (Modules and Extensions): Update for "extensiondir", and a discussion of Guile versions. (Foreign Variables): Fix discussion of types. (Void Pointers and Byte Access): Fix typo. 2010-08-06 Andy Wingo remove type discusison from dynamic-pointer docstring * doc/ref/api-foreign.texi: * libguile/dynl.c (scm_dynamic_pointer): Remove discussion of types from the docstring. s/extensionsdir/extensiondir/ * libguile/Makefile.am (libpath.h): Change "extensionsdir" to "extensiondir". * meta/guile-2.0.pc.in (extensiondir): Likewise. 2010-08-06 Andy Wingo %site-dir is specific to the effective version * libguile/load.h: * libguile/load.c (scm_sys_global_site_dir): New API, is what %site-dir used to be. (scm_sys_site_dir): Changed to be a version-specific dir. (scm_init_load_path): Search the version-specific sitedir before the global one. * libguile/Makefile.am (libpath.h): Update SCM_SITE_DIR and SCM_GLOBAL_SITE_DIR, as appropriate. 2010-08-06 Andy Wingo only one Value History section * doc/ref/repl-modules.texi: Remove section on Value History, it's covered in scheme-using. * doc/ref/scheme-using.texi: Rename "Value Historyx" section to "Value History". * doc/ref/guile.texi: Update xref. add settable identifier syntax docs * doc/ref/api-macros.texi (Identifier Macros): Add documentation for settable identifier syntax. 2010-08-06 Andy Wingo letrec* in docs, and some r6rs fixes * doc/ref/api-binding.texi: Add docs for letrec*, and revise some other text. * doc/ref/compiler.texi: Update for in-order?. * doc/ref/r6rs.texi: Add letrec* entry. * module/rnrs.scm: * module/rnrs/base.scm: Export letrec*. 2010-08-05 Andy Wingo fold 1.9.11 news into main body * NEWS: Update. 2010-08-04 Andy Wingo fix vector-move-right! and vector-move-left! * libguile/vectors.c (scm_vector_move_left_x, scm_vector_move_right_x): Fix some bugs reported by Michael Lucy -- both variants would happily write beyond the end, and vector-move-right! didn't increment the counter before copying in the reverse direction. * test-suite/tests/vectors.test ("vector-move-left!"): ("vector-move-right!"): Add tests. 2010-08-04 Yan Li Compiling DOT_X_FILES requires version.h There was a race condition when building Guile since DOT_X_FILES didn't depend on version.h, which is dynamically generated. Sometimes the DOT_X_FILES are compiled before the version.h is generated and leads to build failure. This patch fixed this problem. 2010-08-01 Andreas Rottmann Fix the range of `random' on 64-bit platforms For > 32 bit integers still in the fixnum range, scm_random() would return random numbers with a lower range than specified. * libguile/random.c (scm_i_mask32): New static inline function. (scm_c_random): Use `scm_i_mask32'. (scm_c_random64): New function, 64-bit variant of scm_c_random. (scm_random): Use `scm_c_random64' instead of forming the 64-bit random number in a bogus way. * libguile/random.h: Added `scm_c_random64'. 2010-07-28 Ludovic Courtès Fix `parse-c-struct'. * module/system/foreign.scm (parse-c-struct): Update use of `pointer->bytevector' to the new API. * test-suite/tests/foreign.test ("structs"): New test prefix. 2010-07-28 Ludovic Courtès Update the FFI doc. * doc/ref/api-foreign.texi (Foreign Types): Remove bits about typed foreign pointers. Add `void'. (Foreign Variables): Update the doc of `dynamic-pointer' and the `numptob' example. Remove `foreign-set!' and `foreign-ref'. Add `pointer-address', `make-pointer', `%null-pointer', and `null-pointer?' (Void Pointers and Byte Access): Make it clear that wrapped pointers are untyped. Remove `void' from here. Replace `foreign->bytevector' and `bytevector->foreign' by `pointer->bytevector' and `bytevector->pointer'. Add `dereference-pointer' and the rest of the `numptob' example. (Dynamic FFI): Update examples. Remove `%null-pointer' from here. * libguile/dynl.c (scm_dynamic_pointer): Update docstring. * libguile/foreign.c (scm_dereference_pointer, scm_pointer_to_bytevector): Likewise. * module/system/foreign.scm (null-pointer?): Add docstring. 2010-07-28 Ludovic Courtès Remove unused parameter from `bytevector->pointer'. * libguile/foreign.c (scm_bytevector_to_pointer): Remove unused LEN parameter. Update docstring. Always return `%null-pointer' when creating a NULL pointer with no finalizer. * libguile/foreign.c (scm_make_pointer): Always call out to `scm_from_pointer'. (scm_from_pointer): Return NULL_POINTER when PTR and FINALIZER are NULL. 2010-07-28 Ludovic Courtès Use "pointer" instead of "foreign" when dealing with wrapped pointers. * libguile/foreign.h (scm_t_foreign_finalizer): Rename to... (scm_t_pointer_finalizer): ... this. (SCM_FOREIGN_P): Rename to... (SCM_POINTER_P): this. (SCM_VALIDATE_FOREIGN): Rename to... (SCM_VALIDATE_POINTER): ... this. (SCM_FOREIGN_HAS_FINALIZER): Rename to... (SCM_POINTER_HAS_FINALIZER): ... this. (scm_take_foreign_pointer): Rename to... (scm_from_pointer): ... this. (scm_foreign_address): Rename to... (scm_pointer_address): ... this. (scm_foreign_to_bytevector): Rename to... (scm_pointer_to_bytevector): ... this. (scm_foreign_set_finalizer_x): Rename to... (scm_set_pointer_finalizer_x): ... this. (scm_bytevector_to_foreign): Rename to... (scm_bytevector_to_pointer): ... this. (scm_i_foreign_print): Rename to... (scm_i_pointer_print): ... this. * libguile/foreign.c: Update accordingly. * libguile/tags.h (scm_tc7_foreign): Rename to... (scm_tc7_pointer): ... this. * libguile/foreign.c, libguile/deprecated.c, libguile/dynl.c, libguile/evalext.c, libguile/gc.c, libguile/goops.c, libguile/gsubr.c, libguile/gsubr.h, libguile/print.c, libguile/snarf.h, libguile/vm-i-system.c, module/system/foreign.scm, test-suite/standalone/test-ffi, test-suite/tests/foreign.test: Update accordingly. 2010-07-27 Andy Wingo 64-bit random fixes * libguile/random.c (scm_random): Fix generation of inum randoms with more than 32 bits. * libguile/random.h (scm_t_rstate): Fix a comment. 2010-07-26 Ludovic Courtès Add `dereference-pointer' to `(system foreign)'. * libguile/foreign.c (scm_dereference_pointer): New function. * libguile/foreign.h (scm_dereference_pointer): New declaration. * module/system/foreign.scm (dereference-pointer): Likewise. * test-suite/tests/foreign.test ("foreign<->bytevector")["dereference-pointer"]: New test. 2010-07-26 Ludovic Courtès Simplify the (system foreign) API. Suggested by Neil Jerram. * libguile/foreign.h (SCM_FOREIGN_TYPE, SCM_FOREIGN_VALUE_REF, SCM_FOREIGN_VALUE_SET, SCM_FOREIGN_LEN, SCM_FOREIGN_TYPED_P, SCM_FOREIGN_VALUE_P, SCM_VALIDATE_FOREIGN_VALUE, scm_foreign_set_x, scm_foreign_type): Remove. (scm_foreign_ref): Rename to... (scm_foreign_address): ... this. (scm_take_foreign_pointer): Update. (SCM_FOREIGN_POINTER): Remove CTYPE argument. Update callers. (scm_make_pointer): New declaration. * libguile/foreign.c (scm_to_uintptr, scm_from_uintptr): New macros. (scm_make_pointer): New function. (scm_take_foreign_pointer): Remove TYPE and LEN arguments. Update callers. (scm_foreign_ref): Remove to... (scm_foreign_address): ... this. Remove type-related code. (scm_foreign_set_x): Remove. (scm_foreign_to_bytevector): Change argument order; make LEN argument compulsory. (scm_i_foreign_print): Remove type printing. (unpack): Remove foreign-type checking. * libguile/deprecated.c (scm_dynamic_args_call): Update accordingly. * libguile/dynl.c (scm_dynamic_pointer): Remove the TYPE and LEN arguments; update callers. Update to the new foreign API. * libguile/dynl.h (scm_dynamic_pointer): Update. * libguile/gsubr.c (create_gsubr): Update to the new foreign API. * libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Ditto. * libguile/snarf.h (SCM_IMMUTABLE_FOREIGN): Ditto. * libguile/vm-i-system.c (subr_call): Ditto. * module/system/foreign.scm (null-pointer?): New procedure. * test-suite/standalone/test-ffi: Update to the new `bytevector->foreign' signature. * test-suite/tests/foreign.test ("null pointer")["null pointer identity", "null-pointer? %null-pointer"]: New tests. ["foreign-set! other-null-pointer", "foreign->bytevector other-null-pointer"]: Remove. ("make-pointer", "foreign<->bytevector"): New test prefixes. 2010-07-26 Ludovic Courtès Import unbound variable reports in the VM. * libguile/vm-engine.c (VM_NAME)[vm_error_unbound]: Add comment. * libguile/vm-i-system.c (variable_ref): Attempt provide the name of X in FINISH_ARGS. 2010-07-26 Ludovic Courtès Check for go/scm mtime ordering rather than equality. * am/guilec (install-data-hook): Remove. (guile_install_go_files): New variable. ($(guile_install_go_files)): New dependency. * libguile/load.c (compiled_is_fresh): Check for ordering of STAT_SOURCE and STAT_COMPILED, not equality. * module/ice-9/boot-9.scm (load): Ditto. * module/system/base/compile.scm (call-with-output-file/atomic): Don't set the timestamp of TEMPLATE. 2010-07-26 Andy Wingo rstates point to rngs * libguile/random.h (scm_t_rstate): Include the rng in the rstate, so we can actually have multiple rngs. Instead of reserved0 / reserved1, reserve a double explicitly for scm_c_normal01. (scm_c_uniform32): Change to call the rstate's rng. * libguile/random.c: Change to access an rstate's rng through its rng pointer. (scm_c_normal01): Instead of a flag and a next double, just check that the double is equal to 0.0. Excluding one value shouldn't affect the distribution, right? 2010-07-26 Andy Wingo update docs * doc/ref/api-data.texi: * libguile/random.c: Update datum->random-state and random-state->datum docs. 2010-07-26 Andy Wingo refactor datum->random-state / random-state->datum * libguile/random.c (scm_t_i_rstate): Move here from random.h, along with prototypes for functions (scm_i_uniform32, scm_i_init_rstate, scm_i_copy_rstate): Change to take a stock scm_t_rstate as an arg, and cast it. This way we don't cast the pointers below. (scm_i_rstate_from_datum, scm_i_rstate_from_datum): Same and rename from scm_i_init_rstate_scm / scm_i_expose_rstate. (scm_c_rstate_from_datum): Rename from scm_c_make_rstate_scm. (scm_datum_to_random_state, scm_random_state_to_datum): Rename from scm_external_to_random_state and scm_random_state_to_external. (scm_init_random): Remove casts. * libguile/random.h (scm_t_rng): Rename init_rstate_scm, expose_rstate vmethods to from_datum, to_datum. Remove internal definitions. Rename to scm_c_rstate_from_datum, and provide scm_random_state_to_datum and scm_datum_to_random_state. 2010-07-26 Andy Wingo low-level RNG interfaces deal in scm_t_uint32, not unsigned long * libguile/random.h (scm_t_rng): random_bits returns a scm_t_uint32. (scm_i_uniform32, scm_t_i_rstate): Internal RNG returns a scm_t_uint32, as advertised, instead of unsigned long. (scm_c_random): Return a scm_t_uint32 instead of an unsigned long. * libguile/random.c (scm_i_uniform32, scm_i_init_rstate_scm): (scm_i_expose_rstate, scm_c_random, scm_c_random_bignum, scm_random) (scm_init_random): Adapt types to match implementation. 2010-07-26 Andy Wingo remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64 * libguile/__scm.h: * libguile/numbers.h: * libguile/random.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/numbers.c: * test-suite/standalone/test-conversion.c: * libguile/gen-scmconfig.c: As we require 64-bit integers in configure.ac, remove conditional definition of 64-bit types. 2010-07-26 Andreas Rottmann Allow exposing of random number generator state Now the random number generator state can be obtained in external (i.e. `read'/`write'-able) form via the new procedure `random-state->external'. An externalized state can be reinstantiated by calling `external->random-state'. * libguile/random.c (scm_i_init_rstate_scm, scm_i_expose_rstate): New internal functions. * libguile/random.c (scm_c_make_rstate_scm, scm_external_to_random_state, scm_random_state_to_external): New public functions. * libguile/random.h: Add prototypes for the above functions. * libguile/random.h (scm_t_rng): Add new fields `init_rstate_scm' and `expose_rstate'. * libguile/random.c (scm_init_random): Initialize the new fields in `scm_the_rng'. 2010-07-24 Thien-Thi Nguyen Fix "make dist" regression: Distribute guile-func-name-check. Regression introduced 2010-07-22, "Avoid no-op config-subst for libguile/guile-func-name-check". * libguile/Makefile.am (noinst_SCRIPTS): Move guile-func-name-check from here... (EXTRA_DIST): ...to here. 2010-07-22 Thien-Thi Nguyen Update AUTHORS to reflect now-removed guile-snarf-docs-texi; nfc. 2010-07-22 Thien-Thi Nguyen [maint] Remove unused script guile-doc-snarf. * doc/ref/tools.texi (Doc Snarfing): Don't mention guile-doc-snarf. * configure.ac (libguile/guile-doc-snarf): Delete ‘GUILE_CONFIG_SCRIPT’. * libguile/Makefile.am (noinst_SCRIPTS): Remove guile-doc-snarf. * libguile/.gitignore: Remove guile-doc-snarf. * libguile/guile-doc-snarf.in: Delete file. * module/scripts/doc-snarf.scm: Comment munging; nfc. * AUTHORS: Update. 2010-07-22 Thien-Thi Nguyen Add copyright notice to acinclude.m4. * acinclude.m4: Add copyright notice, with years derived from "git log" output. [build] Move GUILE_CONFIG_SCRIPT to acinclude.m4. * configure.ac (GUILE_CONFIG_SCRIPT): Move from here... * acinclude.m4 (GUILE_CONFIG_SCRIPT): ...to here. [maint] Avoid no-op config-subst for libguile/guile-func-name-check. * configure.ac (libguile/guile-func-name-check): Remove ‘GUILE_CONFIG_SCRIPT’. * libguile/Makefile.am (.c.doc): Look in $(srcdir) for awk script. * libguile/guile-func-name-check: Rename from guile-func-name-check.in. [build] Overhaul , cpp symbol extraction/checking. * libguile/Makefile.am (BUILT_SOURCES): Delete cpp_err_symbols.c, cpp_sig_symbols.c; add cpp-E.c, cpp-SIG.c. (EXTRA_DIST): Delete cpp_signal.c, cpp_errno.c, cpp_err_symbols.in, cpp_err_symbols.c, cpp_sig_symbols.c, cpp_sig_symbols.in, cpp_cnvt.awk; add cpp-E.syms, cpp-E.c, cpp-SIG.syms, cpp-SIG.c. (error.x, posix.x): Update prereq list. (cpp_err_symbols.c, cpp_sig_symbols.c): Delete targets. (check_signals, check_errnos): Likewise. (.syms.c): New pattern rule. (chknew-E, chknew-SIG): New targets. (MOSTLYCLEANFILES): Delete cpp_err_symbols_here, cpp_err_symbols_diff, cpp_err_symbols_new, cpp_sig_symbols_here, cpp_sig_symbols_diff, cpp_sig_symbols_new. * libguile/cpp-E.syms: Rename from libguile/cpp_err_symbols.in. * libguile/cpp-SIG.syms: Rename from libguile/cpp_sig_symbols.in. * libguile/error.c (scm_init_error): #include "libguile/cpp-E.c". * libguile/posix.c (scm_init_posix): #include "libguile/cpp-SIG.c". * libguile/cpp_cnvt.awk: Delete file. * libguile/cpp_errno.c: Delete file. * libguile/cpp_signal.c: Delete file. 2010-07-21 Andy Wingo fix git-version-gen to work with bsd sed and obsolete regexps * configure.ac: Avoid + in git-version-gen sed script, as it doesn't work on BSD sed with obsolete regexps. 2010-07-21 Ludovic Courtès Start rewriting SRFI-1 in Scheme. This partially reverts commit e556f8c3c6b74ee6596e8dcbe829109d7745da2c (Fri May 6 2005). * module/srfi/srfi-1.scm (xcons, list-tabulate, not-pair?, car+cdr, last, fold, list-index): New procedures. * srfi/srfi-1.c (srfi1_module): New variable. (CACHE_VAR): New macro. (scm_srfi1_car_plus_cdr, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_not_pair_p, scm_srfi1_xcons): Rewrite as proxies of the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("list-tabulate")["-1"]: Change exception type to `exception:wrong-type-arg'. * benchmark-suite/benchmarks/srfi-1.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/srfi-1.bm'. * test-suite/standalone/Makefile.am (test_srfi_1_SOURCES, test_srfi_1_CFLAGS, test_srfi_1_LDADD): New variables. (check_PROGRAMS): Add `test-srfi-1'. (TESTS): Ditto. * test-suite/standalone/test-srfi-1.c: New file. 2010-07-21 Ludovic Courtès Add `vhash-fold*' in `(ice-9 vlist)'. * module/ice-9/vlist.scm (%vhash-fold*): New inline procedure. (vhash-fold*, vhash-foldq*, vhash-foldv*): New procedures. * test-suite/tests/vlist.test ("vhash")["vhash-fold*", "vhash-fold* tail", "vhash-fold* interleaved", "vhash-foldq* degenerate"]: New tests. * doc/ref/api-compound.texi (VHashes): Add `vhash-fold*' & co. 2010-07-19 Andreas Rottmann Fix random number generator on 64-bit platforms * libguile/random.c (scm_c_random): On platforms where `unsigned long' has 64 bit, generate up to 64 bit of randomness. This is expected by scm_c_random_bignum(), and hence was a serious distortion of the random value distribution for values exceeding 2^32. This change also fixes a crash when the `m' argument is a value above 2^32. 2010-07-17 Andy Wingo recommend #:replace * doc/ref/api-modules.texi (Creating Guile Modules): Update text to recommend #:replace. * module/srfi/srfi-19.scm (current-time): #:replace. use scm_malloc_pointerless to alloc aligned blocks in fallback * libguile/continuations.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY) (SCM_STATIC_ALIGNED_ARRAY) * libguile/control.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY) (SCM_STATIC_ALIGNED_ARRAY): Tweak backslashes. Use scm_malloc_pointerless to ensure alignment. SCM_I_FLUID_P -> SCM_FLUID_P * libguile/fluids.h (SCM_FLUID_P): Change from SCM_I_FLUID_P. (SCM_I_FLUID_NUM, SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Wrap in BUILDING_LIBGUILE ifdef. 2010-07-17 Michael Gran Enable character hex escapes by default R6RS character hex escapes do not conflict with legacy Guile octal character escapes, so they can be enabled by default. * libguile/read.c (scm_read_character): modified * test-suite/tests/reader.test: modify character escape tests * doc/ref/api-data.texi: modified * doc/ref/api-options.texi: modified 2010-07-17 Michael Gran open-file should handle binary mode and coding declarations The open-file port should use the 8-bit ISO-8859-1 encoding when a file is opened using mode "b". Also, it should honor a "coding:" declaration at the top of a file when reading files where it is present. * libguile/fports.c (scm_open_file): modified * test-suite/tests/ports.test: more tests for open-file * doc/ref/api-io.texi (File Ports): more documentation for open-file 2010-07-16 Andy Wingo remove (system vm debug) * module/system/vm/debug.scm: Remove. * module/Makefile.am: Update. * module/system/repl/debug.scm: Add some TODOs and a commented-out function here. 2010-07-16 Andy Wingo remove (ice-9 emacs) * module/ice-9/emacs.scm: Remove. * module/ice-9/deprecated.scm (load-emacs-interface): Remove wrapper with no callers. * module/Makefile.am: update. 2010-07-16 Andy Wingo gut ice-9 debug * module/ice-9/debug.scm: Gut, though we keep the module around for code Out There that uses it. * module/ice-9/top-repl.scm (top-repl): Don't import (ice-9 debug) * module/ice-9/debugger/commands.scm: * module/ice-9/debugging/trace.scm: * module/ice-9/emacs.scm: Remove ice-9 debug includes. 2010-07-16 Andy Wingo update tour.texi examples * doc/ref/tour.texi (Running Guile Interactively): Update examples for formatting. tour.texi updates * doc/ref/tour.texi: Update Guile prompts for scheme@(guile-user)>. Update output to assume value-history is on. Lop and crop the bug reporting section -- it was too long. update debugger docs * doc/ref/api-debug.texi (Debug on Error): Update xref. * doc/ref/scheme-using.texi (REPL Commands): New subsection. (Interactive Debugging): Rename from Interactive Debugger, to indicate that debugging is just part of the REPL. Update docs. updates to system repl command * module/system/repl/command.scm (help): Update docs on how to get help on a particular command. (load): Remove #:f flag. lower fill-column in .dir-locals.el * .dir-locals.el: Fill-columns back down to 72. 2010-07-16 Michael Gran read-line should use port's encoding, not locale's encoding * libguile/rdelim.c (scm_read_line): modified, use port's encoding * test-suite/test/ports.test: new test 2010-07-16 Michael Gran More explicit variable names in scm_i_scan_for_encoding Note especially that the variable 'i' has two different uses in this function, and they get confused. * libguile/read.c (scm_i_scan_for_encoding): cleanup 2010-07-15 Ludovic Courtès Remove heap allocations in `scm_getc', `scm_ungetc', and `find_valid_encoding'. * libguile/ports.c (scm_getc): Provide `u32_conv_from_encoding' with the RESULT_BUF stack-allocated buffer to avoid heap allocation. (find_valid_encoding): Likewise. (scm_ungetc): Ditto with `u32_conv_to_encoding'. 2010-07-15 Ludovic Courtès Expose `scm_encoding_error'. * libguile/strings.c (scm_encoding_error): Make public. * libguile/strings.h (scm_encoding_error): New internal declaration. 2010-07-15 Ludovic Courtès sxml-match: Always use the same prompt tag. * module/sxml/match.scm (%call/ec-prompt): New variable. (call/ec): Use it instead of creating a new prompt tag. Declare `ice-9/psyntax-pp.scm.gen' as a phony target. * module/Makefile.am (.PHONY): Add `ice-9/psyntax-pp.scm.gen'. 2010-07-15 Andy Wingo don't re-print the error by default in call-with-error-handling * module/system/repl/error-handling.scm (call-with-error-handling): Previous post-error changed to "report"; now "catch", the default, doesn't re-print the error. error-handling tweak * module/system/repl/error-handling.scm (call-with-error-handling): Remove extra newline. 2010-07-15 Andy Wingo better error reporting from the vm * libguile/vm-engine.c: Add func_name local, for error reporting. (vm_error_apply_to_non_list): New error case. (vm_error_wrong_type_arg): Remove this generic error case. (vm_error_wrong_type_apply): Remove FUNC_NAME -- no sense in seeing "vm-debug-engine" in the error report. (vm_error_not_a_pair, vm_error_not_a_bytevector) (vm_error_not_a_struct, vm_error_not_a_thunk): Use func_name instead of FUNC_NAME, so we can indicate what caused the error. * libguile/vm-i-scheme.c (VM_VALIDATE_CONS, car, cdr, set-car!) (set-cdr!): Indicate provenance of errors. (VM_VALIDATE_STRUCT, struct-vtable): (VM_VALIDATE_BYTEVECTOR, BV_FIXABLE_INT_REF, BV_INT_REF) (BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Same. * libguile/vm-i-system.c (apply, tail-apply): Use vm_error_apply_to_non_list. 2010-07-15 Andy Wingo pass a frame to display-error in system repl error-handling * module/system/repl/error-handling.scm (call-with-error-handling): Pass a frame to display-error. display-error takes a frame, shows source if possible * libguile/backtrace.h: * libguile/backtrace.c (scm_display_error): Change "stack" arg to "frame". Still accept stacks for backward compatibility. (display_header, display_error_body): Show the source of the error, if possible. 2010-07-14 Andy Wingo fix boostrapping error with srfi-1 (for the third time!) * module/ice-9/deprecated.scm (set-repl-prompt!): Avoid @, so as to avoid a bootstrapping error. Horrible. 2010-07-14 Julian Graham Fix argument passing for external hash functions in `(rnrs hashtables)'. Guile implements this library in terms of SRFI-69, which is a bit vague on the arity of hash functions, whereas `(rnrs hashtables)' explicitly specifies unary ones. * module/rnrs/hashtables.scm (wrap-hash-function): Assume SRFI-69 will pass the table capacity as the second argument; return the result of proc modulo the capacity. * test-suite/tests/r6rs-hashtables.test (make-hashtable): New test case for hash functions that return large values. 2010-07-13 Andy Wingo fix '(] infinite loop * libguile/read.c (scm_read_sexp): Fix reader infinite loop. Thanks to Bill Schottstaedt for the report. * test-suite/tests/reader.test: Add test. fix psyntax-pp.go dependency * module/Makefile.am (ice-9/psyntax-pp.go): Fix dep. ctrl-d with readline exits one recursive repl instance * module/ice-9/buffered-input.scm (make-buffered-input-port): Instead of always returning EOF once EOF is seen once, call the producer again. Allows Ctrl-D to cause one EOF at the REPL, returning once from a recursive edit, but input continues normally. Thanks to Andrew Bagdanov for a clue that led to the fix. don't automatically generate psyntax-pp.scm any more * module/Makefile.am (ice-9/psyntax-pp.scm.gen): No longer automatically regenerate psyntax-pp.scm, as the gensym dance is getting too complicated. Instead when you change psyntax.scm now you should make ice-9/psyntax-pp.scm.gen. 2010-07-13 Ludovic Courtès Have `benchmark-guile' honor the current $GUILE_LOAD_PATH. * benchmark-guile.in (GUILE_LOAD_PATH): Extend the current value instead of overwriting it completely. Add missing benchmark files to the distribution. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/chars.bm' and `benchmarks/srfi-13.bm'. 2010-07-13 Ludovic Courtès Fix type-checking in the optimized path of `string=?'. * libguile/srfi-13.c (scm_string_eq): Properly type-check S1 and S2. * test-suite/tests/strings.test ("string=?")["1st argument EOF", "2nd argument EOF"]: New tests exposing the problem. 2010-07-10 Andy Wingo print column numbers in backtraces * module/system/repl/debug.scm (print-frame): Print column numbers too. 2010-07-10 Andy Wingo finally, backtraces only showing frames for the computation * module/system/repl/repl.scm (run-repl): Run the thunk in a stack in a prompt, similar to the default prompt. Gives proper backtraces. * module/system/repl/error-handling.scm (call-with-error-handling): Narrow one more outer frame, for the %start-stack thunk invocation. * module/ice-9/boot-9.scm (%start-stack): Reindent. 2010-07-10 Andy Wingo update manual for value history on by default * doc/ref/compiler.texi: Update for new ,pp meta-command. * doc/ref/scheme-using.texi (Using Guile Interactively): Show value history in examples. (Value Historyx): Update docs to mention the repl option and the programmatic interface. 2010-07-10 Andy Wingo validating repl options; value-history on by default * module/system/repl/common.scm: Use (ice-9 history). Turns on value history by default. (repl-default-options): Expand the format of options to include an optional value transformer, run when setting a value. Add prompt and value-history options. (repl-prepare-eval-thunk): Use repl-option-ref. (repl-option-ref): Error if the option is unknown. (repl-option-set!, repl-default-option-set!): Error if the option is unknown. Pass the val through the transformer procedure. (repl-default-prompt-set!): Just use repl-default-option-set!. * module/system/repl/command.scm (option): Update for the new options format. 2010-07-10 Andy Wingo value-history-enabled? accessor * module/ice-9/history.scm (value-history-enabled?): Add accessor. (enable-value-history!, disable-value-history!): Adapt. heap/literal fixes for repl-default-options * module/system/repl/common.scm (repl-default-options): Heap-allocate the repl-default-options, to avoid mutating a literal. (make-repl): Copy repl-default-options. add utils to turn value history on and off, and to clear it * module/ice-9/history.scm (enable-value-history!) (disable-value-history!, clear-value-history!): New exports. capture default dynamic state in (guile-user) * libguile/init.c (scm_i_init_guile): Move the call to scm_init_threads_default_dynamic_state after the call to scm_load_startup_files, so that the default dynamic state is in the (guile-user) module, not (guile). 2010-07-10 No Itisnt Remove trailing whitespace * module/language/tree-il.scm: Remove trailing whitespace 2010-07-09 Andy Wingo avoid running the debugger during parsing or compilation at the repl * module/system/repl/repl.scm (abort-on-error): New helper. (run-repl): Don't enter the debugger during parsing or compilation of a repl expression. If you want to debug compilation, run compilation from the repl, not as part of the repl. fix up a repl command docstring * module/system/repl/command.scm (procedure): Fix up docstring. tweaks to print-locals * module/system/repl/debug.scm (print-locals): Run the before-print-hook on the values, so we can hook into (ice-9 history) if available. Don't bother printing binding indices. Give a little per-line-prefix. tweaks to new repl * module/system/repl/command.scm (read-command): Remove a pk. * module/system/repl/repl.scm (run-repl): Export. Use % and abort to implement the prompt. 2010-07-09 Andy Wingo integrate the debugger into the repl * module/system/repl/debug.scm: New file, defines a data type to hold state for a debugger stack, and some helper procedures to print the stack or print a frame. Most pieces are from (system vm debug). * module/system/repl/error-handling.scm: New file, implements call-with-error-handling and with-error-handling, and instead of going into a debugger, we go into a recursive repl that happens to have debugging information. Will be removing the old debugger from (system vm debug) shortly. * module/Makefile.am (SYSTEM_SOURCES): Add error-handling and debug scm files. * module/system/repl/repl.scm (prompting-meta-read): Better error handling -- we don't want to go into a debugger when reading a command. (start-repl): Add #:debug keyword argument, and just dispatch to run-repl. (run-repl): New function, with the guts of the old start-repl. Added a prompt, to which a throw to 'quit will abort. * module/system/repl/common.scm (repl-prepare-eval-thunk): New helper. In the future we will use this to not enter the debugger on errors that happen at compile time. (repl-eval): Use repl-prepare-eval-thunk. (repl-print): Run the before-print-hook when printing a value. * module/system/repl/command.scm (*command-table*): Move `option' to the `system' group. Move `trace' to the `profile' group. Add `debug' and `inspect' groups. (command-abbrevs): Rename from command-abbrev, and allow multiple abbreviations. (display-group): Fix the case where abbrev? was #f. (display-summary): Fix alignment of the command and abbreviations. Allow multiple abbreviations. (read-command): Rename from read-datum, and have better error handling. (meta-command): Better error handling. (define-meta-command): Better error handling. (help, show, import, compile, disassemble, time, profile, trace): Fix docstrings and error messages. (define-stack-command): New helper, for commands that operate on a saved stack. (backtrace, up, down, frame, procedure, locals): New debugger commands, in the REPL now. (inspect, pretty-print): New "inspect" commands. 2010-07-09 Andy Wingo readline only handles SIGWINCH * acinclude.m4 (GUILE_READLINE): Check for rl_catch_signals and rl_catch_sigwinch. * guile-readline/readline.c (scm_init_readline): If we can, turn off readline's signal handling, because we can do our own. (scm_readline): Use dynwinds to handle resetting readline's state on nonlocal exit, not catches. (unwind_readline): Rename from handle_error. 2010-07-09 Andy Wingo remove use-emacs-interface check from ice-9 readline * guile-readline/ice-9/readline.scm (activate-readline): Remove check for use-emacs-interface in guile-user, an interface that was removed. define* in ice-9 regex * module/ice-9/regex.scm (match:start, match:end, match:substring) (fold-matches, list-matches): Reimplement using define*. untabify (ice-9 regex) * module/ice-9/regex.scm: Untabify. 2010-07-09 Andy Wingo fix (set! MACRO exp) hygiene * module/ice-9/psyntax.scm (lookup): Reflow comment. (chi-top, syntax): Add comments about mod for lookup. (set!): Lookup the identifier in the module attached to its syntax object. In the (set! MACRO foo) case, after expanding the macro, chi the resulting expression with the empty wrap, as syntax-type does. Seems to fix the case where the expansion references lexically-bound variables. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test: Add a bunch of tests. 2010-07-04 Neil Jerram Fix TeXing of doc/ref/r6rs.texi * doc/ref/r6rs.texi (rnrs conditions): Add "{Condition Type}" to @deffn line for each condition type. Add one missing "{Scheme Procedure}". 2010-07-04 Ludovic Courtès Optimize `string=' for the common case. * libguile/srfi-13.c (scm_string_eq): Add a fast path for the common case. 2010-07-04 Ludovic Courtès Add `scm_i_string_data'. * libguile/strings.c (STRINGBUF_CONTENTS): New macro. (STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Use it. (scm_i_string_data): New function. * libguile/strings.h (scm_i_string_data): New declaration. 2010-07-01 Neil Jerram Fix hanging of popen.test The "open-output-pipe":"no duplicate" test has been hanging, on and off, and not completely reliably, for a few years. It's now doing so fairly reliably for me, and investigation shows that - the child shell process is in a tight loop (99% CPU) - the parent Guile process is stuck calling waitpid(). The problem is that the child hasn't got the SIGPIPE that the test intends, and so is continuing to echo "closed" forever; and Guile is waiting for it to terminate, forever. I haven't fully debugged the SIGPIPE problem, but it sounds very like what Chet Ramey describes here: http://old.nabble.com/Re%3A-SIGPIPE-not-properly-reset-with-%27trap---PIPE%27-p20985595.html. (And my version of bash is 3.2.39.) So, a fix should be to use something other than shell to implement the child; and it appears that this works. * check-guile.in (TEST_SUITE_DIR): Export. * test-suite/tests/popen-child.scm: New script file. * test-suite/tests/popen.test ("open-output-pipe", "no duplicate"): Use Guile for the child process, instead of shell. 2010-06-29 Andy Wingo fix repl level printing * module/system/repl/common.scm (repl-prompt): Fix repl level printing. 2010-06-29 Tristan Colgate Update #:procedure method for * modules/oop/goop.scm (initialize-object-procedure): Use slot-set! instead of set-object-procedure!. 2010-06-28 Andy Wingo * module/srfi/srfi-60.scm (bit-count): #:replace core definition. 2010-06-26 Andy Wingo use *repl-stack* instead of *repl-level* * module/ice-9/boot-9.scm (*repl-stack*): Instead of repl-level, have a stack. (batch-mode?): Change to poke the stack. * module/ice-9/deprecated.scm (set-batch-mode?!): Update deprecation method. * module/system/repl/common.scm (repl-prompt): Update to poke *repl-stack* to get the level. * module/system/repl/repl.scm (start-repl): Bind *repl-stack* appropriately. 2010-06-26 Andy Wingo tweak to ensure-batch-mode! * module/ice-9/boot-9.scm (ensure-batch-mode!): Fix to be correct regarding dynamic extent (so far as this hack goes). 2010-06-26 Andy Wingo add repl inport and outport fields and accessors * module/system/repl/common.scm (): Add inport and outport fields and accessors. (make-repl): Add optional "debug" argument. Bind inport and outport to the current inport and output ports at the time of repl creation. (repl-read): Read from the repl inport. (repl-print): Write to the repl outport. * module/system/repl/command.scm (read-datum, read-line, meta-command): Respect repl-inport, and bind the outport of meta-commands to the repl outport. 2010-06-26 Andy Wingo allow kwargs to repl metacommands * module/system/repl/command.scm (define-meta-command): Allow repl meta-commands to have optional or keyword arguments. 2010-06-25 Thien-Thi Nguyen HACKING: Mention (add-hook 'before-save-hook 'delete-trailing-whitespace) * HACKING (Coding standards): Mention ‘(add-hook 'before-save-hook 'delete-trailing-whitespace)’. 2010-06-24 Julian Graham Edits to R6RS standard libraries documentation proposed by Ludovic Courtès. * doc/ref/r6rs.texi: Fix erroneous usage of @pxref; add pointers from `(rnrs conditions)' and `(rnrs arithmetic bitwise)' to SRFI-35 and SRFI-60 sections; remove reference to `fold'. 2010-06-22 Andy Wingo top-repl out to its own module * module/ice-9/boot-9.scm: * module/ice-9/top-repl.scm: Move top-repl out here. * module/Makefile.am: Add new file. * module/ice-9/deprecated.scm (top-repl): Deprecated shim. * libguile/script.c (scm_compile_shell_switches): Invoke top-repl from its new location. 2010-06-22 Andy Wingo simplify top-repl * module/ice-9/boot-9.scm (top-repl): Simplify. don't bother catching SIGSEGV et al in top-repl * module/ice-9/boot-9.scm (exit-hook): Move up with the other hooks. (top-repl): Don't install handlers for SIGFPE, SIGILL, SIGSEGV, or SIGBUS, as they will have no effect. 2010-06-22 Andy Wingo deprecate named-module-use!, load-emacs-interface, and remove --emacs * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (named-module-use!) (load-emacs-interface): Deprecate these. * module/ice-9/gds-client.scm (run-utility): Redefine to not use named-module-use!. * libguile/script.c (scm_shell_usage): Remove --emacs option. (scm_compile_shell_switches): Remove support for --emacs. * module/ice-9/boot-9.scm (top-repl): Don't muck with --emacs. * doc/ref/scheme-scripts.texi (Invoking Guile): Remove note about --emacs. 2010-06-22 Andy Wingo require-extension using syntax-case * module/ice-9/boot-9.scm (require-extension): Implement using syntax-case. cond-expand in syntax-case * module/ice-9/boot-9.scm: Some spacing improvements. (cond-expand): Reimplement in syntax-case. more aspiration in boot-9 * module/ice-9/boot-9.scm: Spacing fixes for local-ref et al. begin-deprecated using syntax-case * module/ice-9/boot-9.scm (begin-deprecated): In terms of syntax-case. 2010-06-22 Julian Graham Integrate complete R6RS standard libraries documentation. * doc/ref/r6rs.texi: Reshuffle Andy Wingo's introductory notes; add more detailed @subsubsections for each library. 2010-06-21 Andy Wingo relax restriction on _ in literals * module/ice-9/psyntax.scm: Relax restriction on _ in literals. * module/ice-9/psyntax-pp.scm: Regen. 2010-06-21 Andy Wingo fix matches? test * test-suite/tests/syntax.test (matches?): Unfortunately this relatively recent macro fails due to the underscore-in-literals-list prohibition. But, it seems I was in the minority wanting _ for a literal. 2010-06-21 Andy Wingo syntax-case treats _ as placeholder * module/ice-9/psyntax.scm (underscore?): New helper, like ellipsis?. (syntax-case): Treat the _ pattern as a matches-all pattern, disallowing it from the keyword list. Another well-thought part of the R6RS. ($sc-dispatch): Dispatch _ patterns. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("_ is a placeholder"): Add a test. 2010-06-21 Andy Wingo fix compilation with automake < 1.11 * configure.ac: On automake < 1.11, define AM_DEFAULT_VERBOSITY so that our custom silent rules work. freshly regenerate psyntax-pp * module/ice-9/psyntax-pp.scm: A fresh regen to get the lowest gensyms we can. Needs a better solution in the end. fix rnrs duplicate bindings warnings * module/rnrs.scm: Fix i/o duplicate bindings warnings by excluding some bindings. 2010-06-20 Andy Wingo rnrs modules #:replace as appropriate * module/ice-9/boot-9.scm (export!): New syntax, as export is to module-export!, export! is to module-replace!. I thought that taking up the name `replace' would be presumptuous, hence the name mismatch. * module/ice-9/r6rs-libraries.scm (library): Calculate not only re-exports, but replacements as well. 2010-06-20 Andy Wingo ensure unicode-capable rnrs string ports * module/rnrs/io/ports.scm (open-string-input-port): (open-string-output-port): Ensure that the ports are unicode-capable by binding %default-port-encoding to "UTF-8". 2010-06-20 Ludovic Courtès Canonicalize source file names in `primitive-load-path' (fix bug #30170). * libguile/load.c (scm_primitive_load_path): Canonicalize FULL_FILENAME. Fixes bug #30170 ("Auto-compilation erroneously recompiles dependencies"). 2010-06-19 Andy Wingo repl compiles with warnings by default * module/system/repl/command.scm (compile): Remove the bitrotten options. * module/system/repl/common.scm (repl-default-options): Add 'compile-options option. (repl-compile-options): Accessor for compile-options. (repl-compile): Use repl-compile-options. (repl-eval): Adapt to repl-compile interface change. 2010-06-19 Andy Wingo scheme-mode in syntactic records test * test-suite/tests/r6rs-records-syntactic.test: Add -*- scheme -*-. typo in mutable-strings * module/rnrs/mutable-strings.scm: Fix typo. *unspecified* in rnrs exceptions * module/rnrs/exceptions.scm (rnrs): Import *unspecified*. don't unconditionally restore signals in ensure-batch-mode! * module/ice-9/boot-9.scm (ensure-batch-mode!): Remove comment about restoring signals, and that behavior, as it was making popen.test hang. I should investigate further, but instead I'm just going to hope that this fixes it. 2010-06-19 Andreas Rottmann Fix SRFI-9 for records without fields * module/srfi/srfi-9.scm (define-record-type): Deal with fieldless records. * test-suite/tests/srfi-9.test: Add a fieldless record definition. Ignore the SRFI name component(s) in R6RS imports * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): To avoid having to create alias libraries for all the SRFIs, we simply ignore the name components, so (srfi :n foo bar) will resolve to (srfi :n). ice-9 receive without define-macro * module/ice-9/receive.scm: Replace define-macro usage with syntax-rules. add rnrs unicode to the compound rnrs module * module/rnrs.scm: import rnrs unicode and export all of its procedures. 2010-06-19 Andy Wingo fix ^L typo * module/rnrs/mutable-pairs.scm: Fix ^L typo. 2010-06-19 Andy Wingo set! name (lambda ...) names the lambda * module/ice-9/psyntax.scm (build-lexical-assignment) (build-global-assignment): Maybe name the RHS. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/boot-9.scm (catch, with-throw-handler, throw): Rework to use set! instead of define! so that we get names. 2010-06-19 Andy Wingo deprecate the-last-stack * libguile/backtrace.h (scm_the_last_stack_fluid_var) * libguile/backtrace.c (scm_init_backtrace): No more scm_the_last_stack_fluid_var. The replacement is to resolve `the-last-stack' in (ice-9 stack-catch). (scm_backtrace_with_highlights): Accordingly, instead of backtracing the last stack, backtrace the current stack. * libguile/throw.h: * libguile/throw.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_stack_catch): Deprecate this function. * module/ice-9/save-stack.scm (the-last-stack): Move here from boot-9. * module/ice-9/debug.scm: * module/ice-9/debugger.scm: Use (ice-9 save-stack) for the-last-stack. * module/ice-9/deprecated.scm (the-last-stack): Add deprecated shim. 2010-06-19 Andy Wingo don't bind the-last-stack in repl.scm * module/system/repl/repl.scm (start-repl): Don't bind the-last-stack. no the-last-stack in ice-9 threads * module/ice-9/threads.scm (thread-handler): Don't muck with the-last-stack. remove the-last-stack from boot-9 * module/ice-9/boot-9.scm (false-if-exception): Use syntax-rules. Don't muck with the-last-stack, it is going away. Remove a later comment about the-last-stack. 2010-06-19 Andy Wingo deprecate save-stack, stack-saved? * module/Makefile.am: * module/ice-9/boot-9.scm: * module/ice-9/save-stack.scm (stack-saved?, save-stack): Move these bindings to their own module. * module/oop/goops.scm (goops-error): * module/ice-9/boot-9.scm (error, top-repl): Remove calls to save-stack. * module/ice-9/deprecated.scm (stack-saved?, save-stack): Add deprecated shims. * module/ice-9/emacs.scm: * module/ice-9/stack-catch.scm: * module/ice-9/debugger/command-loop.scm: * module/ice-9/scm-style-repl.scm: Import (ice-9 save-stack). 2010-06-19 Andy Wingo add support for variable transformers: settable identifier syntax * module/ice-9/psyntax.scm (set!): Handle variable transformers; though, they cannot produce definitions. (make-variable-transformer): New procedure. (identifier-syntax): Allow the R6RS form that makes variable transformers. * module/ice-9/psyntax-pp.scm: Regenerated. * doc/ref/r6rs.texi (R6RS Incompatibilities): Remove letrec* item, and add set! restriction. 2010-06-19 Andy Wingo handle-system-error to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (handle-system-error): Move here from boot-9. * module/ice-9/deprecated.scm (handle-system-error): Keep a deprecated wrapper in the root environment. 2010-06-18 Thien-Thi Nguyen [build] Use UTC, precise format for ‘buildstamp’ value. * libguile/Makefile.am (libpath.h): For ‘buildstamp’, specify date(1) output format precisely, and in UTC. * doc/ref/api-options.texi (Build Config): Update ‘buildstamp’ doc. 2010-06-18 Andy Wingo add open-string-{input,output}-port to rnrs io ports * module/rnrs/io/ports.scm (open-string-input-port) (open-string-output-port): New procedures. * module/rnrs.scm (rnrs): Export the new (rnrs io ports) procedures. 2010-06-18 Julian Graham Fix `define-condition-type' to use condition-accessors, not record accessors. * module/rnrs/conditions.scm (define-condition-type): The generated accessors should be condition accessors, which know how to unpack a compound condition; these can then delegate to the appropriate record accessors. * test-suite/tests/r6rs-conditions.test: New test case to verify above. 2010-06-18 Andy Wingo `(debug)' debugs the current stack. * module/system/vm/debug.scm (debug): Change to debug the current stack instead of the last stack. 2010-06-18 Andy Wingo remove before-signal-stack * module/ice-9/boot-9.scm (before-signal-stack): Remove. We're moving away from using the-last-stack, so this backup copy is not much use. (top-repl): Don't bother saving a before-signal-stack. * module/ice-9/debugger/command-loop.scm (debugger-handler): No need to restore here either. 2010-06-18 Andy Wingo has-shown-debugger-hint? to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (has-shown-debugger-hint?): Move to scm-style-repl. reorder hooks in boot-9 * module/ice-9/boot-9.scm: Reorder hooks. 2010-06-18 Andy Wingo default-pre-unwind-handler to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (default-pre-unwind-handler): Deprecate root-module definition. * module/ice-9/scm-style-repl.scm (default-pre-unwind-handler): Move here. * module/ice-9/debugging/traps.scm: * module/ice-9/debugger.scm: * module/ice-9/stack-catch.scm: Use default-pre-unwind-handler from scm-style-repl. 2010-06-18 Andy Wingo finish deprecating pre-unwind-handler-dispatch * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (pre-unwind-handler-dispatch): Properly deprecate. * module/ice-9/debugger.scm (debug-on-error): * module/ice-9/debugging/traps.scm (on-pre-unwind-handler-dispatch): Update remaining pre-unwind-handler-dispatch uses. 2010-06-18 Andy Wingo deprecate `repl' * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (repl): Deprecate. 2010-06-18 Andy Wingo batch-mode? in terms of *repl-level* * module/ice-9/boot-9.scm (*repl-level*): New global fluid, moved here from (system repl common). (batch-mode?): Reimplement in terms of *repl-level*. (ensure-batch-mode!): A replacement for set-batch-mode?!. * module/ice-9/deprecated.scm (set-batch-mode?!): Deprecate. * module/ice-9/popen.scm (open-process): Use ensure-batch-mode!. * module/ice-9/scm-style-repl.scm (error-catching-loop): Override ensure-batch-mode!. * module/system/repl/common.scm: Remove *repl-level*. 2010-06-18 Andy Wingo *unspecified* is identifier syntax * module/ice-9/boot-9.scm (*unspecified*): Define using identifier-syntax. Should also prevent it from being set!. (unspecified?): Move up. repl whitespace fix * module/system/repl/repl.scm: Fix whitespace. deprecate set-repl-prompt! * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (set-repl-prompt!): Deprecate, but wrap the (system repl common) implementation instead of the scm-style-repl. add repl-default-option-set! in (system repl common) * module/system/repl/common.scm (repl-default-option-set!): New interface. (repl-default-prompt-set!): New procedure, sets the 'prompt property in the default env. (repl-prompt): Use the 'prompt repl option if available. 2010-06-18 Andy Wingo assert-repl-* and associated state variables to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (scm-repl-silent, assert-repl-silence) (scm-repl-print-unspecified, assert-repl-print-unspecified) (scm-repl-verbose, assert-repl-verbosity) (scm-repl-prompt): Move these definitions here from boot-9.scm. * module/ice-9/deprecated.scm (assert-repl-silence): (assert-repl-print-unspecified, assert-repl-verbosity): Deprecated wrappers for the functions. I'm not sure if the variables can be helped though. 2010-06-18 No Itisnt Use AM_SILENT_RULES to pare down build output, ignore auto-generated files * .gitignore: Ignore extra gnulib headers. * am/snarf: Silent SNARF command * am/guilec: Silent GUILEC command * configure.ac: Use AM_SILENT_RULES when available * guile-readline/Makefile.am: * libguile/Makefile.am: * srfi/Makefile.am: * test-suite/standalone/Makefile.am: Silence snarf output 2010-06-17 U-Cain\Mike DAY_1 nl_langinfo constants don't require There is an incorrect conditional compilation requirement that be present for DAY_1 to be defined. This doesn't agree with the LSB and causes make check to fail on Cygwin. * libguile/i18n.c [HAVE_NL_TYPES_H]: modify conditional compilatiion 2010-06-17 Andy Wingo build psyntax-pp.go from psyntax.scm * module/Makefile.am (ice-9/psyntax-pp.go): Build from psyntax.scm, so we get proper debugging information and variable names. 2010-06-17 Andy Wingo fix order of internal definitions * module/ice-9/psyntax.scm (chi-body): Whoops, actually render internal definitions into a letrec* in the right order. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add some letrec* tests. 2010-06-17 Andy Wingo compile-psyntax "optimizes" psyntax-pp * module/ice-9/compile-psyntax.scm (source): "Optimize" psyntax-pp before writing it out. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-17 Andy Wingo tree-il->scheme renders fix as letrec* * module/language/tree-il.scm (tree-il->scheme): Expand out to letrec*, as it doesn't matter, and this avoids a let when running through the evaluator. 2010-06-17 Andy Wingo resolve-primitives tweaks * module/ice-9/boot-9.scm (make-struct/no-tail): Define a version of this function. Because during optimization we resolve make-struct to make-struct/no-tail, we need an implemented make-struct/no-tail if we are to be able to run scheme made from tree-il->scheme. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Remove variable-set case, as there is no "variable-set!" primitive. (flatten): Add a special hack for variable-set!. Ugly, I know. * module/language/tree-il/primitives.scm (*effect-free-primitives*): Add make-struct/no-tail. (*effect+exception-free-primitives*): Remove make-struct, as it could raise an exception. (variable-set!): Remove expansion to variable-set. 2010-06-17 Andy Wingo internal definitions expand out to letrec* instead of letrec * module/ice-9/psyntax.scm (chi-body): Internal definitions are now letrec* instead of letrec, following the R6RS. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-17 Andy Wingo compiler support for letrec* * test-suite/tests/tree-il.test ("letrec"): Add some tests. * module/language/tree-il/compile-glil.scm (flatten): Add support for compiling letrec* in its unoptimized form. * module/language/tree-il/fix-letrec.scm (simple-expression?): Parameterize, so that letrec* will not treat `(car x)' as primitive (because it could raise an exception). (partition-vars): Lump unreferenced vars in with complex vars, when compiling letrec*. (fix-letrec!): No need to evaluate inits within a let for letrec*. 2010-06-17 Andy Wingo add effect+exception-free-primitive? predicate * module/language/tree-il/primitives.scm (effect+exception-free-primitive?): New predicate, like effect-free-primitive?, but excludes accessors that could raise exceptions. 2010-06-17 Andy Wingo psyntax, primitive expander, and memoizer support for letrec* * libguile/expand.c (expand_letrec_helper): Factor out common code. (expand_letrec): Use expand_letrec_helper. (expand_letrec_star): New primitive syntax: letrec*. * libguile/memoize.c (memoize): Add memoizer support for in-order letrec (letrec*). * module/ice-9/psyntax.scm (build-letrec): Another arg, `in-order?'. (chi-body): Adapt to build-letrec change. We don't yet use letrec* for internal definitions. (letrec): Adapt to build-letrec change. (letrec*): New expander. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-17 Andy Wingo beginnings of letrec* support in the expander * libguile/expand.h (SCM_EXPANDED_LETREC_IN_ORDER_P) (SCM_MAKE_EXPANDED_LETREC): Add a new field to letrec, in-order?. Will be used to support letrec*. * libguile/expand.c (LETREC, expand_named_let, expand_letrec): Adapt code. * module/language/elisp/compile-tree-il.scm (compile-pair): * module/ice-9/psyntax.scm (build-named-let, build-letrec): Pass #f for in-order? to `make-letrec'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il.scm: Add letrec-in-order? accessor. (parse-tree-il, unparse-tree-il): Parse and unparse an in-order? letrec as `letrec*'. (tree-il->scheme): Serialize letrec*. 2010-06-17 Andy Wingo fix bug in memoize * libguile/memoize.c (memoize): Fix a bug where LETREC was being accessed as LET, and it just happened to coincide. 2010-06-17 Ludovic Courtès Remove outdated sponsorship info from `THANKS'. Update `THANKS'. 2010-06-17 Ludovic Courtès Use Alex Shinn's pattern matcher for (ice-9 match). * module/ice-9/match.scm: Rewrite to simply load `match.upstream.scm'. * module/ice-9/match.upstream.scm: New file. * module/Makefile.am (NOCOMP_SOURCES): Add `ice-9/match.upstream.scm'. * test-suite/Makefile.am (SCM_TESTS): Add `tests/match.test'. * test-suite/tests/match.test: New file. 2010-06-16 Andy Wingo remove encoding of versions into the file system (for now?) * module/ice-9/boot-9.scm (find-versioned-module): Remove. Still had some bugs (e.g. for "." in the path and in finding compiled files), did too much computation and statting, and we don't really want to promote versioning. Nor do we want to hard-code a particular encoding of versions in the file-system. Perhaps the real way to do this is to be extensible somehow. (try-module-autoload): Just dispatch to primitive-load-path in all cases. * module/rnrs * module/rnrs.scm: * module/rnrs/arithmetic/bitwise.scm: * module/rnrs/arithmetic/fixnums.scm: * module/rnrs/arithmetic/flonums.scm: * module/rnrs/base.scm: * module/rnrs/conditions.scm: * module/rnrs/control.scm: * module/rnrs/enums.scm: * module/rnrs/eval.scm: * module/rnrs/exceptions.scm: * module/rnrs/files.scm: * module/rnrs/hashtables.scm: * module/rnrs/io/simple.scm: * module/rnrs/lists.scm: * module/rnrs/mutable-pairs.scm: * module/rnrs/mutable-strings.scm: * module/rnrs/programs.scm: * module/rnrs/r5rs.scm: * module/rnrs/records/inspection.scm: * module/rnrs/records/procedural.scm: * module/rnrs/records/syntactic.scm: * module/rnrs/sorting.scm: * module/rnrs/syntax-case.scm: * module/rnrs/unicode.scm: Move these files, eliding the "6/" infix, so that they are in the normal (unversioned) module path. 2010-06-16 Andy Wingo set module version in module-export-all! * module/ice-9/boot-9.scm (module-export-all!): Set the interface version as well. load modules from within a known environment * module/ice-9/boot-9.scm (try-module-autoload): Init the module excursion with a fresh user module. 2010-06-15 Thien-Thi Nguyen [maint] Add configure.ac abstraction: GUILE_CONFIG_SCRIPT * configure.ac (GUILE_CONFIG_SCRIPT): New ‘AC_DEFUN’; use it for: check-guile, benchmark-guile, meta/guile, meta/uninstalled-env, meta/gdb-uninstalled-guile, meta/guile-tools, libguile/guile-snarf, libguile/guile-doc-snarf, libguile/guile-func-name-check, libguile/guile-snarf-docs test-suite/standalone/test-use-srfi, test-suite/standalone/test-fast-slot-ref. Init shell var properly in git-version-gen. * build-aux/git-version-gen: Ensure shell var is not influenced by an env var of the same name. 2010-06-15 Thien-Thi Nguyen Add tmpfile(3) to libguile. * libguile/posix.c (scm_tmpfile): New primitive. * libguile/posix.h (scm_tmpfile): New func decl. * doc/ref/posix.texi (File System): Document `tmpfile'. 2010-06-14 Andy Wingo fix bug in collect * module/ice-9/deprecated.scm (collect): Fix bug. 2010-06-13 Andy Wingo attempted microoptimization in eval.scm. * module/ice-9/eval.scm (primitive-eval): Try using list-ref instead of cdring in the vm. We'll check the hydra build times to see if this has any actual merit. Surely the best solution is another representation of environments, though. 2010-06-11 Andy Wingo compile (ice-9 deprecated) earlier * module/Makefile.am (ICE_9_SOURCES): Reorder placement of (ice-9 deprecated), as it's getting bigger, so we should compile it earlier. handler of a prompt is in tail context * module/language/tree-il/analyze.scm (analyze-lexicals): The handler of a prompt is in tail context. 2010-06-11 Andy Wingo while in terms of syntax-case * module/ice-9/boot-9.scm (while): Reimplement in terms of syntax-case. Prompt inlining is coming later. * test-suite/tests/syntax.test ("while"): Update the expected syntax errors. 2010-06-11 Andy Wingo comment in fix-letrec * module/language/tree-il/fix-letrec.scm (simple-expression?): Add a small FIXME. fix lexical call naming bug * module/ice-9/psyntax.scm: Fix bug in which the whole syntax object was being recorded as the name of the operator in a lexical call, instead of just the symbolic name. * module/ice-9/psyntax-pp.scm: Regenerated. unparse the tag of a prompt * module/language/tree-il.scm (unparse-tree-il): Properly unparse the tag of a prompt. make-prompt-tag is an effect-free primitive * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Recognize make-prompt-tag as interesting and effect-free. 2010-06-11 Andy Wingo add inliner cases for conditionals * module/language/tree-il/inline.scm (boolean-value, inline!): Add a case for inlining conditional expressions. * test-suite/tests/tree-il.test: Fix conditional tests to have a non-inlinable condition. 2010-06-11 Andy Wingo deprecate `collect' * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (collect): Deprecate, and fix to ensure sequential collection. define-option-interface in terms of syntax-rules * module/ice-9/boot-9.scm (define-option-interface): Rewrite using syntax-rules. a failed resolve-interface does not leave behind an empty module * module/ice-9/boot-9.scm (resolve-interface): Pass #:ensure #f to resolve-module, so that in the case of module-not-found we don't leave behind an empty module without an interface. cleanups to version-matches? * module/ice-9/boot-9.scm (version-matches?): Some cleanups: use and-map, or-map; prefer case to cond; abbreviate and scope helper functions. deprecate get-option, for-next-option, display-usage-report, transform-usage-lambda * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (get-option, for-next-option) (display-usage-report, transform-usage-lambda): Deprecate these option-parsing utils. We can revive them in a non-deprecated module if there is interest, but I suspect there will be no interest. deprecate `scheme-file-suffix' * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (scheme-file-suffix): Deprecate. comments in boot-9 * module/ice-9/boot-9.scm: Add comments. 2010-06-11 Andy Wingo deprecate `bad-throw' * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (bad-throw): Move here. This function was never documented, but has been around since guile-ii. It's not used with current code though. * module/ice-9/deprecated.scm: Provide bad-throw in default env. * module/ice-9/debugger/commands.scm: Import bad-throw from scm-style-repl. 2010-06-11 Andy Wingo error in terms of case-lambda * module/ice-9/boot-9.scm (error): Redefine using case-lambda. 2010-06-11 Andy Wingo deprecate has-suffix? * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (has-suffix?): Deprecate. * test-suite/guile-test: * benchmark-suite/guile-benchmark: Fix uses of deprecated has-suffix?. 2010-06-11 Andy Wingo comments in boot-9 * module/ice-9/boot-9.scm: Add some comments about the nature of properties. 2010-06-10 Andy Wingo deprecate apply-to-args * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (apply-to-args): Deprecate. remove annotation? * module/ice-9/boot-9.scm (annotation?): Remove unused new definition. 2010-06-10 Andy Wingo scm-style-repl -> (ice-9 scm-style-repl) * module/Makefile.am: * module/ice-9/scm-style-repl.scm: New file, to hold the old scm-style-repl. * module/ice-9/deprecated.scm: Provide scm-style-repl and error-catching-loop and error-catching-repl in the default env, but with deprecation warnings. 2010-06-10 Andy Wingo resolve-module #:ensure argument * module/ice-9/boot-9.scm (resolve-module): Add #:ensure kwarg, defaulting to true. If true we make an empty module if none was found (the old behavior). Otherwise we return false. * test-suite/tests/modules.test ("resolve-module"): Add tests for old and new behavior. 2010-06-10 Andy Wingo expt / integer-expt fixes * libguile/numbers.c (scm_integer_expt): Validate the first arg as a number. (scm_expt): Delegate to scm_integer_expt iff x is exact. Fixes fractions.test, which I broke recently * test-suite/tests/numbers.test ("integer-expt"): Add test for (integer-expt #t 0). 2010-06-10 Andy Wingo Fix build bug, manifested as failure to find libguile-srfi-srfi-1-v-4 * module/ice-9/boot-9.scm (top-repl): This use of @ is not safe, because it will cause (system repl repl) to be loaded at expand time, which will eventually cause (srfi srfi-1) to be loaded, which won't work with a fresh build tree because the helper lib isn't compiled. Gross. (load): Add a note about why this use of @ is safe. brown-paper-bag to uninstalled-env * meta/uninstalled-env.in: Fix lack of test. more uninstalled-env fixen * meta/uninstalled-env.in: Don't implicitly add . to LTDL search paths if no LTDL_LIBRARY_PATH was set. Avoid a duplicate to PATH. uninstalled-env cleanups * meta/uninstalled-env.in: Clean up setting of GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH. don't forget to set GUILE_SYSTEM_PATH in uninstalled mode * meta/uninstalled-env.in (GUILE_SYSTEM_PATH): Set this var too in uninstalled mode. deprecate error-catching-loop, error-catching-repl * module/ice-9/deprecated.scm (error-catching-loop) (error-catching-repl): Deprecate. remove commented-out code from boot-9 * module/ice-9/boot-9.scm: Remove commented-out code. deprecate scm-style-repl * module/ice-9/deprecated.scm (scm-style-repl): Deprecate. fix error handling when reading debugger args * module/system/vm/debug.scm (debugger-repl): Errors reading debugger args no longer drop us out of the debugger. bind debugging i/o ports in start-repl * module/system/repl/repl.scm (start-repl): If the debugging ports are unbound, bind them to the current i/o ports. Allows errors within with-output-to-foo / with-input-from-foo to be sensibly debugged. 2010-06-10 Andy Wingo repl.scm simplifications * module/system/repl/repl.scm (prompting-meta-read): Use call-with-error-handling. * module/system/vm/debug.scm (call-with-error-handling): Add case for #:on-error 'pass. Have the catch handler return the unspecified value. 2010-06-10 Andy Wingo start cleaning up repl/debugger error handling * module/system/repl/repl.scm (prompting-meta-read): Catch and print read errors here, returning unspecified in that case. (start-repl): Don't enable the debugger while reading expressions. Adapt with-backtrace to with-error-handling. * module/system/vm/debug.scm (run-debugger, debugger-repl): No need to take a stack, the frames vector is sufficient. (call-with-error-handling, with-error-handling): New public utilities. Notably they do not poke the-last-stack. 2010-06-10 Andy Wingo hygienic with-backtrace * module/system/repl/repl.scm (with-backtrace): Make a syntax-rules macro. 2010-06-10 Julian Graham Resolve issues in `find-versioned-module'. * module/ice-9/boot-9.scm (find-versioned-module): Perform a stable sort on version numbers of matched libraries; eliminate extra path separator in library file path. 2010-06-09 Andy Wingo fix build error with Compaq C V6.3-025 * libguile/hashtab.c: Re-arrange functions to avoid the need for pre-declaring character arrays with no length. Fixes compilation on Compaq C V6.3-025. Thanks to Jay Krell for the report. 2010-06-09 Andy Wingo r6rs `import' accepts multiple clauses * module/ice-9/r6rs-libraries.scm (import): Accept multiple clauses. * test-suite/tests/rnrs-libraries.test: Add test. 2010-06-07 Andy Wingo fix (expt #t 0) * libguile/numbers.c (scm_expt): Fix check regarding when to dispatch to integer-expt. * test-suite/tests/numbers.test ("expt"): Add test. 2010-06-07 Andy Wingo modules have field for their filenames, for debugging * module/ice-9/boot-9.scm (module-filename, set-module-filename!): Add a new field to modules, the filename that is associated with the module. For debugging purposes. (process-define-module): Parse out a #:filename argument. (make-module, make-autoload-interface): Adapt to module-constructor change. (define-module): Init module-filename from (current-source-location). 2010-06-06 Andy Wingo add current-source-location * module/ice-9/boot-9.scm (current-source-location): New macro, returns the, um, current source location. add syntax-source accessor * module/ice-9/psyntax.scm: Add syntax-source accessor. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/boot-9.scm: Declare syntax-source. srfi-34 #:replace raise fix * module/srfi/srfi-34.scm: #:replace the binding for `raise' 2010-06-06 Ludovic Courtès Add tests for `program-sources' (bug #29817). * test-suite/tests/compiler.test ("program-sources"): New test prefix. 2010-06-06 Ludovic Courtès Don't build any generated source file at "make dist" time. * srfi/Makefile.am (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_SOURCES, libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_SOURCES, libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_SOURCES, libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_SOURCES): Remove `.x' files so that they're not built by "make dist". * test-suite/standalone/Makefile.am (libtest_asmobs_la_SOURCES): Remove `test-asmobs-lib.x'. (libtest_ffi_la_SOURCES): Remove `test-ffi-lib.x'. (BUILT_SOURCES): Likewise. 2010-06-06 Ludovic Courtès Add tests for `procedure-name'. This is a followup to 22cf27c815b756cac6893b5b239898767e6cb498 ("fix procedure naming"). * test-suite/tests/compiler.test ("procedure-name"): New test prefix. 2010-06-06 Andy Wingo fix `format' with %f and exact rationals * module/ice-9/format.scm (format:parse-float): Accept a number, and when stringifying the number, first convert to inexact. * test-suite/tests/format.test ("~f fixed-point"): Add exact rational test. 2010-06-06 Andy Wingo simplify macro representation in the wake of module hygiene changes * module/ice-9/psyntax.scm (chi-install-global, chi-macro) (eval-local-transformer): Now that we handle module hygiene through syntax objects, there is no more need to record the current module when installing syntax transformers. * module/ice-9/psyntax-pp.scm: Regenerated (trickily). * libguile/_scm.h: Bump objcode version for macro representation change. * libguile/macros.c (scm_macro_transformer): Adapt to change in macro representation. 2010-06-06 Andy Wingo fix module-hygiene corner case by relying more on syntax objects * module/ice-9/psyntax.scm (chi-macro): Instead of assuming that output of a macro should be scoped relative to the module that was current when the macro was defined, allow the module information associated with the syntax object itself to pass through unmolested. Fixes bug 29860. (datum->syntax): Propagate the module of the identifier through to the new syntax object, so that datum->syntax preserves module hygiene in addition to lexical hygiene. (include, include-from-path): Refactor to plumb though the hygiene information from the filename instead of the `include', allowing hygiene from the original caller of include-from-path to propagate through. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("macro-generating macro"): Add test for bug 29860. 2010-06-05 Andy Wingo source location propagation fixes in psyntax * module/ice-9/psyntax.scm (syntax-type): Add some comments about source locations. In calls to chi-macro, pass the source location information. Propagate source location information when unpacking syntax objects. (chi-macro): Add a comment about source locations. Decorate output introduced by the macro with the source location of macro use. * module/ice-9/psyntax-pp.scm: Regenerate. Fixes bug #29817. 2010-06-05 Ludovic Courtès Update `.gitignore' for new Gnulib-generated files. Update Gnulib to v0.0-3966-g9f737c8 for `libunistring' m4 fixes. 2010-06-02 Andy Wingo brown-paper-bag commit * module/system/vm/debug.scm (frame->module): In which our author misunderstands git's index. flesh out recursive repl module with local vars * module/system/vm/debug.scm (frame->module): Actually bind frame-local variables to values in the new anonymous module. Setting settable vars should work too :) 2010-06-02 Andy Wingo recursive repl support * module/system/repl/common.scm (*repl-level*): New public fluid. (repl-prompt): If *repl-level* is a positive integer, add it to the prompt. * module/system/repl/repl.scm (start-repl): The `lang' argument is now optional, and defaults to (current-language). New kwargs level and welcome; level defaults to 0, or 1+ the existing level, and the welcome is a boolean, true if level is 0. Parameterize *repl-level* during the dynamic extent of this repl. Also, parameterize the-last-stack to #f for the duration of this repl. * module/system/vm/debug.scm (frame->module, debugger-repl): Stubs of a recursive repl implementation. The idea is to be a repl in the lexical context of the error; but it would be nice to be able to operate in the module of the proc too, for example to export bindings. Hmm. 2010-06-02 Andy Wingo current-language fluid refactoring * module/system/base/compile.scm: * module/system/base/language.scm (*current-language*, current-language): Move this fluid and thunk down to (system base language). boot-9 top-repl tweak * module/ice-9/boot-9.scm (top-repl): More concisely drill down to start-repl. 2010-06-02 Andy Wingo some repl doc updates * doc/ref/tour.texi (Reporting Bugs): Update instructions for generating a backtrace. * doc/ref/scheme-using.texi: Update examples of Guile prompts, and add an explanation of the prompt format. 2010-06-02 Andy Wingo minor NEWS tweaks * NEWS: Fix wordings. 2010-06-02 Andy Wingo add #:version (6) to rnrs bytevectors and ports * module/rnrs/bytevectors.scm: * module/rnrs/io/ports.scm: Add #:version (6) to these modules. * module/6/rnrs.scm: Add versions to the import specs for bytevectors and ports. 2010-06-02 Andy Wingo fix argument tab-completion * guile-readline/readline.c (scm_init_readline): Space is a word-breaking char too. Fixes tab-completion for args; thanks to Jao for the patch! 2010-06-02 Andy Wingo fix procedure naming * module/ice-9/psyntax.scm (define-expansion-accessors): New helper, to define accesors for a particular expansion data structure. Use it later to define lambda?, lambda-meta, and set-lambda-meta!. (maybe-name-value): Update to work with the newly defined accessors. (build-global-reference, build-let, build-named-let, build-letrec): Re-enable naming of procedures. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-01 Ludovic Courtès Fix `git-version-gen' sed script. * cfg.mk (git-version-gen-tag-sed-script): Remove trailing dash in regexp. * configure.ac: Likewise in the second argument to `AC_INIT'. 2010-06-01 Ludovic Courtès Bump version number for 1.9.11. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Make `@' visible in the sxml-match documentation. * doc/ref/sxml-match.texi (sxml-match): Quote `@' in the examples. Remove unused symbols. * libguile/debug.c (scm_sym_procname, scm_sym_dots): Remove. 2010-06-01 Andy Wingo NEWS is ready * NEWS: Finalize. remove docs for removed procedures * doc/ref/api-procedures.texi (Compiled Procedures): Remove docs for removed procedures. more NEWS * NEWS: More updates. small NEWS updates * NEWS: Some updates. 2010-06-01 Andy Wingo r6rs docs in the manual * doc/ref/r6rs.texi (R6RS Support): Skeleton of docs on our R6RS support. * doc/ref/guile.texi: * doc/ref/Makefile.am: Add r6rs.texi. * doc/ref/intro.texi: Add a link to r6rs.texi. 2010-06-01 Andy Wingo (rnrs bytevectors) fallout * module/Makefile.am (RNRS_SOURCES): Fix for (rnrs bytevectors) rename. 2010-06-01 Andy Wingo rename (rnrs bytevector) to (rnrs bytevectors) * module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs bytevector), to match the name from the R6RS. * benchmark-suite/benchmarks/bytevectors.bm: * doc/ref/api-data.texi: * doc/ref/api-foreign.texi: * libguile/bytevectors.c: * module/6/rnrs.scm: * module/language/assembly.scm: * module/language/assembly/compile-bytecode.scm: * module/language/assembly/decompile-bytecode.scm: * module/language/glil/compile-assembly.scm: * module/language/tree-il/primitives.scm: * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: * module/system/foreign.scm: * test-suite/standalone/test-ffi: * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/bytevectors.test: * test-suite/tests/foreign.test: * test-suite/tests/r6rs-ports.test: Update all referrers. 2010-06-01 Andy Wingo more 1.9.11 NEWS updates * NEWS: More updates. 2010-06-01 Ludovic Courtès Fix `VM_VALIDATE_BYTEVECTOR' macro wrt. trailing semicolons. * libguile/vm-i-scheme.c (VM_VALIDATE_BYTEVECTOR): Enclose in "do { } while (0)". 2010-06-01 Ludovic Courtès Fix unaligned accesses by the bytevector instructions. * libguile/vm-i-scheme.c (ALIGNED_P): New macro. (BV_FIXABLE_INT_REF, BV_INT_REF, BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Check the alignment of the pointer instead of checking "i % size == 0". This fixes bus errors on `sparc64-linux-gnu'. * libguile/vm.c: Include . 2010-06-01 Ludovic Courtès Upgrade manual to GFDLv1.3+. * doc/ref/fdl.texi: Upgrade to GFDLv1.3. * doc/ref/guile.texi: Change copying notice to "Version 1.3 or any later version". (GNU Free Documentation License): New node, formerly in `fdl.texi'. 2010-05-30 Ludovic Courtès Ignore `.version'. Have `test-ffi' run all the tests even after a failure. * test-suite/standalone/test-ffi (failed?): New variable. (test): Set `failed?' to #t upon error and display an error message. Have the exit code depend on FAILED?. Fix argument and return value alignment in `scm_i_foreign_call'. * libguile/foreign.c (scm_i_foreign_call): Fix the computation of ARG_SIZE wrt. alignment. Arrange so that the address ARGS[i] is aligned, rather than checking whether OFF is aligned. Have the RVALUE be at least word-aligned, which fixes calls to `char'-returning functions on `armv5tel-*-linux-gnueabi'. 2010-05-30 Ludovic Courtès Fix parenthesizing of the `ROUND_UP' macro; factorize. * libguile/_scm.h (ROUND_UP): New macro. * libguile/continuations.c (ROUND_UP): Remove. * libguile/control.c (ROUND_UP): Remove. * libguile/foreign.c (ROUND_UP): Remove. 2010-05-30 Ludovic Courtès Relax the `(version)' test. * test-suite/tests/version.test ("version reporting works"): Test whether `(version)' contains MAJOR.MINOR.MICRO, rather than being equal to it. 2010-05-30 Ludovic Courtès Use Gnulib's `git-version-gen'. * GUILE-VERSION (GUILE_VERSION): Remove. * Makefile.am (dist-hook): Depend on `gen-tarball-version'. (BUILT_SOURCES): New variable. ($(top_srcdir)/.version, gen-tarball-version): New targets. * cfg.mk (git-version-gen-tag-sed-script): New variable. * configure.ac: Use `build-aux/git-version-gen' to generate the VERSION argument of `AC_INIT'. Initialize Automake without `check-news'. Define $GUILE_VERSION as an alias for $PACKAGE_VERSION. 2010-05-30 Ludovic Courtès Import Gnulib's `git-version-gen' module. * m4/gnulib-cache.m4: Add `git-version-gen'. 2010-05-29 Ludovic Courtès Update Gnulib to v0.0-3955-g8ab5996. 2010-05-28 Ludovic Courtès Update `THANKS'. 2010-05-28 Ludovic Courtès Remove dead code related to `scm_i_terminating'. * libguile/fports.c (scm_i_terminating): Remove declaration. (fport_flush): Remove code conditional of `scm_i_terminating'. * libguile/gc.c (scm_i_terminating): Remove. 2010-05-28 Ludovic Courtès Fix the visibility of a few of internal symbols. * libguile/gc.h (scm_i_gc): Make internal. * libguile/posix.h (scm_i_locale_mutex): Likewise. * libguile/arrays.h (scm_i_tc16_array): Likewise. * libguile/numbers.c (scm_i_num_less_p): Likewise. * libguile/discouraged.h (scm_i_init_discouraged): Likewise. * libguile/continuations.c (scm_i_dummy): Made static. * libguile/gc.c (scm_i_cell_validation_already_running): Likewise. * libguile/discouraged.h (scm_i_init_discouraged): Likewise. Quote the first argument to `AC_DEFINE_UNQUOTED'. * configure.ac: Quote the first argument to `AC_DEFINE_UNQUOTED'. 2010-05-28 Ludovic Courtès Change occurrences of "filesystem" to "file system". * doc/ref/posix.texi (File System): Change "filesystem" to "file system". * libguile/posix.c (scm_utime): Ditto. 2010-05-28 Ludovic Courtès Use GCC's `malloc' attribute for malloc-like routines. * libguile/__scm.h (SCM_MALLOC): New macro. * libguile/gc.h (scm_malloc, scm_calloc, scm_strdup, scm_strndup, scm_gc_malloc_pointerless, scm_gc_calloc, scm_gc_malloc, scm_gc_strdup, scm_gc_strndup): Mark as `SCM_MALLOC'. 2010-05-28 Volker Grabsch don't fail when HAVE_STAT64 is undefined * libguile/_scm.h: Check whether `HAVE_STAT64' is defined instead of checking its value. don't run the `pthread_attr_getstack' check when cross compiling * configure.ac: Run the `pthread_attr_getstack' test only when building natively. add pdcurses to the list of termlibs * acinclude.m4 (GUILE_READLINE): Look for pdcurses as found on MinGW. 2010-05-28 Ludovic Courtès Add `scm_t_aligned_cell' internal type. * libguile/_scm.h (struct scm_aligned_cell)[__GNUC__]: New type. (union scm_aligned_cell)[!__GNUC__]: New type. (scm_t_aligned_cell): New type. * libguile/vm.c (vm_dispatch_hook): Use it. 2010-05-28 Julian Graham Ignore explicit phase specification for imports in `library' form. * module/ice-9/r6rs-libraries.scm (library): Unwrap the `for' sub-form during export resolution the same way that `import' does. * test-suite/tests/rnrs-libraries.test ("implicit phasing"): New test prefix and tests. 2010-05-27 No Itisnt Two spaces. Rename set-record-printer! * doc/ref/srfi-modules.texi: set-record-printer! -> set-record-type-printer! Add sources to module/Makefile.am * module/Makefile.am: add srfi/srfi-9/gnu.scm to SRFI_SOURCES 2010-05-27 No Itisnt Record printer fixes * doc/ref/srfi-modules.texi: Fix style * module/srfi/srfi-9/gnu.scm (set-record-type-printer!): renamed from set-record-printer! 2010-05-27 Julian Graham Support for the #!r6rs lexeme. * libguile/read.c (scm_read_shebang): New function; (scm_read_sharp): Call scm_read_shebang on '!', which delegates to scm_read_scsh_block_comment as necessary. * test-suite/tests/reader.test ("R6RS lexeme comment", "partial R6RS lexeme comment"): New tests. 2010-05-27 Andy Wingo partial 1.9.11 NEWS * NEWS: Add some 1.9.11 news -- unfinished, though. remove scm_memoizer_p and scm_memoizer declarations * libguile/memoize.h (scm_memoizer_p, scm_memoizer): Remove these declarations. 2010-05-26 Ludovic Courtès Clean up `test-suite/vm'. * test-suite/vm/Makefile.am: Add copyright/license header. * test-suite/vm/the-bug.txt: Remove. 2010-05-26 Ludovic Courtès Rename the `testsuite' directory to `test-suite/vm'. * testsuite: Move to... * test-suite/vm: ... here. * Makefile.am (SUBDIRS): Remove `testsuite'. * configure.ac: Output `test-suite/vm/Makefile' instead of `testsuite/Makefile'. * test-suite/Makefile.am (SUBDIRS): Add `vm'. 2010-05-26 Ludovic Courtès Raise an exception upon VM stack overflows (fixes bug #29574). * libguile/vm-engine.c (VM_NAME)[vm_error_stack_overflow]: Increase `vp->stack_limit' when possible. * libguile/vm.c (VM_STACK_RESERVE_SIZE): New macro. * test-suite/lib.scm (exception:vm-error): New variable. * test-suite/tests/eval.test ("stack overflow"): New test prefix. 2010-05-26 Ludovic Courtès sxml-match: Handle multiple-value returns. * module/sxml/sxml-match.ss (sxml-match1): Invoke ESCAPE via `call-with-values'. * test-suite/tests/sxml-match-tests.ss ("test multiple value returns"): New test. * module/sxml/match.scm: Mention the modification. 2010-05-26 No Itisnt Merge branch 'master' of git.sv.gnu.org:/srv/git/guile 2010-05-25 Ludovic Courtès Add (sxml match). * module/Makefile.am (LIB_SOURCES): Add `sxml/match.scm'. (NOCOMP_SOURCES): Add `sxml/sxml-match.ss'. * module/sxml/match.scm, module/sxml/sxml-match.ss: New files. * test-suite/Makefile.am (SCM_TESTS): Add `tests/sxml.match.test'. (EXTRA_DIST): Add `tests/sxml-match-tests.ss'. * test-suite/tests/sxml-match-tests.ss, test-suite/tests/sxml.match.test: New files. * doc/ref/guile.texi (Guile Modules): Include `sxml-match.texi'. * doc/ref/sxml-match.texi: New file. * doc/ref/Makefile.am (guile_TEXINFOS): Add `sxml-match.texi'. 2010-05-25 Ludovic Courtès Add copyight/license header in `compile-psyntax.scm'. 2010-05-25 No Itisnt * doc/ref/srfi-modules.texi: * module/srfi/srfi-9/gnu.scm: rename `define-record-printer' to `set-record-printer!' to reflect the fact that the printer is set at runtime add custom record printers * doc/ref/srfi-modules.texi: update documentation * module/srfi/srfi-9/gnu.scm: add `define-record-printer' 2010-05-24 Andy Wingo update NEWS for things that were true and aren't, or vice versa * NEWS: Misc updates. pre-prepare NEWS * NEWS: Integrate 1.9.10 entries into the main text. 2010-05-23 Julian Graham Edits for R6RS library implementation documentation, as suggested by Ludovic Courtès. * doc/ref/api-module.texi (R6RS Libraries): Wrap keywords variously in @code and @dfn forms; rewrite pointer to implicit phasing paper; add "Scheme Syntax" specification to @deffns. 2010-05-22 Ludovic Courtès Fix disassembly of free variable lists. * module/language/assembly/disassemble.scm (disassemble-free-vars): Handle FREE-VARS as a list, not a vector. 2010-05-21 Andy Wingo boot-9 comment cleanup * module/ice-9/boot-9.scm: Remove needless comment. lambda* in make-mutable-parameter * module/ice-9/boot-9.scm (make-mutable-parameter): Use lambda*. define* in repl-reader * module/ice-9/boot-9.scm (repl-reader): Use define*. define* in try-module-autoload * module/ice-9/boot-9.scm (try-module-autoload): Use define*. define* in resolve-interface * module/ice-9/boot-9.scm (resolve-interface): Use define* with proper keyword arguments, for great justice. lambda* in resolve-module * module/ice-9/boot-9.scm (resolve-module): Use lambda*. define* in load-module * module/ice-9/boot-9.scm (load-module): Use define*. define* in module-observe-weak * module/ice-9/boot-9.scm (module-observe-weak): Use define*. define* in load * module/ice-9/boot-9.scm (load): Use define*. case-lambda in dup->{in,out,}port, dup * module/ice-9/boot-9.scm (dup->port, dup->inport, dup->outport, dup): Use case-lambda. Not particularly elegant. define* in file-set-position * module/ice-9/boot-9.scm (file-set-position): Use define*. define* in record-constructor * module/ice-9/boot-9.scm (record-constructor): Use define*. define* in make-record-type * module/ice-9/boot-9.scm (make-record-type): Use define*. lambda* in string-any, string-every * module/ice-9/boot-9.scm (string-any, string-every): Use lambda*. lambda* in catch * module/ice-9/boot-9.scm (catch): Use lambda*. lambda* in make-prompt-tag * module/ice-9/boot-9.scm (make-prompt-tag): Use lambda*. 2010-05-21 Julian Graham Explicitly import `*unspecified*' to support R6RS library purification enhancements. * module/rnrs/6/hashtables.scm: Add explicit import for `*unspecified*'. Explicitly import `@@' to support R6RS library purification enhancements on `master'. * module/rnrs/6/conditions.scm: * module/rnrs/6/exceptions.scm: * module/rnrs/6/files.scm: * module/rnrs/6/hashtables.scm: * module/rnrs/io/6/simple.scm: * module/rnrs/records/6/inspection.scm: Add explicit import for `@@'. Fix broken imports in `(rnrs r5rs)'. * module/rnrs/6/r5rs.scm (imports): Import `null-environment' from `(ice-9 safe-r5rs)'; import `scheme-report-environment' from `(ice-9 r5rs)'. Fix incorrect export names in `(rnrs io simple)'. * module/rnrs/io/6/simple.scm: with-input-file => with-input-from-file, with-output-file => with-output-to-file. Implementation for R6RS (rnrs) composite library. (Can't be loaded yet because of conflict between `syntax-case' transformer binding and `(rnrs syntax-case)' hierarchical namespace module binding.) * module/6/rnrs.scm: New file. * module/Makefile.am: Add 6/rnrs.scm to RNRS_SOURCES. Test suite and fixes for R6RS (rnrs arithmetic fixnums). * module/rnrs/arithmetic/6/fixnums.scm: Fix missing imports; (fixnum-width, greatest-fixnum, least-fixnum): Redefine these as zero-argument procedures; Fix argument mismatches in several functions. * test-suite/Makefile.am: Add tests/r6rs-arithmetic-fixnums.test to SCM_TESTS. * test-suite/tests/r6rs-arithmetic-fixnums.test: New file. Fix typo in license comment. * test-suite/tests/r6rs-eval.test: Lice6nse => License. Implementation and test cases for the R6RS (rnrs arithmetic flonums) library. * module/Makefile.am: Add rnrs/arithmetic/6/fixnums.scm and rnrs/arithmetic/6/flonums.scm to RNRS_SOURCES. * module/rnrs/6/base.scm: (div-and-mod, div0, mod0, div0-and-mod0): New functions; this `div' implementation is not quite right, but we'll come back to it later. * module/rnrs/arithmetic/6/fixnums.scm: New file. * module/rnrs/arithmetic/6/flonums.scm: New file. * test-suite/Makefile.am: Add tests/r6rs-arithmetic-flonums.test to SCM_TESTS. * test-suite/tests/r6rs-arithmetic-flonums.test: New file. Implementation and test case for R6RS (rnrs eval) library. * module/Makefile.am: Add rnrs/6/eval.scm to RNRS_SOURCES. * module/rnrs/6/eval.scm: New file * test-suite/Makefile.am: Add tests/r6rs-eval.test to SCM_TESTS. * test-suite/tests/r6rs-eval.test: New file. Fix syntax and consolidate imports for (rnrs lists). * module/rnrs/6/lists.scm: Import syntax is `(only (import-set) id-1 ...)', not `(only (import-set) (id-1 ...))'; use `rename' form as wrapper instead of creating separate custom interface on SRFI-1. Implementation and test cases for the R6RS (rnrs enums) library. * module/Makefile.am: Add rnrs/6/enums.scm to RNRS_SOURCES. * module/rnrs/6/conditions.scm: Fix define-condition-type binding for syntax-violation? predicate. * module/rnrs/6/enums.scm: New file. * test-suite/Makefile.am: Add tests/r6rs-enums.test to SCM_TESTS. * test-suite/tests/r6rs-enums.test: New file. Add R6RS `syntax-violation' to (rnrs syntax-case). * module/rnrs/6/exceptions.scm: Remove dependency on (rnrs syntax-case); rewrite guard and guard0 in using syntax-rules in terms of syntax-case. * module/rnrs/6/syntax-case.scm: Add syntax-violation implementation. Test suite and fixes for R6RS (rnrs conditions) and (rnrs records procedural). * module/rnrs/6/conditions.scm: Fix export of make-implementation-restriction-violation; remove dependency on (rnrs syntax-case); remove redundant function compound-condition-components; rewrite define-condition-type using syntax-rules instead of syntax-case. * module/rnrs/records/6/procedural.scm: Remove serious-condition?, violation? and assertion-violation? predicates, since they're not true condition predicates. * test-suite/Makefile.am: Add tests/r6rs-conditions.test to SCM_TESTS. * test-suite/tests/r6rs-conditions.test: New file. Implementation for the (rnrs mutable-pairs) and (rnrs mutable-strings) libraries. * module/Makefile.am: Add rnrs/6/mutable-pairs.scm and rnrs/6/mutable-strings.scm to RNRS_SOURCES. * module/rnrs/6/mutable-pairs.scm: New file. * module/rnrs/6/mutable-strings.scm: New file. Implementation for the R6RS (rnrs r5rs) library. * module/Makefile.am: Add rnrs/6/r5rs.scm to RNRS_SOURCES. * module/rnrs/6/r5rs.scm: New file. Add `guard' form and test cases to R6RS (rnrs exceptions) library. * module/rnrs/6/exceptions.scm: (guard0, guard): New syntax. * module/rnrs/records/6/procedural.scm: (r6rs-raise-continuable): Can't use `raise' here because it's exported by (rnrs exceptions); use plain old `throw' instead. * test-suite/Makefile.am: Add tests/r6rs-exceptions.test to SCM_TESTS. * test-suite/tests/r6rs-exceptions.test: New file. Fix test suite title in comment * test-suite/tests/r6rs-records-procedural.test: `(rnrs control)' => `(rnrs records procedural)' Implementation and test cases for R6RS (rnrs files) library. * module/Makefile.am: Add rnrs/6/files.scm to RNRS_SOURCES. * module/rnrs/6/conditions.scm (define-condition-type): Use specified accessor name to create accessor binding. Add internally-visible &i/o-* condition types. * module/rnrs/6/files.scm: New file. * module/rnrs/io/6/simple.scm: Export &i/o-* condition types clandestinely imported from (rnrs conditions). * test-suite/Makefile.am: Add tests/r6rs-files.test to SCM_TESTS. * test-suite/test/r6rs-files.test: New file. Implementation for the R6RS (rnrs sorting) library. * module/Makefile.am: Add rnrs/6/sorting.scm to RNRS_SOURCES. * module/rnrs/6/sorting.scm: New file. Implementation for the R6RS (rnrs programs) library. * module/Makefile.am: Add rnrs/6/programs.scm to RNRS_SOURCES. * module/rnrs/6/programs.scm: New file. Implementation and test cases for the R6RS (rnrs unicode) library. * module/Makefile.am: Add rnrs/6/unicode.scm to RNRS_SOURCES. * module/rnrs/6/unicode.scm: New file. * test-suite/Makefile.am: Add tests/r6rs-unicode.test to SCM_TESTS. * test-suite/tests/r6rs-unicode.test Fixes and test cases for R6RS (rnrs hashtables) library. * module/rnrs/6/hashtables.scm: Assorted bugfixes, esp. for wrapping single-argument hash functions. * test-suite/Makefile.am: Add tests/r6rs-hashtables.test to SCM_TESTS. * test-suite/tests/r6rs-hashtables.test: New file. Add test cases for record constructor protocols and parent protocol delegation. * test-suite/tests/r6rs-records-procedural.test ("simple protocol", "protocol delegates to parent with protocol"): New tests. Implementation for the R6RS (rnrs hashtables) library; Implementation and test cases for the R6RS (rnrs record syntactic) library. * module/Makefile.am: Add rnrs/6/hashtables.scm to RNRS_SOURCES. * module/rnrs/6/hashtables.scm: New file. * module/rnrs/records/6/inspection.scm: (record-type-generative?) Record types are generative iff they have no uid, not vice-versa. * module/rnrs/records/6/syntactic.scm: Finish `define-record-type' implementation; add `record-type-descriptor' and `record-constructor-descriptor' forms. * test-suite/Makefile.am: Add tests/r6rs-records-syntactic.test to SCM_TESTS. * test-suite/tests/r6rs-records-inspection.test: Update tests for `record-type-generative?' to reflect corrected behavior. * test-suite/tests/r6rs-records-syntactic.test: New file. (rnrs conditions) should not depend on (rnrs records syntactic). * module/rnrs/6/conditions.scm: (define-condition-type) Re-implement `define-condition-type' in terms of (rnrs records procedural). Fix missing export of string->symbol in (rnrs base). * module/rnrs/6/base.scm: Add string->symbol to library exports. Implementation for the R6RS (rnrs lists) library. * module/Makefile.am: Add module/rnrs/6/lists.scm to RNRS_SOURCES. * module/rnrs/6/lists.scm: New file. Implementation and test cases for the R6RS (rnrs records inspection) library. * module/Makefile.am: Add module/rnrs/records/6/inspection.scm to RNRS_SOURCES. * module/rnrs/records/6/inspection.scm: New file. * module/rnrs/records/6/procedural.scm: Assorted refactoring: Create index constants for record, rtd, and rcd field indexes; record-type-vtable, record-constructor-vtable: More informative display names; (make-record-type-descriptor): fold left, not right when creating vtable; store field names as vector, not list; detect opaque parents * test-suite/Makefile.am: Add test-suite/tests/r6rs-records-inspection.test to SCM_TESTS. * test-suite/tests/r6rs-records-inspection.test: New file. Remove needless import of (rnrs io simple). * module/rnrs/6/conditions.scm: Remove (rnrs io simple (6)) from imports. Implementation and test cases for the R6RS (rnrs records procedural) library, along with its dependencies. * module/Makefile.am: Add new R6RS libraries below to RNRS_SOURCES. * module/rnrs/6/conditions.scm, exceptions.scm, syntax-case.scm: New files. * module/rnrs/io/6/simple.scm: New file. * module/rnrs/records/6/procedural.scm, syntactic.scm: New files. * test-suite/Makefile.am: Add tests/r6rs-records-procedural.test to SCM_TESTS. * test-suite/tests/r6rs-records-procedural.test: New file. Fix missing imports for `(rnrs arithmetic bitwise)'. * module/Makefile.am: Add module/rnrs/arithmetic/6/bitwise.scm to RNRS_SOURCES. * module/rnrs/arithmetic/6/bitwise.scm: Import `(rnrs control)' and `modulo' from `(guile)'. * test-suite/Makefile.am: Add r6rs-arithmetic-bitwise.test to SCM_TESTS. Implementation and test cases for the R6RS (rnrs control) library. * module/Makefile.am: Add rnrs/6/base.scm and rnrs/6/control.scm to RNRS_SOURCES. * module/rnrs/6/base.scm, control.scm: New files. * test-suite/Makefile.am: Add tests/r6rs-control.test to SCM_TESTS. * test-suite/tests/r6rs-control.test: New file. Implementation and test cases for the R6RS (rnrs arithmetic bitwise) library. * module/rnrs/arithmetic/6/bitwise.scm: New file. * test-suite/tests/r6rs-arithmetic-bitwise.test: New file. 2010-05-21 Julian Graham Documentation for the R6RS `library' and `import' forms. * doc/ref/api-modules.texi (R6RS Libraries): New section, documents `library' and `import'. 2010-05-20 Andy Wingo eval-when expand for use-modules and export * module/ice-9/boot-9.scm (use-modules, use-syntax) (export, re-export): Add `expand' to the eval-when list, as we did for R6RS. pure r6rs modules * module/ice-9/r6rs-libraries.scm (library): Make pure modules. (import): Also process imports at expand time, for the `eval' case. macroexpanded pretty-printer * module/language/tree-il.scm (print-tree-il): (borrow-core-vtables, ): When tree-il loads, override the printers for macroexpanded structures. lambda* usage in psyntax.scm * module/ice-9/psyntax.scm (macroexpand): Use lambda*. * module/ice-9/psyntax-pp.scm: Regenerated. tree-il->scheme for lambda* et al * module/language/tree-il.scm (tree-il->scheme): Fix lambda* / case-lambda / case-lambda* transformation. 2010-05-20 Andy Wingo remove *mode* fluid from psyntax * module/ice-9/psyntax.scm: Remove the *mode* fluid. Whee :) (macroexpand): No need to bind aa *mode* fluid. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-20 Andy Wingo iron out inconsistency between eval and compile expansion * libguile/expand.c (expand_lambda_star_case): Harmonize with tree-il, expanding keywords to (aok? (kw name gensym) ...), not (aok? (kw . index) ...). * libguile/memoize.c (memoize): Process the (kw name gensym) format into (kw . index). * module/ice-9/psyntax.scm (build-lambda-case): Remove a compile-versus-eval special case. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-20 Andy Wingo primitive-eval takes expanded, not memoized, source * module/ice-9/eval.scm (primitive-eval): * libguile/eval.c (scm_c_primitive_eval): Don't expect a memoized expression -- expect either raw source or an *expanded* expression. We handle memoization ourselves. * libguile/expand.c (scm_macroexpand): Settle down into its proper name, "macroexpand", even as we comment that it is but a fleeting boot expander. (scm_macroexpanded_p): New predicate for expanded code. * libguile/expand.h: Add scm_macroexpanded_p. * libguile/memoize.c (scm_memoize_expression): Require that the expression be expanded. (scm_init_memoize): Don't alias memoize-expression to macroexpand. * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: Always produce macroexpanded expressions, and hand them to primitive-eval. No more calls to memoize-expression here. * test-suite/tests/optargs.test: Remove some tests, as unfortunately we have no way to invoke the boot expander after boot. 2010-05-20 Andy Wingo %null-pointer properly aligned * libguile/foreign.c: Allocate %null-pointer on the heap, to assure proper alignment. 2010-05-20 Andy Wingo psyntax produces "expanded" structures directly * module/ice-9/psyntax.scm: Remove a number of eval-versus-compile cases, instead producing "expanded" structures directly, which happen to coincide with tree-il. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-19 Andy Wingo expanded type constructors in psyntax * module/ice-9/psyntax.scm (define-expansion-constructors): Define constructors for expanded types. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-19 Andy Wingo tree-il on expanded-vtables * module/language/tree-il.scm: In a somewhat daring move, inherit the "core" tree-il constructs from %expanded-vtables. fix a couple expander naming bugs * libguile/expand.h: * libguile/memoize.c: Fix a couple bugs: it's application-args, not application-exps, and public?, not public. %expanded-vtables is a vector * libguile/expand.c (scm_init_expand): %expanded-vtables is a vector. 2010-05-19 Andy Wingo separate boot expansion from memoization * libguile/Makefile.am: * libguile/init.c: * libguile/expand.c: * libguile/expand.h: Add new expander. The idea is that macroexpansion is one thing, and whether to compile or interpret the result of that is another thing. * libguile/memoize.c: Adapt to expand as necessary, and then memoize expanded source without worrying about syntax errors. * module/ice-9/eval.scm (make-general-closure): Allow alt clauses to not possess the full make-general-closure arity. 2010-05-18 Andy Wingo remove the new scm_memoize_begin, etc * libguile/memoize.h: * libguile/memoize.c: Remove the recently-added scm_memoize_begin, scm_memoize_lambda, et al. We'll take a different tack. 2010-05-16 Andy Wingo scm_memoize_lambda update * libguile/memoize.h: * libguile/memoize.c (scm_memoize_lambda): Update to memoize "full-arity" lambdas. 2010-05-14 Andy Wingo psyntax builds case-lambda expressions * module/ice-9/psyntax.scm (build-case-lambda, build-lambda-case): Actually build case-lambda expressions, knowing that the memoizer will do the right thing. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-14 Andy Wingo evaluator support for case-lambda * libguile/memoize.c (patch_case_lambda, scm_m_case_lambda) (scm_m_case_lambda_star): Add memoizers for case-lambda and case-lambda*. (unmemoize): Unmemoize lambdas with multiple arities. * libguile/eval.c (prepare_boot_closure_env_for_apply): (prepare_boot_closure_env_for_eval): Adapt to return both body and env, so that case-lambda clauses can be selected appropriately. (eval, boot_closure_apply): Adapt callers. * module/ice-9/eval.scm (make-general-closure): Support multiple arities. 2010-05-14 Andy Wingo primitive support for lambda* * libguile/memoize.c (scm_m_lambda_star): Define lambda* in the pre-psyntax env, and make it memoize lambda* expressions. * libguile/eval.c (BOOT_CLOSURE_PARSE_FULL): New helper. (error_invalid_keyword, error_unrecognized_keyword): New helpers. (prepare_boot_closure_env_for_apply): Flesh out application of boot closures with "full" arity. (prepare_boot_closure_env_for_eval): Punt to prepare_boot_closure_env_for_eval for the full-arity case. * module/ice-9/eval.scm (make-fixed-closure): Rename from `closure', and just handle fixed arities, where there is no rest argument.. (make-general-closure): New helper, a procedure, that returns a closure that can take rest, optional, and keyword arguments. (eval): Adapt to call make-fixed-closure or make-general-closure as appropriate. * test-suite/tests/optargs.test ("lambda* inits"): Test the memoizer as well. 2010-05-13 Andy Wingo tweak to lambda* memoization format * libguile/memoize.c (FULL_ARITY): Change the form to more closely approximate . (unmemoize): Unmemoize lambda* expressions. change to format of memoization lambda expressions * libguile/memoize.c (scm_m_lambda, memoize_named_let) (scm_memoize_lambda, unmemoize) * libguile/eval.c (eval, prepare_boot_closure_env_for_apply) (prepare_boot_closure_env_for_eval, boot_closure_apply): * module/ice-9/eval.scm (primitive-eval): Change the format for memoized lambda expressions, so as to allow, in the future, case-lambda* to be supported by the evaluator. scm_badargsp is deprecated * libguile/eval.h: * libguile/eval.c: * libguile/deprecated.h * libguile/deprecated.c (scm_badargsp): Deprecate scm_badargsp. 2010-05-11 Ludovic Courtès Have `sxml->xml' handle `*TOP*' nodes (bug #29260). * module/sxml/simple.scm (universal-sxslt-rules): Add handler for `*TOP*'. Suggested by Stefan Israelsson Tampe at . * test-suite/Makefile.am (SCM_TESTS): Add `sxml.simple.test'. * test-suite/tests/sxml.simple.test: New file. * THANKS: Add Stefan. 2010-05-07 Andy Wingo add memoize-begin, memoize-let, etc functions * libguile/memoize.h: * libguile/memoize.c (scm_memoize_begin, scm_memoize_if, scm_memoize_lambda, scm_memoize_let, scm_memoize_quote, scm_memoize_define, scm_memoize_with_fluids, scm_memoize_call, scm_memoize_lexical_ref, scm_memoize_lexical_set, scm_memoize_toplevel_ref, scm_memoize_toplevel_set, scm_memoize_module_ref, scm_memoize_module_set): New functions, public to Scheme but private to C. For use by psyntax, in the future. 2010-05-07 Andy Wingo add "memoizer" data type * libguile/memoize.h: * libguile/memoize.c (MAKMEMO_APPLY): Take the proc and args separately. (scm_tc16_memoizer, SCM_MEMOIZER_P, SCM_MEMOIZER): New smob type, for "syntax" like @apply that have normal evaluation order. (memoize_env_ref_macro, memoize): Refactor to handle "memoizers" generically. Reorganize the list of SCM_SYNTAX forms. Move @apply, @dynamic-wind, @call-with-current-continuation, @call-with-values, @prompt handling down to be generic "memoizer" data types. (scm_memoizer_p, scm_memoizer): New functions, exposed to Scheme. Will be used by psyntax. 2010-05-07 Andy Wingo macro expanders return memoized expressions * libguile/eval.c (scm_c_primitive_eval): * module/ice-9/eval.scm (primitive-eval): Rely on the expander to produce a memoized expression. If the expression is already memoized, just pass it through (the equivalent of the old "noexpand" hack). * libguile/memoize.c (scm_init_memoize): Initialize `memoize-expression' as the initial binding of `macroexpand'. * libguile/modules.c (scm_module_transformer): Before modules are booted, look for `macroexpand', not `%pre-modules-transformer'. * module/ice-9/boot-9.scm: No more %pre-modules-transformer. Loading psyntax extends `macroexpand'. (make-module): `macroexpand' is the default transformer. * module/ice-9/psyntax.scm: No more `noexpand'. (top-level-eval-hook, local-eval-hook): Instead of annotating with noexpand, memoize the expression before handing it to primitive-eval. (macroexpand): No more noexpand hack -- in its place we have another hack, to memoize the result when running in eval mode. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-07 Ludovic Courtès Attempt to guarantee 8-byte alignment of on-stack frame objects. * libguile/vm.c (vm_dispatch_hook): Make FRAME a union with a `double' member. 2010-05-07 Ludovic Courtès Add (system vm coverage). * module/system/vm/coverage.scm: New file. * module/Makefile.am (SYSTEM_SOURCES): Add `system/vm/coverage.scm'. * test-suite/guile-test (main): Use (system vm coverage). Handle `--coverage' and `-c'. * test-suite/tests/coverage.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/coverage.test'. * doc/ref/Makefile.am (guile_TEXINFOS): Add `api-coverage.texi'. * doc/ref/api-coverage.texi: New file. * doc/ref/guile.texi (API Reference): Include it. 2010-05-07 Ludovic Courtès Allocate frame objects on the stack when invoking VM hooks. * libguile/vm.c (vm_dispatch_hook): Don't call `scm_c_make_frame ()'. Instead, allocate FRAME on the stack. 2010-05-07 Ludovic Courtès Add `program-free-variables' to `(system vm program)'. * module/system/vm/program.scm (program-free-variables): New procedure. * module/language/objcode/spec.scm (program-free-variables): Remove. 2010-05-07 Ludovic Courtès Fix the type tag produced by `SCM_STATIC_PROGRAM'. * libguile/snarf.h (SCM_STATIC_PROGRAM): Fix typo. When printing a VM, show the type of engine being used. * libguile/vm.c (scm_i_vm_print): Print the engine type. 2010-05-06 Andy Wingo fix macros that expand into (begin (define-module ...) ...) * module/ice-9/boot-9.scm (define-module): Add `expand' to the situations, so that we ensure the current module changes at expand time. * module/ice-9/r6rs-libraries.scm (library): Expand the body within @@ expressions. 2010-05-06 Andy Wingo psyntax no longer attempts to track (current-module) * module/ice-9/psyntax.scm: Revert tracking of the current module while expanding toplevel sequences. Better to preserve lexical scoping (relative to the module of the original expression) and allow for @@ to override it. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test: Test module-changing with @@. 2010-05-06 Andy Wingo @@ generalized to arbitrary expressions. * module/ice-9/psyntax.scm (@@): The RHS of an @@ is no longer restricted to be an identifier, it can be an arbitrary expression. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-06 Andy Wingo change form of @ and @@ psyntax handlers * module/ice-9/psyntax.scm (@, @@): Take r and w args, and also return r, w, and s. Adapt callers. 2010-05-06 Andy Wingo add `expand' eval-when situation * module/ice-9/psyntax.scm (chi-when-list, chi-top): Add an undocumented `expand' situation to eval-when, which will trigger at expand-time for toplevel expressions. Useful when you are expanding for eval, but need to do some side effect to affect the expander -- like defining a module. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-04 Andy Wingo add explanatory comment to chi-macro * module/ice-9/psyntax.scm (chi-macro): Add comment. check layout when making vtables * libguile/struct.c (scm_is_valid_vtable_layout): New private layout validating function. (scm_i_struct_inherit_vtable_magic): Do a more proper layout validation, and don't abort. 2010-05-03 Andy Wingo add rnrs libraries test suite * test-suite/Makefile.am: * test-suite/tests/rnrs-libraries.test: * test-suite/tests/rnrs-test-a.scm: Add rnrs libraries test suite. 2010-05-03 Julian Graham add support for r6rs libraries * module/ice-9/boot-9.scm: Include ice-9/r6rs-libraries.scm. * module/ice-9/r6rs-libraries.scm: New file. * module/Makefile.am (NOCOMP_SOURCES): Add r6rs-libraries.scm. 2010-05-03 Andy Wingo only ensure local vars for definitions during expansion when compiling * module/ice-9/psyntax.scm (chi-top): Only modify the compile-time environment to indicate that there is a local binding if we are running in compile mode. Otherwise some eval-when things might not have gotten executed, and our current-module could be wrong. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-03 Andy Wingo export, re-export etc as syntax-rules macros * module/ice-9/boot-9.scm (export, re-export, export-syntax) (re-export-syntax): Rewrite as syntax-rules macros. rewrite use-modules and use-syntax using syntax-case * module/ice-9/boot-9.scm (use-modules): Rewrite as a syntax-case macro. (use-syntax): Likewise. (compile-interface-spec): Remove unused function rewrite define-module as a syntax-case macro * module/ice-9/boot-9.scm (define-module): Rewrite as a syntax-case macro, so that the expansion has proper module hygiene. Otherwise process-define-module isn't properly resolved against the root module -- a bytecode file that starts with a define-module would just try to look up process-define-module from the current module. (compile-define-module-args): Remove. Internal, and no one else used it. remove duplicate quasisyntax.scm EXTRA_DIST * module/Makefile.am (EXTRA_DIST): Remove quasisyntax.scm, as the NOCOMP_SOURCES handles that case. 2010-05-02 Julian Graham Test cases for `version-matches?'. * test-suite/tests/modules.test ("module versions"): New tests for `version-matches?'. 2010-05-02 Andy Wingo add tour.texi to guile_TEXINFOS * doc/ref/Makefile.am (guile_TEXINFOS): Add tour.texi. Update example disassemblies * doc/ref/compiler.texi: * doc/ref/vm.texi: Update example disassemblies for current compiler, which uses assert-nargs-ee/locals. 2010-05-02 Andy Wingo add assert-nargs-ee/locals instruction * libguile/vm-i-system.c (assert-nargs-ee/locals): New instruction, a combination of assert-nargs-ee and reserve-locals in the case in which nreq and nlocs can both be represented in 8 bits. * module/language/glil/compile-assembly.scm (glil->assembly): Add compiler case. * doc/ref/vm.texi (Function Prologue Instructions): Update docs. 2010-05-02 Andy Wingo add underflow check in make-array * libguile/vm-i-scheme.c (make-array): Check for underflow before making the array. add SCM_UNLIKELY to CHECK_UNDERFLOW * libguile/vm-engine.h (CHECK_OVERFLOW, CHECK_UNDERFLOW): Add SCM_UNLIKELY blocks. Fix off-by-one error in CHECK_UNDERFLOW. (PRE_CHECK_UNDERFLOW): New macro, for checking underflow before accessing the current sp. (POP): Use PRE_CHECK_UNDERFLOW. update compiler.texi * doc/ref/compiler.texi (Compiler Tower): Update for removal of version from , and add joiner and make-default-environment fields. Update examples. (The Scheme Compiler): Update for `macroexpand' instead of `sc-expand', and that the environment must be a module. (Tree-IL): Update for new Tree-IL, and change from "vars" to "gensyms". (GLIL): Update for new GLIL, including preludes and prompts. (Assembly): Update for current output (which seems quite verbose). (Bytecode and Objcode): Update for current output, and some procedure name changes. 2010-05-02 Andy Wingo rename `vars' field in tree-il binding constructs to `gensyms' * module/language/tree-il.scm (): Rename `vars' fields of , , , and to `gensyms'. For clarity, and to match . * module/language/tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: Update all callers. 2010-05-02 Andy Wingo fix a comment about environments and the scheme compiler * module/language/scheme/compile-tree-il.scm: Fix a comment about the format of environments. 2010-05-02 Andy Wingo remove `version' field from * module/system/base/language.scm (): Remove the `version' field from languages. It just wasn't useful. * module/language/assembly/spec.scm: * module/language/brainfuck/spec.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/spec.scm: * module/language/elisp/spec.scm: * module/language/glil/spec.scm: * module/language/objcode/spec.scm: * module/language/scheme/spec.scm: * module/language/tree-il/spec.scm: * module/language/value/spec.scm: Remove #:version from all language definitions. Shorten some language names (e.g. "Guile Scheme" -> "Scheme"). 2010-05-01 Andy Wingo update documentation for vm instructions * doc/ref/vm.texi: Update with documentation for new-ish instructions, and reorganize the sections a bit. * doc/ref/compiler.texi (GLIL): Fix up a couple xrefs. 2010-05-01 Andy Wingo simplify make-struct * libguile/vm-i-scheme.c: Use DROPN idiom. 2010-05-01 Andy Wingo optimize and bugfix make-struct VM opcode * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for make-struct change. * libguile/struct.c (scm_i_alloc_struct): Use scm_words instead of scm_gc_malloc to simplify the code and inline the call to GC_MALLOC. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile make-struct/no-tail to make-struct. * module/language/tree-il/primitives.scm (define-primitive-expander): Allow a conditional branch of #f to aboirt inlining. (make-struct): Expand into make-struct/no-tail in the case that tail-size is 0. * libguile/vm-i-scheme.c (make-struct): Adapt to always assume tail-size is 0. Inline allocation if possible. Don't decrement the SP past live objects on the stack, which could cause GC to miss references. Use the NULLSTACK macro. 2010-04-27 Andy Wingo fix bug in compile-glil.scm for return opcode-hack * module/language/tree-il/compile-glil.scm (*primcall-ops*): Fix entry for `return'. Thanks to Jon Herron for the report. add module-export-all! * module/ice-9/boot-9.scm (module-export-all!): New function, exports all current and future local variables from a module. Merge branch 'wip-module-namespaces' comment some global variables in modules.c * libguile/modules.c: Comment some global variables. 2010-04-26 Neil Jerram Fix inconsistent sectioning, causing make to fail * doc/ref/guile.texi (Top): Remove @raisesections and @lowersections around scheme-ideas.texi. * doc/ref/scheme-ideas.texi (About Data, ...): Instead remove one "sub" from every node here apart from the chapter node. * doc/ref/scheme-ideas.texi (Evaluating, Eval Variable, Eval Procedure, Eval Special, Lexical Scope, Scoping Example): Turn subheadings back into subsubsections, and reinstate corresponding menus. (These had to become headings, rather than (sub)*sections, when the top level item in scheme-ideas.texi was a section. Now it's a chapter again, they can go back to being (sub)*sections.) 2010-04-26 Neil Jerram Bring the manual organisation section a little closer to reality FWIW I'm not sure I like this bullety presentation - but for now this just aligns the descriptions a bit closer to the actual chapters and chapter contents. * doc/ref/intro.texi (Organisation of this Manual): Cover `Hello Guile!' and `Hello Scheme!' chapters. Thin out text for `Programming in Scheme'. Renumber other chapters. 2010-04-26 Neil Jerram Assorted minor manual changes * doc/ref/guile.texi (Programming in Scheme): Remove "awful" and add "as opposed to having to dive into C code", to explain what we really mean here. Remove incorrect para about the `Hello Scheme!' material. * doc/ref/intro.texi (Interactive Programming): Change "allows" to "is designed for" - sounds less accidental! * doc/ref/scheme-ideas.texi (Hello Scheme!): Remove unnecessary "reference", and inappropriate "randomness". 2010-04-26 Neil Jerram More `Guile and the GNU Project' text * doc/ref/intro.texi (Guile and the GNU Project): More text about extensibility and software freedom. 2010-04-25 Neil Jerram Move description of manual organisation from Preface to Introduction This material isn't "meta-" enough to be in the Preface, and it supports (by its structure) some of the points that the Introduction makes about Guile, so I think it belongs here. * doc/ref/intro.texi (Introduction): Add `Organisation of this Manual' menu item and material to here... * doc/ref/preface.texi (Preface): ...from here. 2010-04-25 Neil Jerram Remove weird instruction * doc/ref/intro.texi: Remove `Do not confuse the two.' (Or else what?) Fix typo * doc/ref/compiler.texi (Bytecode and Objcode): Remove extraneous comma. 2010-04-25 Neil Jerram Move `Reporting Bugs' section out of Introduction I think it's too detailed, when compared with the other Introduction sections. It probably also refers to concepts that haven't been mentioned yet, but are mentioned in the following quick tour chapter; so let's move it there. * doc/ref/guile.texi: Move @raisesections and @lowersections for tour.texi material from here to inside tour.texi. * doc/ref/intro.texi (Introduction): Don't mention reporting problems in first para. Move menu item and material for `Reporting Bugs' from here... * doc/ref/tour.texi (Hello Guile!): ...to here. Also mention reporting problems in the introductory para. 2010-04-25 Neil Jerram Move whirlwind tour material to its own chapter * doc/ref/guile.texi (Top): New top level `Hello Guile!' menu item; include new file tour.texi. * doc/ref/intro.texi (Introduction): Remove whirlwind tour menu item and material from here... * doc/ref/tour.texi: ...to new file here. 2010-04-25 Neil Jerram Move Scheme introduction (Guile-independent) to its own chapter This magically fixes all the internal wordings that say "chapter" rather than "section", and separates Guile-independent and skippable material from material that is Guile-specific and probably-not-skippable - which I think is helpful. * doc/ref/guile.texi (Top): New `Hello Scheme!' menu item, and removed `Basic Ideas' item. Move include of scheme-ideas.texi before `Programming in Scheme' chapter, using @raisesections and @lowersections. Also move scheme-reading.texi to same place. * doc/ref/scheme-ideas.texi: Change name from `Basic Ideas' (which is a bit boring) to `Hello Scheme!'. Move `Further Reading' menu item here. 2010-04-24 Andy Wingo module-public-interface is a field in the module record * module/ice-9/boot-9.scm (module-public-interface) (set-module-public-interface!): Instead of using '%module-public-interface, use a field in the module instead. (make-module, make-autoload-interface): Adapt. * module/ice-9/deprecated.scm (module-public-interface): (set-module-public-interface!): Add shims so that manually munging %module-public-interface should continue to work. 2010-04-24 Andy Wingo fix some uses of %module-public-interface * module/ice-9/r5rs.scm: * module/ice-9/safe-r5rs.scm: * module/oop/goops/save.scm: * module/oop/goops/simple.scm: * module/oop/goops/stklos.scm: Fix some uses of %module-public-interface. 2010-04-24 Andy Wingo module-public-interface in Scheme * libguile/modules.c: Consolidate all variables to the top of the file. (scm_module_public_interface): Dispatch to Scheme. (scm_post_boot_init_modules): Resolve module-public-interface. * module/ice-9/boot-9.scm (module-public-interface): Implement in Scheme. 2010-04-24 Andy Wingo add submodule binders * module/ice-9/boot-9.scm (module-submodule-binder) (set-module-submodule-binder!): New field on modules. (make-module, make-autoload-interface): Adapt. (module-ref-submodule): If we miss the submodules table, call the submodules binder, if any. * module/ice-9/deprecated.scm (module-ref-submodule): Check the submodule binder before the deprecated look into the obarray. 2010-04-24 Andy Wingo module-{ref,define}-submodule use the submodules table * module/ice-9/boot-9.scm (module-ref-submodule) (module-define-submodule!): Implement in terms of the module-submodules table, instead of looking for bindings in the value namespace. * module/ice-9/deprecated.scm (module-ref-submodule): (module-define-submodule!): Define deprecated versions of these that duplicate the submodules table in the normal values namespace, for back compatibility. 2010-04-24 Andy Wingo add submodules field to modules * module/ice-9/boot-9.scm (module-type, module-constructor): Add a field to modules, a table that will hold submodules. (make-module, make-autoload-interface): Adapt. use nested-ref-module in (system xref) * module/system/xref.scm (program-callee-rev-vars): Use nested-ref-module instead of nested-ref. nested module fixen to (ice-9 ls) * module/ice-9/ls.scm (local-definitions-in, definitions-in): Use nested module procedures, as appropriate. (recursive-local-define): Fix attempt to treat null as false. Whoops.. deprecated %app shims use module-define-submodule! * module/ice-9/deprecated.scm (%app, app, modules): Don't use the module interface to provide %app shims, use module-define-submodule! directly to side-effect the root module. resolve-module uses -module variants * module/ice-9/boot-9.scm (resolve-module): Use module-define-submodule! when binding the root, and nested-ref-module for the hot lookup, which is guaranteed to return a module or #f. use the define-module variants in module-name and make-modules-in * module/ice-9/boot-9.scm (module-name): Use module-define-submodule! instead of nested-define!. (make-modules-in): Rewrite in terms of nested-define-module!. nested-ref et al use module-ref-submodule; add -module nested variants * module/ice-9/boot-9.scm: Update comments above nested-ref to include ref-module and define-module!. (nested-ref, nested-set!, nested-define!, nested-remove!): Use module-ref-submodule to traverse the module hierarchy. (nested-ref-module, nested-define-module!): New functions, like nested-ref and nested-define!, but operate on namespaces instead of values. (local-ref-module, local-define-module): New analogs of local-ref and local-define, but for namespaces. 2010-04-23 Andy Wingo add module-ref-submodule, module-define-submodule! * module/ice-9/boot-9.scm (module-ref-submodule): (module-define-submodule!): New stubs, will be used to separate traversing the module tree from accessing values. tweak to resolve-module * module/ice-9/boot-9.scm (resolve-module): If we found a module but it didn't have a public interface and we're not autoloading, just return the module directly instead of dispatching to make-modules-in. fix (app modules) usage in (ice-9 session) * module/ice-9/session.scm (root-modules): Fix '(app modules) usage. 2010-04-22 Andy Wingo deprecate %app * module/ice-9/boot-9.scm (module-name): Don't rely on (%app modules), use other tricks to name anonymous modules. (resolve-module): Instead of relying on %app, close over the root of the module hierarchy -- the module that was '(%app modules). * module/ice-9/deprecated.scm (%app): Provide a compatible %app shim. 2010-04-22 Andy Wingo refactorings for the module boot process * module/ice-9/boot-9.scm (%app): Bind %app and (%app modules) within the nested hierarchy before making (guile). (the-root-module): Define to '(%app modules guile) together with the-root-module's definition. (resolve-module): Define a "phase 2" resolve-module that only works on the root module. (try-module-autoload): No need for stub definition, as modules.c does not reference this binding. (resolve-module): Redefine, after modules have been loaded, to actually do its job, without any hacks for the pre-boot phase. Move up the boot code before the definition of resolve-module's helpers. 2010-04-22 Andy Wingo add comments to resolve-module * module/ice-9/boot-9.scm (resolve-module): Add comments. formally deprecate `app' * module/ice-9/deprecated.scm (app): Deprecate. * module/ice-9/boot-9.scm: Remove app definition. (app modules) -> (%app modules) * module/ice-9/debugging/breakpoints.scm (module-if-already-loaded): (all-loaded-modules): * module/oop/goops/stklos.scm: Fix instances of (app modules) to be (%app modules). 2010-04-20 Andy Wingo fix comment about "local-define" and "local-remove". * module/ice-9/boot-9.scm: Fix comment about "local-define!", whereas it's "local-define". Same for "local-remove". 2010-04-20 Andy Wingo module-type defined programmatically * module/ice-9/boot-9.scm (make-record-type): Add an explanatory comment. (%print-module): Remove a hacky comment about redefinitions being difficult, because now the module-printer is called by name from module-type's printer. (module-type): Define the module type, its constructor, predicate, and accessors programmatically, at expansion time. Should reduce any errors in transcription, between adding fields and adding accessors. * libguile/modules.c (scm_lookup_closure_module): Move an explanatory comment here from boot-9.scm. 2010-04-19 Andy Wingo avoid primitive-eval in record-constructor * module/ice-9/boot-9.scm (record-type-vtable): Add a third field, a precomputed constructor. There is an unfortunate circularity here, though. (make-record-type): If the record has fewer than 20 fields, return a constructor pre-generated to suit. Otherwise just check the length, and dispatch to `apply' and not `primitive-eval'. FWIW the current module record has something like 12 fields. (record-constructor): If we're asking for the standard constructor, return the precomputed constructor. 2010-04-19 Andy Wingo make-record-type slight refactor * test-suite/tests/records.test ("records"): Add tests for printers. * module/ice-9/boot-9.scm (make-record-type): Refactor the code that makes the default printer. 2010-04-19 Andy Wingo filesystem trickery to scm_i_relativize_path in filesys.c; bugfix. * libguile/filesys.h: * libguile/filesys.c (scm_i_relativize_path): New function, moved here from fports.c. Internal for now; we can make it external though if people like its interface. * libguile/fports.c (fport_canonicalize_filename): Move all of the tricky bits to filesys.c. Also fixes a bug in which a delimiter wasn't stripped. 2010-04-19 Andy Wingo deprecate @bind * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (@bind): Deprecate @bind, which was a thread-unsafe dynamic scoping mechanism, used in the old elisp support. Fluids are more correct, and are probably faster, given the VM support for with-fluids. * test-suite/tests/dynamic-scope.test: Remove. * test-suite/tests/fluids.test: Move relevant tests from dynamic-scope.test here, recast in terms of with-fluids. 2010-04-19 Andy Wingo compile-file gets #:canonicalization arg, defaults to 'relative * module/system/base/compile.scm (compile-file, compile-and-load): Add a keyword arg #:canonicalization, which defaults to 'relative. In this way, one might compile "../module/ice-9/boot-9.scm", but the path that gets residualized into the .go is "ice-9/boot-9.scm". %file-port-name-canonicalization is a fluid * libguile/fports.c (fport_canonicalize_filename): (scm_init_fports): Change %file-port-name-canonicalization to be a fluid. add %file-port-name-canonicalization option * libguile/fports.c (%file-port-name-canonicalization): New global var. (fport_canonicalize_filename): New helper. If %file-port-name-canonicalization is 'absolute, then run file port names through canonicalize_path; if it's 'relative, then canonicalize the name, but strip off load paths; otherwise leave the port name alone. (scm_open_file): Use fport_canonicalize_filename. (scm_init_fports): Define %file-port-name-canonicalization. formatting fix * libguile/filesys.c (scm_canonicalize_path): Format fix. use procedure-minimum-arity in tests * test-suite/tests/procprop.test ("procedure-arity"): Fix tests to use procedure-minimum-arity. 2010-04-17 Andy Wingo deprecate arity access via (procedure-properties proc 'arity) * libguile/procprop.h (scm_sym_arity): Deprecate. I didn't move it to deprecated.h though, because that might have some boot implications -- though I didn't check. * libguile/procprop.c (scm_procedure_properties) (scm_set_procedure_properties_x, scm_procedure_property) (scm_set_procedure_property_x): Deprecate access to a procedure's arity via procedure-properties. Users should use procedure-minimum-arity. * module/ice-9/channel.scm (eval): * module/ice-9/session.scm (arity): * module/language/tree-il/analyze.scm (validate-arity): Fix up instances of (procedure-property x 'arity) to use procedure-minimum-arity. 2010-04-17 Andy Wingo add procedure_minimum_arity * libguile/procprop.h: * libguile/procprop.c (scm_procedure_minimum_arity): New public function, will replace (procedure-property foo 'arity). * libguile/programs.c (scm_i_program_arity): Rework to always provide the most permissive arity. 2010-04-17 Andy Wingo remove program-name, program-documentation * libguile/programs.h: * libguile/programs.c (scm_program_name): Remove. procedure-name is sufficient. * module/system/vm/program.scm (program-name): Remove from exports list. (program-documentation): Remove; procedure-documentation is sufficient. * libguile/debug.c (scm_procedure_name): Remove special case for programs. * module/language/tree-il/analyze.scm (validate-arity): Use procedure-name. * module/ice-9/documentation.scm (object-documentation): Just use procedure-documentation, without special cases for programs. 2010-04-17 Andy Wingo scm_i_program_properties is internal; just use procedure-properties * libguile/programs.h: * libguile/programs.c (scm_i_program_properties): Make internal. (scm_program_name): Use scm_i_program_properties. * libguile/procprop.c (scm_procedure_properties): Use scm_i_program_properties, for programs. * libguile/procs.c (scm_procedure_documentation): Use procedure-property to get to 'documentation, not program-property. * module/system/vm/program.scm (program-properties, program-property): Remove from the exports list. (program-documentation): Use procedure-property. * module/texinfo/reflection.scm (macro-arguments) (macro-additional-stexi) (object-stexi-documentation): Use procedure-property, not program-property. 2010-04-17 Andy Wingo tweaks to procprop.c * libguile/procprop.c (scm_procedure_property) (scm_set_procedure_property_x): Fix up some variable naming. procedure-properties incorporates program-properties * libguile/procprop.c (overrides, overrides_lock): Rename from props and props_lock. (scm_procedure_properties): If no overrides have been set, default to scm_program_properties (if it's a program). (scm_set_procedure_properties_x): Error if 'arity is in the alist. (scm_procedure_property): Just do a lookup in the scm_procedure_properties. (scm_set_procedure_properties_x): Init the overrides to scm_procedure_properties. fix read.bm * benchmark-suite/benchmarks/read.bm (%files-to-load): psyntax-pp.scm, not psyntax.scm. 2010-04-16 Neil Jerram Merge branch 'wip-manual-2' Conflicts: doc/ref/api-translation.texi 2010-04-16 Andy Wingo fold in feedback to api-languages * doc/ref/api-languages.texi: Fold in feedback. NEWS tweaks for nil * NEWS: Some nil-related news fixes; after 1.9.10, I know, but hey ;-) more nil docs * doc/ref/api-languages.texi (Nil): Be a bit more thorough, and positive. add docs on `nil' * doc/ref/api-languages.texi (Nil): Write about `nil'. fix bugs in ice-9 i18n demo (invalid input) * doc/ref/api-i18n.texi (Accessing Locale Information): Crucial bugfixes. fixes to api-i18n.texi * doc/ref/api-i18n.texi (Character Case Mapping): Remove note about lack of support for multibute characters. flesh out docs on multiple languages a bit more * doc/ref/api-languages.texi: Move here from api-translation. Still stubbed in parts, but it's getting better. * doc/ref/Makefile.am: Adapt to api-languages.texi name change. * doc/ref/guile.texi: Likewise. 2010-04-15 Ludovic Courtès Bump version number for 1.9.10. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2010-04-11 Neil Jerram Improvements to Introduction chapter * doc/ref/intro.texi (Introduction): Change "some" to "the". (Guile and Scheme): "multithreading" -> "multithreaded". (Combining with C): Mention "libguile" as library name. (Guile and the GNU Project): New text. (Interactive Programming): New text. (Supporting Multiple Languages): New text, reflecting currently supported languages. (Obtaining and Installing Guile): Use @var for version placeholder. Remove mention of separate tutorial. 2010-04-10 Neil Jerram Merge branch 'master' into wip-manual-2 Conflicts: doc/ref/api-procedures.texi doc/ref/misc-modules.texi (Caused by me removing `@page' from a couple of sections that have been modified by others.) 2010-04-09 Andy Wingo elisp.test cleanups * test-suite/tests/elisp.test: Use quote and #nil instead of quasiquote and ,#nil. re-enable elisp test * test-suite/tests/elisp.test: Rework for #nil, to actually be enabled, to always run, and to use the new compiler. Comment out some failing tests, to be dealt with in the future. change remaining %nil -> #nil * doc/ref/vm.texi: * libguile/boolean.h: * libguile/pairs.h: * module/language/elisp/README: * test-suite/tests/elisp-compiler.test: * test-suite/tests/load.test: Change remaining mentions of %nil to #nil. 2010-04-09 Andy Wingo elisp fixes for nil, and, or * module/language/elisp/runtime/macro-slot.scm (or, and): Fix one-arg case to return the arg as-is. * module/language/elisp/runtime.scm (nil-value): Fix to be #nil. 2010-04-09 Andy Wingo remove libguile/lang.h, deprecate %nil (in favor of #nil) * libguile/Makefile.am: * libguile/init.c: * libguile/lang.c: * libguile/lang.h: Remove lang.c and lang.h. * libguile/pairs.h (SCM_NIL_P, SCM_NULL_OR_NIL_P): Moved here. * module/ice-9/deprecated.scm (%nil): %nil definition moved here. * libguile/alist.c: * libguile/async.c: * libguile/backtrace.c: * libguile/boolean.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/list.c: * libguile/load.c: * libguile/options.c: * libguile/posix.c: * libguile/print.c: * libguile/promises.c: * libguile/sort.c: * libguile/throw.c: * libguile/trees.c: * libguile/vectors.c: * libguile/vm.c: * libguile/weaks.c: * srfi/srfi-1.c: references removed. 2010-04-09 Andy Wingo %nil -> #nil * module/language/assembly.scm (object->assembly, assembly->object): * module/language/elisp/compile-tree-il.scm (compile-pair): * module/language/glil/decompile-assembly.scm (decompile-load-program): Change instances of %nil to #nil. 2010-04-09 Andy Wingo add read syntax for #nil * libguile/evalext.c (scm_self_evaluating_p): #nil is self-evaluating. * libguile/read.c (scm_read_nil, scm_read_sharp): Add read syntax for #nil. 2010-04-09 Andy Wingo lisp nil always enabled * configure.ac: Remove --disable-elisp option. Lisp nil is always enabled. * libguile/boolean.h: * libguile/gen-scmconfig.c: * libguile/gen-scmconfig.h.in: * libguile/init.c: * libguile/lang.c: * libguile/lang.h: * libguile/pairs.h: * libguile/private-options.h: * libguile/read.c: Remove conditionals for disabling elisp. 2010-04-09 Andy Wingo add debugging input and output ports * module/system/vm/debug.scm (*debug-input-port*): (*debug-output-port*): New public fluids. (run-debugger): Add some kwargs for input and output ports, defaulting to the debug input and output ports. (debug-pre-unwind-handler): Print to debug output port. (debug): Untabify. repl-reader only prompts if no input is available * module/ice-9/boot-9.scm (repl-reader): For the default (non-readline) repl reader, only display the prompt if input isn't already available. Fixes spurious prompts in the debugger. 2010-04-09 Ludovic Courtès Raise an error when attempting to modify the value of `%null-pointer'. * libguile/foreign.c (sym_null_pointer_error): New variable. (null_pointer_error): New function. (scm_foreign_set_x): Raise an error if attempting to modify NULL_POINTER. (scm_foreign_to_bytevector): Use `null_pointer_error ()' instead of `scm_misc_error ()'. * test-suite/tests/foreign.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/foreign.test. * test-suite/lib.scm (exception:null-pointer-error): New variable. 2010-04-09 Ludovic Courtès Allocate foreign pointer objects in GC-scanned memory. * libguile/foreign.c (scm_take_foreign_pointer): Allocate RET in GC-scanned memory. This fixes a bug where the object pointed to by SCM_CIF in the pair returned by `cif_to_procedure ()' would be reclaimed (as a consequence of commit 087aa6aa312a8d0af51fa9b2f7bfc1332ad97338). Avoid obsolescent C declarator with empty parentheses. * libguile/foreign.c (scm_i_foreign_call): Don't declare FUNC with a declarator with empty parentheses (bug #23681). 2010-04-09 Ludovic Courtès Fix `module-reverse-lookup'. * libguile/modules.c (scm_module_reverse_lookup): Type-check VARIABLE. Don't traverse the `uses' list when MODULE is #f. * test-suite/tests/modules.test ("foundations")["module-reverse-lookup [pre-module-obarray]", "module-reverse-lookup [wrong-type-arg]"]: New tests. 2010-04-09 Ludovic Courtès Remove `fold' from (sxml fold). * module/sxml/fold.scm: Use (srfi srfi-1). (fold): Remove. (fold-values): Update docstring accordingly. * test-suite/tests/sxml.fold.test: Use (srfi srfi-1). 2010-04-08 Andy Wingo fix curried definitions for value defines * module/ice-9/curried-definitions.scm: Allow definitions of values with define and define*. * test-suite/tests/curried-definitions.test: Add tests. sync regs before calling scm_class_of * libguile/vm-i-scheme.c (class-of): Sync registers before calling scm_class_of. 2010-04-08 Andy Wingo add (ice-9 curried definitions) * module/Makefile.am: * module/ice-9/curried-definitions.scm: New module, implementing SICM-style currying. * test-suite/Makefile.am: * test-suite/tests/curried-definitions.test: A test. 2010-04-08 Andy Wingo fix bug when importing bindings that were already imported and used * module/ice-9/boot-9.scm (module-use!, module-use-interfaces!): When adding the module or interface to the use list, clear the cached imports obarray. The test case is coming next. 2010-04-07 Andy Wingo update licenses on tests imported from guile-lib * test-suite/tests/sxml.fold.test: * test-suite/tests/sxml.ssax.test: * test-suite/tests/sxml.transform.test: * test-suite/tests/sxml.xpath.test: * test-suite/tests/texinfo.docbook.test: * test-suite/tests/texinfo.serialize.test: * test-suite/tests/texinfo.string-utils.test: * test-suite/tests/texinfo.test: Update licenses to GPL or LGPL 3+, and update copyright holders to be FSF (where that is the case). Copyright holders who are not FSF have their code in GPL/LGPL-compatible licesnse. add docs and tests for array->list * libguile/generalized-arrays.c (scm_array_to_list): Add docs. * test-suite/tests/arrays.test ("array->list"): Add tests. update NEWS for 1.9.10 * NEWS: Update for new 1.9.10 entries. very important fix to (system repl command) * module/system/repl/command.scm (language): s/Have fun/Happy hacking/. Heh. deprecated sc-expand in deprecated (ice-9 syncase) * module/ice-9/syncase.scm: Export sc-expand as macroexpand. Update NEWS to reflect the current state * NEWS: Update a number of old entries. 2010-04-06 Andy Wingo remove transient 1.9.9 entries from the NEWS * NEWS: Cull 1.9.9 entries. finish ffi docs * libguile/foreign.c: Some doc tweaks. * doc/ref/api-foreign.texi: Finish FFI docs. more ffi docs * libguile/foreign.c (scm_make_foreign_function): Doc a little. * doc/ref/api-foreign.texi (Foreign Function Interface): Document some more. 2010-04-03 Michael Gran copyright dates * libguile/unidata_to_charset.pl: change copyright date * test-suite/tests/srfi-14.test: change copyright date 2010-04-03 Michael Gran Remove obsolete docs for multi-byte text These describe the initial, unimplemented plan for Unicode support. These have been overcome by events. * doc/mbapi.texi: removed * doc/mltext.texi: removed 2010-04-03 Michael Gran Update standard character sets to Unicode 5.2 * srfi-14.i.c: all character ranges updated to Unicode 5.2 2010-04-03 Michael Gran Unicode data parsing script incorrect for char-set:ascii char-set:ascii is the only char-set consisting of a single contiguous range, and there was an off-by-one error for that case. * libguile/unidata_to_charset.pl (compute): fix off-by-one 2010-04-02 Andy Wingo deprecate dynamic-args-call, and update docs some more * libguile/deprecated.h (scm_dynamic_args_call): Deprecate. * libguile/deprecated.c: * libguile/dynl.h: * libguile/dynl.c: * doc/ref/api-foreign.texi: More doc updates. 2010-04-02 Andy Wingo add api-foreign.texi * doc/ref/api-foreign.texi: New file. * doc/ref/api-modules.texi: Reorganize bits about dynamic linking into api-foreign. * doc/ref/guile.texi: * doc/ref/Makefile.am: Adapt to api-foreign.texi. 2010-04-01 Andy Wingo fix vector-ref and vector-set opcodes for weak vectors * libguile/vectors.h (SCM_I_IS_NONWEAK_VECTOR): New internal predicate. * libguile/vm-i-scheme.c (vector-ref, vector-set): Only inline access to nonweak vectors. 2010-04-01 Andy Wingo more fixes to equal? for arrays * libguile/array-map.c (array_compare, scm_array_equal_p): Rewrite as something that operates on the generic array handle infrastructure. Based on array->list. (scm_i_array_equal_p): Change the docs, as array-equal? is now the same as equal?, except that it typechecks its args. * doc/ref/api-compound.texi (Array Procedures): Update array-equal? docs. * libguile/deprecated.h: * libguile/deprecated.c (scm_raequal): Deprecate. * libguile/bytevectors.c (scm_bytevector_eq_p): Bugfix: bytevectors are bytevector=? only if their element type is the same. * libguile/eq.c (scm_equal_p): Only dispatch to scm_array_equal_p if both args are arrays (generically). * test-suite/tests/arrays.test ("equal?"): Add some more tests. 2010-03-31 Andy Wingo fix array bugs in ecmascript * module/language/ecmascript/array.scm (pput, *array-prototype*): Fix bugs in ecmascript array runtime. fix bug in ash opcode * libguile/vm-i-scheme.c (ash): Fix embarrassing bug in (ash 1 32). * test-suite/tests/bit-operations.test ("bitshifts on word boundaries"): Add tests. 2010-03-31 Andy Wingo rename unif.test to arrays.test * test-suite/tests/arrays.test: Move all unif.test here. Unif.test was mostly testing arrays anyway. Incorporate the existing arrays.test. * test-suite/tests/unif.test: Deleted. * test-suite/Makefile.am: Update. 2010-03-31 Ludovic Courtès Move another GOOPS-less test at the beginning. * test-suite/tests/eval.test ("promises")["extended promise behaviour"]("implicit forcing is not supported"): Move... * test-suite/tests/00-initial-env.test ("goopsless"): ... here. 2010-03-31 Ludovic Courtès Add separate test file for GOOPS-less tests. * test-suite/tests/00-initial-env.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/00-initial-env.test'. * test-suite/tests/numbers.test ("+")["wrong type argument"]: Move to `00-initial-env.test'. 2010-03-31 Ludovic Courtès Adapt ECMAScript parser and lexer to `(system base lalr)'. * module/language/ecmascript/tokenize.scm: Use `make-lexical-token' and related procedures instead of pairs as tokens passed to the parser. Pass source location information in the form of `source-location' objects. * module/language/ecmascript/parse.scm (read-ecmascript, read-ecmascript/1): Instantiate a new parser at each call. (parse-ecmascript): Rename to... (make-parser): ... this. Change `->' to `:' in the grammar syntax. * module/language/ecmascript/parse-lalr.scm: Remove. * module/Makefile.am (ECMASCRIPT_LANG_SOURCES): Remove `language/ecmascript/parse-lalr.scm'. 2010-03-31 Ludovic Courtès Add rudimentary ECMAScript tests. * test-suite/Makefile.am (SCM_TESTS): Add `tests/ecmascript.test'. * test-suite/tests/ecmascript.test: New file. 2010-03-31 Ludovic Courtès Mention `(system base lalr)' in the manual. * doc/ref/Makefile.am (guile_TEXINFOS): Add `api-lalr.texi'. * doc/ref/api-lalr.texi: New file. * doc/ref/guile.texi (API Reference): Include it. 2010-03-31 Ludovic Courtès Add Boucher's `lalr-scm' as the `(system base lalr)' module. Taken from r51 of . * module/Makefile.am (SYSTEM_BASE_SOURCES): Add `system/base/lalr.scm'. (NOCOMP_SOURCES): Add `system/base/lalr.upstream.scm'. * module/system/base/lalr.scm, module/system/base/lalr.upstream.scm: New files. * test-suite/Makefile.am (LALR_TESTS, LALR_EXTRA, TESTS, TESTS_ENVIRONMENT): New variables. (EXTRA_DIST): Add $(LALR_EXTRA). * test-suite/lalr/common-test.scm, test-suite/lalr/glr-test.scm, test-suite/lalr/test-glr-associativity.scm, test-suite/lalr/test-glr-basics-01.scm, test-suite/lalr/test-glr-basics-02.scm, test-suite/lalr/test-glr-basics-03.scm, test-suite/lalr/test-glr-basics-04.scm, test-suite/lalr/test-glr-basics-05.scm, test-suite/lalr/test-glr-script-expression.scm, test-suite/lalr/test-glr-single-expressions.scm, test-suite/lalr/test-lr-associativity-01.scm, test-suite/lalr/test-lr-associativity-02.scm, test-suite/lalr/test-lr-associativity-03.scm, test-suite/lalr/test-lr-associativity-04.scm, test-suite/lalr/test-lr-basics-01.scm, test-suite/lalr/test-lr-basics-02.scm, test-suite/lalr/test-lr-basics-03.scm, test-suite/lalr/test-lr-basics-04.scm, test-suite/lalr/test-lr-basics-05.scm, test-suite/lalr/test-lr-error-recovery-01.scm, test-suite/lalr/test-lr-error-recovery-02.scm, test-suite/lalr/test-lr-no-clause.scm, test-suite/lalr/test-lr-script-expression.scm, test-suite/lalr/test-lr-single-expressions.scm: New files. 2010-03-31 Andy Wingo fix equal? between an array and a non-array OK let's try again. While the thanks go to Daniel Llorens del Río for the tip, the blame continues going to me :) * test-suite/Makefile.am: * test-suite/tests/arrays.test: Add a test. * libguile/array-map.c (raeql): Handle a few 0-dimensional cases. If the shapes of the arrays don't match, just return #f instead of raising an error. 2010-03-30 Andy Wingo Revert "fix equal? between an array and a non-array" This reverts commit 9d031d4d575ac8f343a5d984cb02cd374577c5a9. 2010-03-30 Andy Wingo fix equal? between an array and a non-array * libguile/eq.c (scm_equal_p): Only call scm_array_equal_p if both arguments are generalized arrays; otherwise they are not equal. Thanks to Daniel Llorens del Río for the tip. * test-suite/Makefile.am: * test-suite/tests/arrays.test: Add a test. 2010-03-30 Andy Wingo correctly handle --no-autocompile (fixed broken previous patch) * libguile/load.c (scm_init_load): Initialize %load-should-autocompile to false. * libguile/init.c (scm_i_init_guile): * libguile/load.h: * libguile/load.c (scm_init_load_should_autocompile): At the end of init, check GUILE_AUTO_COMPILE. * libguile/script.c (scm_compile_shell_switches): Instead of making --autocompile / --no-autocompile render into the s-expression, just handle them immediately, so that --no-autocompile takes effect for the expander. 2010-03-30 Andy Wingo nil is null, whee * libguile/pairs.h (scm_is_null): Nil is also null. * libguile/vm-i-scheme.c (not, not-not, null?, not-null?): * libguile/vm-i-system.c (br-if-null, br-if-not-null): Remove some more nil special cases. 2010-03-30 Andy Wingo nil is false, whee * libguile/boolean.h (scm_is_false): Recognize nil as false, by default. (scm_is_bool): Recognize nil as a boolean. * libguile/boolean.c (scm_not, scm_boolean, scm_to_bool, scm_is_bool): Adapt to treat nil as false. * libguile/vm-i-system.c (br-if, br-if-not): Just use scm_is_false instead of specifically mentioning nil. 2010-03-30 Andy Wingo going through scm_shell not necessary to get autocompilation * libguile/load.c (scm_init_load): Initialize %load-should-autocompile from the environment variable here, so that apps that don't go through scm_shell get autocompilation. * libguile/script.c (scm_compile_shell_switches): Explicitly enable or disable autocompilation here, if told to do so. 2010-03-29 Andy Wingo fix bug in scm_must_free * libguile/gc-malloc.c: Update a comment. (scm_must_free): Must be able to free memory allocated with scm_must_malloc, and thus must be GC_FREE, not free. remove out-of-date comment in scm_gc_malloc * libguile/gc-malloc.c (scm_gc_malloc): Remove out-of-date comment. (texinfo reflection) parses out macro metadata * module/texinfo/reflection.scm (macro-arguments): (macro-additional-stexi, object-stexi-documentation): Parse out the metadata in macros, if it is available, so we can show defmacros' arguments, syntax-rules' patterns, etc. 2010-03-29 Andy Wingo metadata for syntax-rules, identifier-syntax, and define-macro macros * module/ice-9/psyntax.scm (syntax-rules, identifier-syntax): * module/ice-9/boot-9.scm (define-macro): Embed metadata into the macro transformer for use by documentation tools and the like. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-03-28 Mark H Weaver Renumber IFLAGSs so the first 8 are reserved for lisp booleans. This enables more efficient implementations of several operations, e.g. scm_is_lisp_bool, canonicalize_boolean, fast_boolean_not, converting SCM booleans to C booleans, etc. * libguile/tags.h: Renumber IFLAGs. * libguile/print.c: Renumber iflagnames to match. * libguile/boolean.c: * libguile/boolean.h: SCM_XXX_ANOTHER_BOOLEAN_DONT_USE --> SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0 2010-03-28 Andy Wingo Fix inlining of lambda-apply-lambda. * module/language/tree-il/inline.scm (inline!): Only inline (lambda args (apply (lambda ...) args)) if the outer lambda has rest args. Thanks to Mark Weaver for the note. 2010-03-26 Andy Wingo remove spurious declarations in c-tokenize.lex * libguile/c-tokenize.lex: Remove spurious declarations of flex-internal functions, as their prototypes are changing in upstream flex. 2010-03-25 Andy Wingo vectors of pairs in docstring position are metadata * module/ice-9/psyntax.scm (chi-lambda-case, lambda): If we find a vector of pairs in the docstring position, interpret those pairs as additional metadata. * module/ice-9/psytntax-pp.scm: Regenerated. 2010-03-25 Andy Wingo psyntax supports multiple docstrings, merging lambda-case metadata * module/ice-9/psyntax.scm (build-simple-lambda, build-case-lambda): Don't take a docstring, take a metadata alist. Don't bother annotating interpreted expressions with docstrings. (chi-simple-lambda): Take already-parsed metadata. (lambda): Parse out multiple docstrings as separate "documentation" entries in the "meta". (chi-lambda-case): Merge multiple "meta" entries among the various cases. (lambda*, case-lambda, case-lambda*): Receive "meta" clauses, not docstrings. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-03-23 Andy Wingo make guile's welcome more gnu-conventional; also warranty and copying info * module/system/repl/command.scm: Add support for ,show with topics "warranty", "copying", and "version". (language): Don't re-print the welcome; print sometime more terse. * module/system/repl/common.scm (*version*, *warranty*, *copying*): New public globals. (repl-welcome): Display *version*. 2010-03-22 Andy Wingo Update manual examples of how to link with Guile * doc/ref/intro.texi (Linking Guile into Programs): * doc/ref/libguile-linking.texi (A Sample Guile Main Program): Update examples of how to link with guile. 2010-03-20 Ludovic Courtès Make `include' tail-recursive. * module/ice-9/psyntax.scm (include)[read-file]: Make tail-recursive. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-03-20 Ludovic Courtès Cosmetic changes in `foreign.c'. * libguile/foreign.c (unpack, pack): Add `const' qualifier for `type'. Comment. Indent. (scm_i_foreign_call): Add `const' qualifier for `argv'. Punctuate comments. Clarify argument unpacking loop. Fix argument passing to foreign functions. * libguile/foreign.c (scm_i_foreign_call): When allocating room for DATA, use the sum of all the argument sizes, not `cif->bytes'. 2010-03-19 Andy Wingo fix srfi-31 check after macroexpand rename * test-suite/tests/srfi-31.test: ("rec special form"): Fix check. rename sc-expand to macroexpand * module/ice-9/boot-9.scm (macroexpand): Rename from sc-expand. (%pre-modules-transformer): Adapt to name change. * module/ice-9/compile-psyntax.scm: Adapt to name change. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Rename sc-expand to macroexpand. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Adapt to name change. finish macro docs * doc/ref/api-macros.texi: Finish macro docs. 2010-03-19 Andy Wingo document syntax-case * doc/ref/api-macros.texi: Document syntax-case, and tweak defmacro docs. * doc/ref/api-debug.texi: Move cons-source here. 2010-03-19 Andy Wingo add GUILE-VERSION to CONFIG_STATUS_DEPENDENCIES * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add GUILE-VERSION, so that a change in GUILE-VERSION causes a reconfigure. 2010-03-18 Ludovic Courtès Bump version number for 1.9.9. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Update `NEWS'. 2010-03-18 Andy Wingo A start at syntax-rules docs * doc/ref/api-macros.texi: New file, documenting macros. Removed some old cruft, and started documenting hygienic macros. * doc/ref/api-procedures.texi: Moved macro things out of here. * doc/ref/guile.texi: Separate macros from procedures. * doc/ref/api-data.texi: Update some xrefs. * doc/ref/Makefile.am: Add api-macros.texi. 2010-03-18 Ludovic Courtès Improve encoding error reporting. * libguile/strings.c (scm_encoding_error): Change arguments to convey more information. Raise the error with `scm_throw ()', passing all the information to the handler. (scm_from_stringn, scm_to_stringn): Update accordingly. * test-suite/tests/ports.test ("string ports")["wrong encoding"]: Check the arguments passed to the `throw' handler. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Likewise. 2010-03-18 Ludovic Courtès Update Gnulib; use the `func' module. Update Gnulib to v0.0-3575-g128e4b8. * m4/gnulib-cache.m4: Add `func'. 2010-03-18 Ludovic Courtès Add `%null-pointer' to `(system foreign)'. * libguile/foreign.c (sym_null, null_pointer): New variables. (scm_foreign_to_bytevector): Raise an error when PTR is NULL. (scm_init_foreign): Define SYM_NULL. * module/system/foreign.scm (%null-pointer): New exported binding. 2010-03-17 Ludovic Courtès Remove obsolete test directory. * test-suite/tests/c-api: Remove. 2010-03-17 Ludovic Courtès Change `dynamic-link' to return a global handle when the argument is omitted. * libguile/dynl.c (sysdep_dynl_link): Handle FNAME == NULL. (scm_dynamic_link): Make argument optional. Adjust body accordingly. * test-suite/standalone/test-ffi (global, strerror, strlen): New bindings. Add test for these bindings. * doc/ref/api-modules.texi (Low level dynamic linking): Update description of `dynamic-link'. 2010-03-17 Ludovic Courtès Provide `int', `long', `size_t', etc. in `(system foreign)'. * libguile/foreign.c (sym_int, sym_long, sym_unsigned_int, sym_unsigned_long, sym_size_t): New variables. (scm_init_foreign): Define them at the Scheme level. * module/system/foreign.scm (int, unsigned-int, long, unsigned-long, size_t): New exported bindings. 2010-03-17 Ludovic Courtès Fix doc string of `dynamic-pointer'. * libguile/dynl.c (scm_dynamic_pointer): Fix doc string. Reformat body. Use GC-managed pointerless memory in the FFI. * libguile/foreign.c (scm_make_foreign_function): Use `scm_gc_malloc_pointerless ()' when allocating memory for CIF. (pack): Likewise for the `FFI_TYPE_STRUCT' case. 2010-03-16 Andy Wingo update NEWS for 1.9.9 * NEWS: Update. cull 1.9.8 NEWS items * NEWS: Remove 1.9.8 items; they have been folded in already. add a section to the manual on prompts * doc/ref/api-control.texi (Prompts): Add a section on prompts. 2010-03-16 Andy Wingo parallel installability for libguile*.h * Makefile.am: * libguile/Makefile.am (modincludedir): Install into $pkgincludedir/$GUILE_EFFECTIVE_VERSION. This allows multiple Guile development packages to be installed at once. * guile-readline/Makefile.am (modincludedir): * srfi/Makefile.am (srfiincludedir): Likewise. * meta/guile-2.0.pc.in (Cflags): Add the appropriate -I line so that user code picks up the new location transparently. 2010-03-16 Andy Wingo rename libguile to libguile-@EFFECTIVE_VERSION@, currently libguile-2.0 * libguile/Makefile.am (lib_LTLIBRARIES): Instead of just "libguile.la", make "libguile-@EFFECTIVE_VERSION@.la". This allows multiple versions of Guile to be installed at once. See http://www106.pair.com/rhp/parallel.html for a rationale. (libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS): (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Fixup automake vars to include the effective version. (guile_LDADD): Fix up the spelling of libguile. * libguile/bytevectors.c (scm_bootstrap_bytevectors): * libguile/foreign.c (scm_register_foreign): * libguile/i18n.c (scm_bootstrap_i18n): * libguile/instructions.c (scm_bootstrap_instructions): * libguile/objcodes.c (scm_bootstrap_objcodes): * libguile/programs.c (scm_bootstrap_programs): * libguile/vm.c (scm_bootstrap_vm): Register extensions using e.g. "libguile-2.0" as the libname -- i.e., including the effective version in the libname. * module/ice-9/i18n.scm: * module/rnrs/bytevector.scm: * module/rnrs/io/ports.scm: * module/system/foreign.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: When doing a load-extension for something in Guile, use the effective version also. * meta/guile-2.0-uninstalled.pc.in (Libs): * meta/guile-2.0.pc.in (Libs): Use -lguile-@EFFECTIVE_VERSION@. This change should mean that code built against Guile should not be affected by the libguile rename. * guile-readline/Makefile.am (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): * srfi/Makefile.am (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD): (libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD): (libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD): (libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD): * test-suite/standalone/Makefile.am (test_num2integral_LDADD): (test_round_LDADD): (libtest_asmobs_la_LIBADD): (libtest_ffi_la_LIBADD): (test_list_LDADD): (test_unwind_LDADD): (test_conversion_LDADD): (test_loose_ends_LDADD): (test_scm_c_read_LDADD): (test_scm_take_locale_symbol_LDADD): (test_scm_take_u8vector_LDADD): (libtest_extensions_la_LIBADD): (test_with_guile_module_LDADD): (test_scm_with_guile_LDADD): Fix up the spelling of libguile.la. 2010-03-16 Andy Wingo version.h has SCM_EFFECTIVE_VERSION; effective-version uses that * libguile/version.c (scm_effective_version): Use SCM_EFFECTIVE_VERSION. * libguile/version.h.in (SCM_EFFECTIVE_VERSION): Define from GUILE_EFFECTIVE_VERSION. * libguile/Makefile.am (version.h): Subst in GUILE_EFFECTIVE_VERSION. * test-suite/tests/version.test ("version reporting works"): The effective version is not necessarily MAJOR.MINOR. Remove check. 2010-03-16 Andy Wingo Bump GUILE_EFFECTIVE_VERSION to 2.0 * GUILE-VERSION (GUILE_EFFECTIVE_VERSION): Bump to 2.0. decouple GUILE_VERSION from GUILE_EFFECTIVE_VERSION. * GUILE-VERSION (GUILE_VERSION): Decouple from GUILE_EFFECTIVE_VERSION. This allows us to bumpt the effective version to 2.0 before reaching 2.0. 2010-03-16 Andy Wingo more vm gc fixen * libguile/vm-i-system.c (continuation_call): Sync before calling a continuation. Shouldn't much matter, but it seems like a good idea. (wind-fluids): More importantly, sync before allocating a with-fluids object. 2010-03-15 Ludovic Courtès configure: Abort when GMP is not found. * configure.ac: Fix erroneous `AC_LIB_HAVE_LINKFLAGS' invocation. Above when $HAVE_LIBGMP is not "yes". 2010-03-15 Ludovic Courtès Make sure the whole VM stack is always scanned by the GC. Thanks to Andy for noticing this. * libguile/vm-engine.h (SYNC_REGISTER, CACHE_REGISTER): Add comment. * libguile/vm-i-scheme.c (make_struct): Call `SYNC_REGISTER ()' in all cases since the GC is going to run. (struct_ref, struct_set): Call `SYNC_REGISTER ()' on the slow path. (BV_REF_WITH_ENDIANNESS, BV_FIXABLE_INT_REF, BV_INT_REF): Likewise. (BV_FLOAT_REF): Always `SYNC_REGISTER ()'. 2010-03-14 Ludovic Courtès doc: Update "Multi-Threading" node. * doc/ref/libguile-concepts.texi (Multi-Threading): Remove bits about the requirement not to block in guile mode. 2010-03-14 Ludovic Courtès doc: Remove obsolete reference to the lack of Unicode support. * doc/ref/api-data.texi (Bytevectors as Strings): Remove obsolete footnote on the lack of Unicode support. * test-suite/tests/bytevectors.test ("2.9 Operations on Strings")["string->utf8 [latin-1]", "utf8->string [latin-1]"]: Remove use of `with-latin1-locale'. ["string->utf32 [Greek]"]: New tests. 2010-03-14 Andy Wingo small vm.texi updates * doc/ref/vm.texi (A Virtual Machine for Guile): (VM Concepts, Variables and the VM, Branch Instructions): Small updates. add some vm hook docs * doc/ref/api-evaluation.texi (VM Behaviour): Add docs for vm-trace-level and set-vm-trace-level!. 2010-03-14 Andy Wingo (debug) at the repl invokes the vm debugger * module/ice-9/boot-9.scm (top-repl): Map (debug) at the repl to (system vm debug). * module/system/vm/debug.scm (run-debugger, debugger-repl): Don't take the index as an arg, for now anyway. (debug): New wrapper. 2010-03-14 Andy Wingo Update api-debug.texi; there is a ways to go. * doc/ref/api-debug.texi: Update a bit. pmatch license clarification clarifications * module/system/base/pmatch.scm: Clarify the clarifications (somehow didn't make it into my last commit). clarify pmatch licensing * module/system/base/pmatch.scm: Clarify licensing. fix critical bug in history.texi * doc/ref/history.texi (A Timeline of Selected Guile Releases): Ahem :) 2010-03-14 Andy Wingo update "data representation" part of guile internals doc * doc/ref/api-control.texi (Handling Errors): Move the "Signalling Type Errors" section here. * doc/ref/data-rep.texi (Data Representation): Refactor, lopping and cropping and stitching. * doc/ref/libguile-concepts.texi (Dynamic Types): * doc/ref/libguile-smobs.texi (Describing a New Type, Double Smobs): * doc/ref/guile.texi (Guile Implementation, Programming in C): Adapt to refactorings. * doc/ref/history.texi (A Scheme of Many Maintainers): (A Timeline of Selected Guile Releases, Status): Update. 2010-03-13 Andy Wingo narrowing stacks to prompts; backtrace shows frames from start-stack * libguile/stacks.c (scm_sys_stacks): New global variable, moved here from boot-9.scm. (scm_init_stacks): Define scm_sys_stacks to %stacks. (stack_depth): Remove narrowing by frame pointer. (find_prompt): New helper. (narrow_stack): Clean up a bit, and allow narrowing by prompt tag. (scm_make_stack): Update docs, and use scm_stack_id to get the stack id. (scm_stack_id): The current stack id may be fetched as the cdar of %stacks. (stack_id_with_fp): Remove helper. * module/ice-9/boot-9.scm (%start-stack): Fix indentation. (%stacks): Remove definition, it's in stacks.c now. (default-pre-unwind-handler): Narrow by another frame. (save-stack): Remove special handling for certain stack ids, as it is often possible that the function isn't on the stack -- in the interpreter, or after a tail call. Better to narrow by prompt ids. * module/system/vm/debug.scm (print-frames): Change to operate on a vector of frames. (run-debugger): Change to receive a vector of frames. The debugger also has the full stack, so it can re-narrow (or widen) to get the whole stack, if the user wants. (stack->vector): New helper. (debug-pre-unwind-handler): Narrow by more frames, and to the most recent start-stack invocation. Adapt to run-debugger change. 2010-03-12 Andy Wingo remove repl-vm; repl evaluation does not cause recursive vm invocation * module/system/repl/common.scm (): Remove "vm" field and repl-vm accessor. I think the correct model is to just use the-vm. This change was prompted by the need to have the REPL itself not cause a recursive VM invocation, so that captured prompts at the REPL are rewindable. (make-repl): Remove treatment of #:vm. (repl-eval): Load a compiled expression as a simple thunk, avoiding a recursive VM call. * module/system/repl/command.scm (profile, trace): Remove repl-vm treatment. (backtrace, debugger, step): Remove, as they were not implemented. 2010-03-12 Andy Wingo prompt around REPL evaluations, and around `guile' program invocation * module/ice-9/control.scm (%): Add a single-argument case, which instates a default prompt with a default handler. * libguile/script.c (scm_compile_shell_switches): Wrap user programs in a default prompt. * module/system/repl/common.scm (repl-eval): REPL expressions are user programs too; wrap each one in a default prompt. 2010-03-11 Andy Wingo add abort to unknown prompt test * libguile/control.c (scm_c_abort): Change error string if a prompt isn't found. * test-suite/tests/control.test ("abort to unknown prompt"): New test. 2010-03-11 Andy Wingo remove internal treatment of default prompt tag, it seems there was no need * libguile/control.h (scm_sys_default_prompt_tag): * libguile/control.c (scm_init_control): Remove the logic that defined %default-prompt-tag. (scm_c_abort): Remove check for default prompt tag, it wasn't useful. * libguile/throw.c (sym_pre_init_catch_tag): Define as the pre-init prompt tag. (pre_init_catch, pre_init_throw): Use sym_pre_init_catch_tag. * module/ice-9/boot-9.scm (default-prompt-tag): Define as a simple value, not a fluid. Perhaps we can expose it as a fluid later. 2010-03-09 Andy Wingo prompt, abort -> call-with-prompt, abort-to-prompt * module/ice-9/boot-9.scm (default-prompt-tag, make-prompt-tag): New functions. (call-with-prompt, abort-to-prompt): Rename from `prompt' and `abort', respectively. These names are more clear, and allow `prompt' and `abort' to have more convenient, less general bindings. (default-throw-handler, custom-throw-handler, catch, %start-stack): Adapt callers. * module/ice-9/control.scm: Adapt re-export list. (control): Remove binding, until we're sure that it is Sitaram's control. (abort): New binding, aborts to the nearest prompt with the default tag. (%): Use call-with-prompt. * module/language/tree-il/primitives.scm (*primitive-expand-table*): (*interesting-primitive-names*): Adapt for prompt/abort changes. * test-suite/tests/control.test: Take advantage of the defaults for % and abort. 2010-03-09 Andy Wingo %start-stack in Scheme, in terms of prompts * libguile/debug.h: * libguile/debug.c (scm_sys_start_stack): Removed, we implement this in Scheme now. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): Likewise removed. * module/ice-9/boot-9.scm (%start-stack): Implement in terms of prompts. (%stacks): New fluid, for tracking active stacks. (start-stack): Implement using syntax-rules. 2010-03-09 Andy Wingo fix continuation printing bug * libguile/programs.c (scm_i_program_print): Fix bug printing continuations. 2010-03-07 Ludovic Courtès Don't export `write-bytecode' from `(language assembly compile-bytecode)'. * module/language/assembly/compile-bytecode.scm: Don't export `write-bytecode'. * test-suite/tests/asm-to-bytecode.test (write-bytecode): New global variable. 2010-03-07 Ludovic Courtès Add wide-string compilation test. * test-suite/tests/asm-to-bytecode.test ("compiler")[load-wide-string "λ"]: New test. 2010-03-07 Ludovic Courtès Fix miscompilation of non-ASCII Latin-1 strings. The bug was introduced dad6817f ("Use the R6RS I/O API in `write-bytecode'."). * module/language/assembly/compile-bytecode.scm (write-bytecode)[write-string]: Rename to... [write-latin1-string]: ... this. Add the `write-loader-len' call. Write each character individually instead of using `string->utf8'. [write-loader]: Remove. * test-suite/tests/asm-to-bytecode.test ("compiler")[load-string "æ"]: New test. 2010-03-05 Ludovic Courtès Recycle fluid numbers. * libguile/fluids.c: Remove outdated comment on the complexity of fluid GC. (FLUID_GROW): Increase to 128. (allocated_fluids): Change to `void **'. (allocated_fluids_num): Remove. (grow_dynamic_state): Remove race-condition checker. Grow to ALLOCATED_FLUIDS_LEN. (next_fluid_num): Rename to... (new_fluid): ... this. Return a fluid instead of a fluid number. Assume ALLOCATED_FLUIDS is sparse and search for a free number in it. Make ALLOCATED_FLUIDS point to pointerless memory and initialize individual elements with a pointer to the new fluid. Register a disappearing link from there to the fluid. (scm_make_fluid): Use `new_fluid ()'. (scm_fluid_ref, scm_fluid_set_x, scm_i_swap_with_fluids): Remove assertion that wasn't checked in a thread-safe way. Add new fluid tests. * test-suite/tests/fluids.test ("initial fluid values")["initial value is inherited from parent thread"]: New test. ("fluid values are thread-local"): New test. Don't gratuitously over-engineer things... * libguile/eval.c (eval)[SCM_M_CALL]: Always use `alloca' for ARGV. 2010-03-05 Ludovic Courtès Slightly optimize the memoizer, bootstrap evaluator, and `(ice-9 eval)'. * libguile/eval.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR): Use the macro variants, not the functions. (eval)[SCM_M_CALL]: When invoking a VM program, accumulate its arguments on the stack rather than on the heap. * libguile/memoize.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR, CADDR): Use the macro variants, not the functions. (scm_memoized_expression_typecode): Use `SCM_I_MAKINUM' instead of `scm_from_uint16'. 2010-03-05 Ludovic Courtès Remove obsolete compile-time option for freelist debugging. * configure.ac: Remove `--enable-debug-freelist' option and `SCM_I_GSC_GUILE_DEBUG_FREELIST' substitution variable. * libguile/gen-scmconfig.c (main): Remove references to `SCM_I_GSC_GUILE_DEBUG_FREELIST' and `GUILE_DEBUG_FREELIST'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_GUILE_DEBUG_FREELIST): Remove. 2010-03-04 Andy Wingo some with-fluid* -> with-fluids * module/ice-9/boot-9.scm (false-if-exception, load) (try-module-autoload): * module/language/tree-il/compile-glil.scm (compile-glil): Turn some with-fluid* invocations into with-fluids. partial continuations print as # * libguile/control.c (reify_partial_continuation): * libguile/programs.c (scm_i_program_print): * libguile/programs.h (SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION) (SCM_PROGRAM_IS_PARTIAL_CONTINUATION): Distinguish partial continuations from full continuations. tighten up scm_i_dowinds, fixing invalid SCM_CAR (prompt) * libguile/dynwind.c: Update comment regarding what can be on the wind stack. (scm_i_dowinds): Clean up to remove @bind and catch/throw-handler cases, to add a case for prompts, and to be more strict in general regarding the set of things that can be on the wind stack. Fixes a bug whereby prompts were accessed via SCM_CAR; thanks to Ken Raeburn for the report. add printers for prompts and with-fluids objects * libguile/control.c: * libguile/control.h (scm_i_prompt_print): * libguile/fluids.c: * libguile/fluids.h (scm_i_with_fluids_print): * libguile/print.c (iprin1): Add printers for prompts and with-fluids objects. 2010-03-04 Ludovic Courtès Try to avoid `guile-test' failures when it can't display the name of a test. This can happen, e.g., when printing "UNRESOLVED: regexp.test: TEST-NAME", where TEST-NAME contains characters that cannot be converted to the encoding of the current output or error port. * test-suite/guile-test (main): Set the conversion strategy for the output and error ports to `escape'. * test-suite/tests/regexp.test (current-output-port): Likewise. 2010-03-04 Ken Raeburn The load-module routine tries to interpret relative paths relative to the module currently being loaded (i.e., make-texinfo.scm itself), resulting in confusing behavior for offset builds. So, don't use them. * doc/ref/Makefile.am ($(snarf_doc).texi): Use an absolute path for the input file. 2010-03-04 Ludovic Courtès Write the test suite log file in UTF-8. * test-suite/guile-test (main): Set LOG-PORT's encoding to UTF-8. 2010-03-04 Ludovic Courtès Use `with-latin1-locale' in `regexp.test'. As a side effect, it fixes tests on platforms with no 8-bit locale and where executing regexps on characters >= 128 can lead to errors such as `cannot convert to output locale "US-ASCII": ""\x80""'. This commit partially reverts 7583976b ("More setlocale robustness in regexp tests"). * test-suite/tests/regexp.test (mysetlocale, set-latin-1): Remove. ("regexp-quote"): Use `with-latin1-locale' instead of the above procedures. 2010-03-04 Ludovic Courtès Move Latin-1 locale fiddling to `(test-suite lib)'. * test-suite/lib.scm (with-latin1-locale*): New procedure. (with-latin1-locale): New macro. * test-suite/tests/bytevectors.test (with-locale, with-latin1-locale): Remove. Adjust users. 2010-03-03 Ludovic Courtès Fix `with-locale*' in `(test-suite lib)'. * test-suite/lib.scm (with-locale*): Set LOC to the previous locale name, not to the new locale name. Only restore LOC when it's not #f. (with-locale): Use `syntax-rules'. 2010-03-03 Andy Wingo psyntax expander tracks changes to current module in top-level begin * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm (chi-top-sequence): Track changes to the current module. Allows e.g. top-level `define-module' within a begin to work. * test-suite/tests/syncase.test ("changes to expansion environment"): Enable test. 2010-03-03 Andy Wingo use anonymous mv-bind in compile-glil.scm; fix abort compilation bug * module/language/tree-il/compile-glil.scm (flatten): Change to use the anonymous form when truncating to 0 or 1 values. In those cases, remove the statements. As a side effect, fixes compilation of abort in a "values" context. Thanks to Tristan Colgate for the bug report. * test-suite/tests/tree-il.test: Update to expect anonymous mv-bind. 2010-03-03 Andy Wingo can truncate values anonymously * module/language/glil/compile-assembly.scm (glil->assembly): Allow an integer for `vars', which means simply to truncate the values, and not pass binding metadata to the compiler. add more tests to control.test * test-suite/tests/control.test ("restarting partial continuations"): Add more tests, for `abort' in different positions. All succeed in the evaluator but fail with the compiler. 2010-03-03 Ludovic Courtès Fix off-by-one error in the off-by-one fix of `make-srfi-4-vector'. This is a followup to d900a8557db21641413db8995a7cdc1453adbe1f ("Fix off-by-one error when initializing vectors in `make-srfi-4-vector'."). * libguile/srfi-4.c (scm_make_srfi_4_vector): Don't initialize RET when LEN is zero. 2010-03-03 Ludovic Courtès Add test checking whether fluids are GC'd. * test-suite/tests/fluids.test ("fluids are GC'd"): New test. 2010-03-02 Ludovic Courtès Fix "coding:" cookies in the test suite. * test-suite/tests/bytevectors.test, test-suite/tests/keywords.test, test-suite/tests/procprop.test, test-suite/tests/srfi-35.test, test-suite/tests/srfi-88.test: Add "coding:" cookie on the first line. 2010-03-02 Ludovic Courtès Fix off-by-one error when initializing vectors in `make-srfi-4-vector'. * libguile/srfi-4.c (scm_make_srfi_4_vector): When FILL is bound and non-zero, initialize the last element. * test-suite/tests/srfi-4.test ("TAG vectors")["make-TAGvector"]: New tests. 2010-03-02 Ken Raeburn Use libguile/control.x explicitly. 2010-03-02 Julian Graham Change failing syncase test case to UNRESOLVED. * test-suite/tests/syncase.test: ("expander detects changes to current-module"): Throw 'unresolved instead of returning #f. 2010-02-27 Julian Graham add (currently failing) test case for changing the current module inside `begin' form * test-suite/tests/syncase.scm: ("expander detects changes to current-module"): New test case. 2010-02-26 Andy Wingo rewinding prompts works * libguile/control.h (SCM_PROMPT_HANDLER): Remove, it was unused. (SCM_PROMPT_DYNWINDS): Rename from SCM_PROMPT_DYNENV. * libguile/control.c: (scm_c_make_prompt): Take another arg, the winds that are to be in place for the prompt. Fix allocation to be 4 words instead of 5 (the handler was never used). * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Adapt to scm_c_make_prompt change. * libguile/vm-i-system.c (partial-cont-call): Grovel the new elements of the wind list in order to call setjmp() on the new prompts. Pass cookie to vm_reinstate_partial_continuation. (prompt): Adapt to scm_c_make_prompt change. * libguile/vm.c (vm_reinstate_partial_continuation): Take a cookie arg, used when winding captured prompts onto the stack. Winding a prompt implies making a new prompt, actually -- with new registers, a new jump buffer, new winds, etc. * test-suite/tests/control.test ("rewinding prompts"): Add a test for rewinding prompts. 2010-02-26 Andy Wingo catch, throw, with-throw-handler implemented in Scheme * libguile/throw.c (tc16_jmpbuffer, tc16_pre_unwind_data): Remove these smob types, and associated constructors and accessors (all internal). (scm_catch, scm_catch_with_pre_unwind_handler): (scm_with_throw_handler, scm_throw): Simply dispatch to scheme. Lovely. (tc16_catch_closure): Introduce a new applicable smob type, for use by the C catch interface. All constructors and accessors are internal. (scm_c_catch, scm_internal_catch, scm_c_with_throw_handler): Build applicable smobs out of the C procedure arguments, so we can then dispatch through scm_catch et al. (scm_ithrow): Dispatch to scm_throw. (pre_init_catch, pre_init_throw): Restricted catch/throw implementation for use before boot-9 runs. (scm_init_throw): Bind the pre-init catch and throw definitions. * module/ice-9/boot-9.scm (prompt, abort): Move these definitions up in the file. (catch, throw, with-throw-handler): Implement in Scheme. Whee! 2010-02-26 Andy Wingo deprecate lazy-catch * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_lazy_catch, scm_lazy_catch): Deprecate, and print out a nasty warning that people should change to with-throw-handler. * libguile/throw.h: * libguile/throw.c (scm_c_with_throw_handler): Deprecate the use of the lazy_catch_p argument, printing out a nasty warning if someone actually passes 1 as that argument. The combination of the pre-unwind and post-unwind handlers should be sufficient. * test-suite/tests/exceptions.test: Remove lazy-catch tests, as they are deprecated. Two of them fail: * throw/catch: effect of lazy-catch unwinding on throw to another key * throw/catch: repeat of previous test but with lazy-catch Hopefully people are not depending on this behavior, and the warning is sufficiently nasty for people to switch. We will see. * test-suite/tests/eval.test ("promises"): Use with-throw-handler instead of lazy-catch. * doc/ref/api-debug.texi: * doc/ref/api-control.texi: Update to remove references to lazy-catch, folding in the useful bits to with-throw-handler. 2010-02-26 Andy Wingo fix a prompt bug * libguile/control.h: * libguile/control.c (scm_c_make_prompt): Instead of taking a VM arg, take the registers directly. (scm_c_abort): Declare as returning void. In fact it will never return. * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Adapt to prompt API change. * libguile/vm-i-system.c (prompt): Pass the abort ip as the ip to scm_c_make_prompt. This fixes a bug in which we used the "offset" local var, but it wasn't guaranteed to be around after a longjmp. 2010-02-25 Andy Wingo simplify handling of nonlocal prompt returns from c * libguile/control.h: * libguile/control.c (scm_i_prompt_pop_abort_args_x): New helper. * libguile/eval.c (eval): Use the new helper. 2010-02-25 Andy Wingo more substance to control.test * test-suite/tests/control.test ("suspend/resume with fluids"): ("restarting partial continuations"): ("reified continuations", "escape-only continuations"): More tests. eval.scm's handling of with-fluids doesn't leave the VM * module/ice-9/eval.scm (primitive-eval): Implement with-fluids in terms of with-fluids, to avoid recursively calling the VM via with-fluids*. 2010-02-25 Andy Wingo eval.scm's handling of with-fluids doesn't leave the VM * module/ice-9/eval.scm (primitive-eval): Implement with-fluids in terms of with-fluids, to avoid recursively calling the VM via with-fluids*. error if given an unrewindable partial continuation * libguile/vm-engine.c (vm_error_continuation_not_rewindable): * libguile/vm-i-system.c (partial-cont-call): * libguile/vm.h (SCM_VM_CONT_PARTIAL_P): (SCM_VM_CONT_REWINDABLE_P): Fix a bug in which we weren't checking if a partial continuation was actually rewindable. fix embarrassing bug * libguile/vm.c: Fix embarrassing error regarding the symbolitude of vm-error and friends. 2010-02-24 Andy Wingo start of tests for (ice-9 control) * test-suite/Makefile.am: * test-suite/tests/control.test: Add the beginnings of a delimited continuations test suite. fix symbol initialization in vm.c * libguile/vm.c (scm_bootstrap_vm): Fix case in which some symbols wouldn't be initialized by the time they were needed. (ice-9 control) fixes * module/ice-9/control.scm (%): Fix to allow tagged and default-tagged prompts. (abort): Re-export. fix escape-only prompts * libguile/control.c (scm_c_make_prompt): Whoops, set the escape-only flag properly here. add %default-prompt-tag, and error (not abort()) on an abort to bad tag * libguile/init.c (scm_i_init_guile): Call scm_init_control after initing fluids. * libguile/control.h (scm_sys_default_prompt_tag): New internal var. * libguile/control.c (scm_c_abort): If abort is called for an unknown tag, raise an exception, except if the tag was the default prompt tag, in which case really abort -- to prevent recursion when some other patches land. (scm_init_control): Define %default-prompt-tag in the default environment. turn abort() calls in vm.c into exceptions * libguile/vm.c (vm_return_to_continuation, vm_abort): (vm_reinstate_partial_continuation, really_make_boot_program): Turn some abort()s into scm_misc_errors. rewind the dynamic state when entering a partial continuation * libguile/control.c (cont_objcode): * libguile/vm-i-system.c (partial-cont-call): * libguile/vm.c (vm_reinstate_partial_continuation): Don't keep the "external winds" in a partial continuation, as they aren't logically part of the continuation. Reinstate the "internal winds" when entering a partial continuation. Things seem to work! 2010-02-24 Andy Wingo partial-cont-call works * libguile/vm-i-system.c (partial-cont-call): Sync registers before splatting a partial continuation, and cache them back afterwards. * libguile/vm.c (vm_reinstate_partial_continuation): Actually implement, except dynamic-wind. 2010-02-24 Andy Wingo record IP in partial continuations * libguile/control.c (reify_partial_continuation): Assert some invariants, and record the IP as the MVRA of the continuation. ensure non-escape-only prompts have a thunk application as their body * module/language/tree-il/inline.scm (inline!): Fix indenting for lambda-case. In an amusing turn of events, use the inliner to de-inline prompt bodies, if the prompt is not escape-only. 2010-02-22 Andy Wingo actually capture partial continuations * libguile/control.c (cont_objcode): Along with a bunch of boilerplate that certainly needs to go in some central place, define this continuation-calling trampoline. (reify_partial_continuation): New function, returns a procedure that when called will reinstate a partial continuation. (scm_c_abort): Take an extra arg, the cookie. Actually reify a continuation. (scm_at_abort): Adapt to scm_c_abort change. * libguile/control.h: Declare scm_c_abort change. * libguile/vm-i-system.c (partial_cont_call): New instruction. (call/cc, tail-call/cc): Adapt to scm_i_vm_capture_stack change. (abort): Pass vm_cookie to abort. * libguile/vm.h (SCM_F_VM_CONT_PARTIAL, SCM_F_VM_CONT_REWINDABLE): New flags. (struct scm_vm_cont): Add flags field. (SCM_VM_CONT_PARTIAL_P, SCM_VM_CONT_REWINDABLE_P): New predicates. * libguile/vm.c (scm_i_vm_capture_stack): Rename from vm_capture_continuation, and make internal instead of static. Take a flags argument. (scm_i_vm_capture_continuation): Adapt to scm_i_vm_capture_stack change. (vm_abort): Plumb cookie to scm_c_abort. (vm_reinstate_partial_continuation): New stub. 2010-02-22 Andy Wingo tweaks to default program printer * libguile/programs.c (scm_i_program_print): Instead of printing the address of the objcode, print the address of the program itself. Also for continuations. 2010-02-22 Andy Wingo abort always dispatches to VM bytecode, to detect same-invocation aborts * libguile/control.h: * libguile/control.c (scm_c_make_prompt): Take an extra arg, a cookie. Continuations will be rewindable only if the abort has the same cookie as the prompt. (scm_at_abort): Redefine from scm_abort, and instead of taking rest args, take the abort values as a list directly. Also, don't allow rewinding, because we won't support rewinding the C stack with delimited continuations. * libguile/eval.c (eval): Adapt to scm_c_make_prompt change. * libguile/vm-engine.c (vm_engine): Use vp->cookie to get a unique value corresponding to this VM invocation. * libguile/vm-i-system.c (prompt): Pass the cookie to scm_c_make_prompt. (abort): Take an additional tail arg. * libguile/vm.c (vm_abort): Parse out the abort tail arg. This is for the @abort case, or the (apply abort ...) case. (make_vm): Initialize the cookie to 0. * libguile/vm.h (struct scm_vm): Add cookie. * module/ice-9/boot-9.scm (abort): Define here as a trampoline to @abort. Needed to make sure that a call to abort dispatches to a VM opcode, so the cookie will be the same. * module/language/tree-il.scm (): Add a "tail" field to , for the (apply abort ...) case, or (@abort tag args). Should be # in the normal case. Add support throughout. * module/language/tree-il/analyze.scm (analyze-lexicals): Add abort-tail support here too. * module/language/tree-il/compile-glil.scm (flatten): Compile the tail argument appropriately. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Fix @abort and abort cases to pass the tail arg to make-abort. 2010-02-22 Andy Wingo prompt and abort inlining * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add abort. (*primitive-expand-table*): Fix so that we inline `prompt' and `abort', and remove obsolete code dealing in `control'. fix compilation bug * module/language/tree-il/analyze.scm (analyze-lexicals): Fix bug analysing expressions. 2010-02-19 Andy Wingo prompt as part of guile's primitive language * libguile/control.h: * libguile/control.c: Remove scm_atcontrol and scm_atprompt. (scm_c_make_prompt): Remove handler arg, as the handler is inline. (scm_abort): New primitive, exported to Scheme as `abort'. The compiler will also recognize calls to `abort', but this is the base case. (scm_init_control): Remove scm_register_control, just have this function, which adds `abort' to the `(guile)' module. * libguile/eval.c (eval): Add SCM_M_PROMPT case. * libguile/init.c (scm_i_init_guile): Change scm_register_control call into a nice orderly scm_init_control call. * libguile/memoize.h: (scm_sym_at_prompt, SCM_M_PROMPT): * libguile/memoize.c (MAKMEMO_PROMPT, scm_m_at_prompt, unmemoize): Add prompt support to the memoizer. * libguile/vm-i-system.c (prompt): Fix to not expect a handler on the stack. * module/ice-9/boot-9.scm (prompt): Add definition in terms of @prompt. * module/ice-9/control.scm: Simplify, and don't play with the compiler here, now that prompt and abort are primitive. * module/ice-9/eval.scm (primitive-eval): Add a prompt case. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add @prompt and prompt. 2010-02-19 Andy Wingo fix prompt disassembly bug * module/language/assembly/disassemble.scm (code-annotation): Fix a bug disassembling `prompt'. 2010-02-19 Andy Wingo add scm_c_abort, wire it up to the abort opcode * libguile/control.h: * libguile/control.c (scm_c_abort): Add an implementation of `abort', but it doesn't reify the continuation yet. * libguile/vm-i-system.c (abort): * libguile/vm.c (vm_abort): Wire up the call to `abort', avoiding consing the args into a list. * module/language/tree-il/compile-glil.scm (flatten): Add some compily bits that can allow the abort to be resumed. 2010-02-19 Andy Wingo prompt handlers are always inline * libguile/control.h (SCM_F_PROMPT_INLINE, SCM_PROMPT_INLINE_P): Remove; prompts always have "inline" handlers now. * libguile/control.c (scm_c_make_prompt): Remove inline_handler_p arg. * libguile/vm-i-system.c (prompt): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt to prompt changes. * module/language/glil.scm (make-glil-prompt, glil-prompt-inline?): Remove inline? flag. (parse-glil, unparse-glil): * module/language/glil/compile-assembly.scm (glil->assembly): Adapt to change. * module/language/tree-il/compile-glil.scm (flatten): Require the handler of a to be a lambda-case. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Ensure that the handler of a is a lambda-case. * module/language/tree-il/inline.scm (inline!): Simplify a degenerate case: (lambda args (apply (lambda ...) args)) => (lambda ...). 2010-02-19 Andy Wingo fluid-ref / fluid-set! compile to dynref/dynset * module/language/tree-il/primitives.scm: Resolve fluid-ref and fluid-set! as primitives, and thence to dynref/dynset. add and to tree-il * module/language/tree-il.scm (, ): New tree-il language elements, corresponding to fluid-ref and fluid-set. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: Wire them up in the usual manner. new VM operations: fluid-ref, fluid-set * libguile/vm-i-system.c (fluid-ref, fluid-set): New VM ops. fluids.h exposes more of its interface, internally at least * libguile/fluids.h (SCM_I_FLUID_P, SCM_I_FLUID_NUM) (SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Expose these predicates and accessors, internally at least. * libguile/fluids.c (IS_FLUID, FLUID_NUM, IS_DYNAMIC_STATE) (DYNAMIC_STATE_FLUIDS): Implement in terms of the exposed macros. vm caches the dynamic state in a local var * libguile/vm-engine.c (vm_engine): Cache the dynamic state in a local var when we enter the VM. * libguile/vm-i-system.c (wind-fluids, unwind-fluids): Use the cached dynamic state instead of going through SCM_I_CURRENT_THREAD. 2010-02-19 Andy Wingo rename to * libguile/vm-i-system.c (abort): Rename instruction from `throw'. * libguile/vm.c (vm_abort): Rename from vm_throw. * module/language/tree-il.scm (, make-abort, abort-src, abort-tag, abort-args: Rename from & company. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/primitives.scm: Fix all callers. 2010-02-19 Andy Wingo has no pre-unwind-handler, it's unnecessary * libguile/control.h: * libguile/control.c (scm_c_make_prompt, SCM_PROMPT_PRE_UNWIND_HANDLER): * libguile/vm-i-system.c (prompt) * module/language/tree-il.scm ( prompt-pre-unwind-handler): * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: Remove the "pre-unwind" handler from prompt; it turns out not to be necessary. Adapt all references. re-expand psyntax-pp * module/ice-9/psyntax-pp.scm: Expand again so we actually use with-fluids. fix tree-il->scheme bug for * module/language/tree-il.scm (tree-il->scheme): Bugfix for dynlet. 2010-02-18 Andy Wingo psyntax support for with-fluids * module/ice-9/psyntax.scm (build-dynlet, with-fluids): Use psyntax to recognize `with-fluids' as a core form, producing if we are compiling. (sc-expand): To spice up the mix, use with-fluids here in the implementation. * module/ice-9/psyntax-pp.scm: Bootstrapped twice (!). * module/ice-9/boot-9.scm: Remove with-fluids definition, it's in the core now. 2010-02-18 Andy Wingo add tree-il->glil compilation for dynlet * module/language/tree-il/compile-glil.scm (flatten): Compile . add wind-fluids, unwind-fluids VM ops * libguile/vm-i-system.c (wind-fluids, unwind-fluids): New instructions, for dynamic binding. add dynlet to tree-il * module/language/tree-il.scm (, dynlet?, make-dynlet) (dynlet-src, dynlet-fluids, dynlet-vals, dynlet-body): New tree-il construct, mapping to `with-fluids'. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold): (make-tree-il-folder, post-order!, pre-order!): Wire it up. * module/language/tree-il/analyze.scm (analyze-lexicals): Add dynlet support. 2010-02-18 Andy Wingo add with-fluids objects and primitive syntax * libguile/tags.h (scm_tc7_with_fluids): Allocate a tc7 for "with-fluids" objects, which will only live on the dynamic stack (wind list), not in normal scheme-land. * libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_WITH_FLUIDS_LEN) (SCM_WITH_FLUIDS_NTH_FLUID, SCM_WITH_FLUIDS_NTH_VAL) (SCM_WITH_FLUIDS_SET_NTH_VAL): Add some accessors. * libguile/fluids.c (scm_i_make_with_fluids, scm_i_swap_with_fluids): New internal functions. (scm_c_with_fluids, scm_c_with_fluid): Push with-fluids objects on the dynwind list, not winders. * libguile/dynwind.c (scm_i_dowinds): Add cases for winding and unwinding with-fluids objects. * libguile/memoize.h (scm_sym_with_fluids, SCM_M_BEGIN): New public data. * libguile/memoize.c (scm_m_with_fluids): Define with-fluids as a primitive syntax. (unmemoize): Add with-fluids case. * libguile/eval.c (eval): * module/ice-9/eval.scm (primitive-eval): Add with-fluids cases. * test-suite/tests/fluids.test ("fluids not modified if nonfluid passed to with-fluids"): Enable a now-passing test. 2010-02-18 Andy Wingo add fluid tests * test-suite/Makefile.am: * test-suite/tests/fluids.test: Add some fluid tests. One is an XFAIL right now. rename to * module/language/tree-il.scm (): Rename from . * module/language/tree-il/analyze.scm: * module/language/tree-il/primitives.scm: * module/language/tree-il/compile-glil.scm: All accessors and callers changed. fix unmemoization bug * libguile/memoize.c (unmemoize): Fix unmemoization of memoized toplevel-ref and module-ref forms. eval.c tweaks * libguile/eval.c (eval): Fix a couple of uses of scm_cdr that should use CDR. fix comment in continuations.c * libguile/continuations.c: Fix a comment. memoize (begin foo) to foo * libguile/memoize.c (memoize_sequence): Don't make a `begin' if there's only one form. reorder eval clauses * module/ice-9/eval.scm: Add a comment explaining the frequencies of the various memoized expression types. (eval): Reorder the cases based the profile. 2010-02-18 Andy Wingo dynwind is now a part of guile's primitive language * libguile/memoize.h (scm_sym_at_dynamic_wind, SCM_M_DYNWIND) * libguile/memoize.c (memoized_tags, MAKMEMO_DYNWIND) (scm_m_at_dynamic_wind, unmemoize): Add dynwind as a primitive expression type. * libguile/dynwind.c (scm_dynamic_wind): Downgrade to a normal C function. * libguile/eval.c (eval): * module/ice-9/eval.scm (primitive-eval): Add dynwind support. * module/ice-9/r4rs.scm: More relevant docs. (apply): Define in a more regular way. (dynamic-wind): Add to this file, with docs, dispatching to @dynamic-wind. * module/language/tree-il/primitives.scm: Parse @dynamic-wind into a tree-il dynamic-wind. 2010-02-17 Ludovic Courtès Bump version number for 1.9.8. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2010-02-17 Ludovic Courtès Update to Gnulib v0.0-3448-g6078aa4 for its fix. Reverts commit 691b9ec196203fa5d6da3530d5355b2f73e707d1 ("getaddrinfo: Define macros lacking in NetBSD 5.0."). * libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): Remove placeholder definitions, how provided by Gnulib's . 2010-02-17 Andy Wingo slight NEWS tweaks * NEWS: Slight tweaks. 2010-02-17 Ludovic Courtès getaddrinfo: Define macros lacking in NetBSD 5.0. * libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): New macros, when not already defined. Update `NEWS'. Mention libffi dependency in `README'. Include in "foreign.h". * libguile/foreign.h: Include . 2010-02-17 Ludovic Courtès Remove misplaced tabs from the manual. * doc/ref/posix.texi (Network Databases): Remove tabs from `getaddrinfo' example. * .dir-locals.el: Set `indent-tabs-mode' to `t' for `texinfo-mode'. 2010-02-16 Andy Wingo a start at NEWS * NEWS: A start at NEWS; now to sleep. delete the tutorial * configure.ac: * doc/Makefile.am: * doc/tutorial/ChangeLog-2008: * doc/tutorial/ChangeLog-guile-doc-tutorial: * doc/tutorial/Makefile.am: * doc/tutorial/guile-tut.texi: Remove the tutorial. The history was out of date (whereas the manual is current), the C examples are no longer valid (and the manual does provide C examples), it was incomplete, and its first person no longer hacks on Guile. So tutorial, you had a good run, but the manual does your job now! fix a bug in the tutorial * doc/tutorial/guile-tut.texi (c_builtins.c): Fix a typo with an undeclared variable. Thanks to Raimon Grau for the pointer. This tutorial is quite out of date, though... 2010-02-16 Andy Wingo `load' doesn't cause the compiler to be loaded in some cases * module/system/base/compile.scm (compiled-file-name): Add a comment. * module/ice-9/boot-9.scm (load): Avoid loading up (system base compile) just to compute an autocompiled file name. Fixes the issue whereby guile-tools snarf-check-and-output-texi was inadvertantly loading up srfi-1, and thereby a stale library, just to see if guile-tools itself had a compiled version. Not sure what the right unit test is here, other than vigilance. 2010-02-16 Ludovic Courtès Add missing $(LTLIBINTL), suggested by Gnulib. * libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBINTL). 2010-02-16 Ludovic Courtès i18n: Define `nl_item' when it's not available (needed for Cygwin). * configure.ac: Add check for `nl_item'. * libguile/i18n.c: Separate check for `HAVE_LANGINFO_H' and `HAVE_NL_TYPES_H'. [!HAVE_NL_ITEM]: Define `nl_item'. 2010-02-16 Ludovic Courtès Skip "wrong service name" `getaddrinfo' test on Darwin 9.2. * test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]: Skip test on Darwin 9.2. 2010-02-16 Michael Gran Faster read of semicolon comments There is no need to do character encoding processing within semicolon comments. * libguile/read.c (scm_read_semicolon_comment): changed 2010-02-15 Ludovic Courtès Fix builds of `i18n.c' on non-GNU systems. * libguile/i18n.c (chr_to_case, str_to_case): Add `func_name' argument and `FUNC_NAME' macro. Update callers. Add `getaddrinfo' test. * test-suite/tests/net-db.test ("getaddrinfo")["port 80 with family and socket type"]: New test. Use `#f' for `addrinfo:canonname' when it wasn't supplied by getaddrinfo(3). * libguile/net_db.c (scm_from_addrinfo): Use `#f' when `ai_canonname' isn't set. 2010-02-15 Ludovic Courtès Fix `getaddrinfo' tests. Thanks to Ken Raeburn. * test-suite/tests/net-db.test ("getaddrinfo")["port 80"]: Fix bogus check of `addrinfo:flags' (POSIX says that the "contents of the ai_flags field of the returned structures are undefined."). ("wrong service name"): Accept `EAI_NONAME' as a valid error code. 2010-02-15 Ludovic Courtès Make the `getaddrinfo' "no name" test more robust. * test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Check for `EAI_EAGAIN' too. 2010-02-14 Ludovic Courtès Add missing Gnulib files; update `.gitignore'. This files were missing from commit 61cd9dc907b8a09990b14e9aeac7e20fe77cecc6 ("Use Gnulib's `getaddrinfo' module."). 2010-02-14 Ludovic Courtès Add `getaddrinfo' and related procedures. * libguile/net_db.c (sym_getaddrinfo_error, sym_ai_passive, sym_ai_canonname, sym_ai_numerichost, sym_ai_numericserv, sym_ai_v4mapped, sym_ai_all, sym_ai_addrconfig, sym_eai_badflags, sym_eai_noname, sym_eai_again, sym_eai_fail, sym_eai_family, sym_eai_socktype, sym_eai_service, sym_eai_memory, sym_eai_system, sym_eai_overflow, sym_eai_nodata, sym_eai_addrfamily, sym_eai_inprogress, sym_eai_canceled, sym_eai_notcanceled, sym_eai_alldone, sym_eai_intr, sym_eai_idn_encode): New variables. (scm_from_addrinfo, scm_getaddrinfo, scm_gai_strerror): New functions. * libguile/net_db.h (scm_getaddrinfo, scm_gai_strerror): New functions. * module/ice-9/networking.scm (addrinfo:flags, addrinfo:fam, addrinfo:socktype, addrinfo:protocol, addrinfo:addr, addrinfo:canonname): New procedures. * test-suite/tests/net-db.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/net-db.test'. * doc/ref/posix.texi (Network Databases)[getaddrinfo]: New subsection. [The Host Database]: Suggest using `getaddrinfo'. 2010-02-14 Ludovic Courtès Use Gnulib's `getaddrinfo' module. * m4/gnulib-cache.m4: Add `getaddrinfo'. * libguile/Makefile.am (libguile_la_LDFLAGS): Add `$(GETADDRINFO_LIB) $(HOSTENT_LIB) $(SERVENT_LIB)'. 2010-02-13 Thien-Thi Nguyen Document trailing whitespace policy. * HACKING (Coding standards): Delete trailing whitespace. Add blurb documenting trailing whitespace policy. 2010-02-13 Ludovic Courtès Document the maximum number of arguments for a subr. * doc/ref/api-procedures.texi (Primitive Procedures): Specify the maximum number of arguments. Patch by guign@mails.selgrad.org. 2010-02-13 Ludovic Courtès Reinstate `scm_protects', for backward compatibility. Partly reverts e7efe8e793fa51ea898aea4477939c598b3e9fac ("decruftify scm_sys_protects"). * libguile/gc.c (protects): Rename to... (scm_protects): ... this. * libguile/gc.h (scm_protects): Add declaration. 2010-02-10 Ludovic Courtès Fix documentation of the `string->utf' and `utf->string' functions. * doc/ref/api-data.texi (Bytevectors as Strings): Describe optional parameter of `string->utf{16,32}' and `utf{16,32}->string'. Use the R6RS I/O API in `write-bytecode'. * module/language/assembly/compile-bytecode.scm (write-bytecode)[u32-bv]: New variable. [write-char, write-uint16-be, write-uint16-le, write-uint32-le]: Remove. [write-string, write-uint32-be, write-uint32, write-wide-string, write-bytevector]: Rewrite using the `(rnrs io ports)' API. [write-uint24-be]: Rename to... [write-int24-be]: ... this. Use `(rnrs io ports)' API. Callers updated. [write-uint16]: Remove. 2010-02-10 Ludovic Courtès Change `write-bytecode' to accept a bytevector. * module/language/assembly/compile-bytecode.scm (write-bytecode): Replace the WRITE-BYTE and GET-ADDR parameters with PORT. New ADDRESS and EMIT-OPCODE? parameters. Callers updated. [write-byte, get-addr]: New procedures. Adjust to write to PORT. (compile-bytecode): Update accordingly. * test-suite/tests/asm-to-bytecode.test (munge-bytecode): Return a bytevector instead of a u8vector. (comp-test): Deal with bytevectors. 2010-02-10 Ludovic Courtès vlist: Slightly improve readability and consistency. * module/ice-9/vlist.scm (define-inline): Fix case with non-singleton body. (make-vhash-assoc): Remove. Change to... (%vhash-assoc): ... this, using `define-inline'. 2010-02-08 Andy Wingo continuations return multiple values on the stack * libguile/vm.h (struct scm_vm_cont): Instead of saving the "IP", save "RA" and "MVRA". That is, save singly-valued and multiply-valued return addresses, so that we can return multiple values on the stack. (scm_i_vm_reinstate_continuation): Remove. * libguile/vm.c (vm_capture_continuation): Rename from capture_vm_cont, and change the prototype so we can capture the RA and MVRA, and so that tail calls to call/cc can capture a continuation without the call/cc application frame. (vm_return_to_continuation): Rename from reinstate_vm_cont, and take arguments to return to the continuation. Handles returning to single or multiple-value RA. (scm_i_vm_capture_continuation): Change to invoke vm_capture_continuation. Kept around for the benefit of make-stack. * libguile/vm-i-system.c (continuation-call): Handle reinstatement of the VM stack, with arguments. (call/cc, tail-call/cc): Adapt to new vm_capture_continuation prototype. tail-call/cc captures tail continuations. * libguile/stacks.c (scm_make_stack): Update for scm_vm_cont structure change. * libguile/continuations.h (struct scm_contregs): Remove throw_value member, which was used to return a value to a continuation. (scm_i_check_continuation): New internal function, checks that a continuation may be reinstated. (scm_i_reinstate_continuation): Replaces scm_i_continuation_call; just reinstates the C stack. (scm_i_contregs_vm, scm_i_contregs_vm_cont): New internal accessors. * libguile/continuations.c (scm_i_make_continuation): Return SCM_UNDEFINED if we are returning again. (grow_stack, copy_stack_and_call, scm_dynthrow): Remove extra arg, as vm opcodes handle value returns. (copy_stack): No need to instate VM continuation. (scm_i_reinstate_continuation): Adapt. 2010-02-08 Andy Wingo scm_i_make_continuation takes vm and vm_cont args explicitly * libguile/continuations.h: * libguile/continuations.c (scm_i_make_continuation): Take VM and VM continuation arguments as well; I'm not convinced that saving all VM continuations was the right thing, and in any case we only ever saved the latest. Running a new VM should create a continuation barrier. * libguile/stacks.c (scm_make_stack): * libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers. * libguile/vm.h (scm_i_vm_capture_continuation) (scm_i_vm_reinstate_continuation): Change to be internal, and to only capture and reinstate continuations for a particular VM. 2010-02-08 Andy Wingo make scm_make_continuation internal * libguile/continuations.h: * libguile/continuations.c (scm_i_make_continuation): Change from scm_make_continuation, and make internal. * libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers. * test-suite/standalone/test-unwind.c (check_cont_body): Adapt a test. * doc/ref/api-control.texi (Continuations): Update docs. 2010-02-08 Andy Wingo eval.c uses scm_i_call_with_current_continuation * libguile/continuations.h * libguile/continuations.c (scm_i_call_with_current_continuation): New internal function. Not exported because I'm not sure whether or not this should have a continuation barrier in the future. Uses a hand-coded VM procedure. * libguile/eval.c (eval): Use scm_i_call_with_current_continuation. 2010-02-08 Andy Wingo continuations are vm procedures * libguile/vm-i-system.c (continuation-call): New op, like subr-call or foreign-call, but for continuations. * libguile/continuations.h: Add scm_i_continuation_call internal declaration. (SCM_CONTINUATIONP): Reimplement in terms of SCM_PROGRAM_IS_CONTINUATION. (scm_tc16_continuation, SCM_CONTREGS, SCM_CONTINUATION_LENGTH) (SCM_SET_CONTINUATION_LENGTH, SCM_JMPBUF, SCM_DYNENV, SCM_THROW_VALUE) (SCM_CONTINUATION_ROOT, SCM_DFRAME): Remove these from the exposed API. (scm_i_continuation_to_frame): New internal declaration. * libguile/continuations.c * libguile/continuations.c: Add trickery like in foreign.c, smob.c, and gsubr.c, so that we can make procedural trampolines for continuations. (scm_i_continuation_to_frame): New internal function, from stacks.c. * libguile/programs.h (SCM_F_PROGRAM_IS_CONTINUATION) (SCM_PROGRAM_IS_CONTINUATION): Add a flag for programs that are continuations. Probably should add flags for the other trampoline types too. * libguile/programs.c (scm_i_program_print): Print continuations as before. * libguile/stacks.c (scm_stack_id, scm_make_stack): Use scm_i_continuation_to_frame in the continuation case. 2010-02-08 Andy Wingo push a prompt handler value even in the inline-handler case * module/language/tree-il/compile-glil.scm (flatten): Push a handler value even in the inline-handler case, to make prompt's interface more uniform, and also to correspond to the existing VM implementation. 2010-02-08 Andy Wingo connect a few more wires to promptenstein * libguile/tags.h (scm_tc7_prompt): Allocate a tc7 for prompt objects. * libguile/control.h (SCM_F_PROMPT_INLINE, SCM_F_PROMPT_ESCAPE) (SCM_PROMPT_P, SCM_PROMPT_FLAGS, SCM_PROMPT_INLINE_P) (SCM_PROMPT_ESCAPE_P, SCM_PROMPT_TAG, SCM_PROMPT_REGISTERS) (SCM_PROMPT_DYNENV, SCM_PROMPT_HANDLER) (SCM_PROMPT_PRE_UNWIND_HANDLER, SCM_PROMPT_SETJMP) (struct scm_prompt_registers): * libguile/control.c (scm_c_make_prompt): Flesh out a simple prompts implementation. * libguile/vm-i-system.c (prompt): Wire up the implementation. * libguile/vm.c: Add a needed #include. 2010-02-03 Michael Gran Optimize reader by preferring stack-allocated buffers * libguile/read.c (read_token): now takes a C buffer instead of a SCM. string. All callers changed. (read_complete_token): now takes C buffers, not SCM strings. No longer does port position updates or encoding processing. All callers changed. (scm_read_number, scm_read_mixed_case_symbol, scm_read_number_and_radix) (scm_read_character): Do port updates and string processing no longer done by read_complete_token. Some reordering for optimization. 2010-02-03 Ludovic Courtès Use vhashes in `unused-variable-analysis'. * module/language/tree-il/analyze.scm (unused-variable-analysis): Use vhashes instead of alists/lists. Use vhashes in `arity-analysis'. * module/language/tree-il/analyze.scm (arity-analysis): Use vhashes instead of alists. Use vhashes in `unbound-variable-analysis'. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use vhashes instead of alists/lists. Use vhashes in `unused-toplevel-analysis'. * module/language/tree-il/analyze.scm (graph-reachable-nodes): Add REACHABLE argument. Update to use vhash instead of alists or lists. (graph-reachable-nodes*): Adjust accordingly. (partition*): New function. (unused-toplevel-analysis): Adjust to use vhash instead of alists or lists. 2010-02-03 Ludovic Courtès Add `(ice-9 vlist)'. * module/ice-9/vlist.scm, test-suite/tests/vlist.test, benchmark-suite/benchmarks/vlists.bm: New files. * module/Makefile.am (ICE_9_SOURCES): Add `vlist.scm'. * test-suite/Makefile.am (SCM_TESTS): Add `tests/vlist.test'. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/vlists.bm'. * doc/ref/api-compound.texi (VLists, VHashes): New nodes. 2010-02-01 Ludovic Courtès Inline SRFI-9 constructors too. * module/srfi/srfi-9.scm (define-record-type)[constructor]: Use `define-inlinable' instead of `define'. * test-suite/lib.scm (exception:syntax-pattern-unmatched): New variable. * test-suite/tests/srfi-9.test ("constructor")["foo 0 args (inline)", "foo 2 args (inline)"]: New tests. ["foo 0 args", "foo 2 args"]: Adjust to constructor inlining. * testsuite/t-records.scm: Remove wrong-arg-count case. 2010-02-01 Ludovic Courtès SRFI-9: Fix `define-inlinable'. * module/srfi/srfi-9.scm (define-inlinable): Fix the catch-all case of the generated macro. 2010-01-31 Andy Wingo add (ice-9 control) * module/language/tree-il/primitives.scm (define-primitive-expander): Allow quoted datums. Allow all self-evaluating expressions to be constants. (prompt, control): Add primitive expanders to turn these into @prompt and @control. * module/ice-9/control.scm: New module, for delimited continuation operators. * module/Makefile.am: Add. 2010-01-31 Andy Wingo add @control and @prompt stub primitives * libguile/Makefile.am: * libguile/control.c: * libguile/control.h: * libguile/init.c: Add stub @control and @prompt primitives, for use when bootstrapping (ice-9 control). 2010-01-31 Andy Wingo GLIL and assembly support for prompt compilation * module/language/glil/compile-assembly.scm (glil->assembly): Compile appropriately. * module/language/assembly/disassemble.scm (code-annotation): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/compile-bytecode.scm (write-bytecode): Assemble and disassemble `prompt' appropriately. 2010-01-31 Andy Wingo tree-il -> glil compilation of prompt, dynamic-wind, control * module/language/tree-il/compile-glil.scm (flatten): Compile , , and . add return/nvalues * libguile/vm-i-system.c (return/nvalues): New instruction, like call/nargs. GLIL support for * module/language/glil.scm (): Add , with handler-label and escape-only? fields. tree-il analyzer and inliner handle * module/language/tree-il/analyze.scm (analyze-lexicals): Add cases for , , and . If a continuation is not referenced in the body of a prompt handler, mark the prompt as escape-only. * module/language/tree-il/inline.scm (inline!): Inline the handler of a prompt if it is a simple lambda. dynamic-wind compilation to VM ops * module/language/tree-il/primitives.scm: Resolve calls to dynamic-wind to , thereby inlining the dynwind to VM ops, and allowing inline allocation of the body thunk. new tree-il for prompt, control, and dynamic-wind * module/language/tree-il.scm: Initial tree-il support for , , and . initial VM support for delimited continuations and dynamic-wind * libguile/vm-i-system.c (prompt, wind, throw, unwind): New instructions, for implementing dynamic-wind and delimited continuations. * libguile/vm.c: Add some stub support for the new instructions. * libguile/vm-engine.c: Some new error conditions. 2010-01-27 Andy Wingo add a test for ffi and pointers * test-suite/standalone/test-ffi: * test-suite/standalone/test-ffi-lib.c: Add a pointer test. 2010-01-27 Andy Wingo add simple foreign finalization, and pointer support * libguile/foreign.h: * libguile/foreign.c (scm_foreign_set_finalizer_x): New function, for a limited form of finalization (like `free'). (scm_alignof, scm_sizeof, parse_ffi_type, fill_ffi_type): For the purposes of make-foreign-function, treat '* (the asterisk symbol) as a pointer. * module/system/foreign.scm: Export foreign-set-finalizer!. 2010-01-27 Andy Wingo statprof bugfixes * module/statprof.scm (get-call-data): For closures, get call data by the program's objcode. (statprof-start, statprof-stop): Fix bug in which all statprof runs were enabling the apply hook regardless of the setting of #:count-calls?. The result was distorted timings, where procedure calls were unfairly penalized. (procedure=?): Streamline. inline calls to variable-bound? * module/language/tree-il/compile-glil.scm (*primcall-ops*): * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Actually resolve calls to `variable-bound?' to the opcode that we have for it. fix to variable-bound? instruction prototype * libguile/vm-i-system.c (variable-bound?): Correctly declare as popping one item. remove incremental NEWS entries in preparation for 1.9.8 * NEWS 2010-01-26 Andy Wingo add a test for foreign functions taking struct args * test-suite/standalone/test-ffi (f-sum-struct): * test-suite/standalone/test-ffi-lib.c (test_ffi_sum_struct): Add a struct test. Wheee.... turn asserts into exceptions in foreign.c * libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x) (scm_i_foreign_print, fill_ffi_type, cif_to_procedure, unpack): Turn a number of asserts into proper errors. add make-c-struct, parse-c-struct * module/system/foreign.scm: Export alignof and sizeof. (make-c-struct, parse-c-struct): New public functions. add `alignof' and `sizeof' Scheme functions * libguile/foreign.h: * libguile/foreign.c (scm_alignof, scm_sizeof): New functions. add ffi tests * test-suite/standalone/Makefile.am: * test-suite/standalone/test-ffi: * test-suite/standalone/test-ffi-lib.c: Add some tests for the ffi. 2010-01-26 Andy Wingo implement foreign-call * libguile/foreign.h: * libguile/foreign.c (scm_i_foreign_call): New internal function, actually implementing foreign calls. Untested. * libguile/vm-i-system.c (foreign-call): Wire up the call to scm_i_foreign_call. 2010-01-26 Andy Wingo first pass at implementing low-level foreign functions * libguile/Makefile.am (AM_CPPFLAGS): Move LIBFFI_CFLAGS here (from AM_CFLAGS), allowing snarfing to work. * libguile/foreign.h (scm_make_foreign_function): New public function. * libguile/foreign.c: Flesh out an implementation of foreign functions. (scm_take_foreign_pointer): Bugfix for the case in which we have a finalizer. * module/system/foreign.scm: Export `make-foreign-function'. 2010-01-26 Andy Wingo renumber VM opcodes * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Renumber ops. Add a foreign-call op stub. Rearrange some ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump 2010-01-26 Andy Wingo byte access to foreigns via bytevectors * libguile/foreign.h: * libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x): Remove all bits about offsets and aliasing; bytevectors are much better at that. (scm_foreign_to_bytevector, scm_bytevector_to_foreign): New functions for getting at the bytes of a memory region. * module/system/foreign.scm (foreign->bytevector, bytevector->foreign): Export these. 2010-01-26 Andy Wingo move foreign function interface to its own module * libguile/foreign.h: * libguile/init.c: Change so that init just registers an extension, later called by foreign.scm. * libguile/foreign.c (scm_init_foreign): Define constants for the various foreign types. * module/Makefile.am: * module/system/foreign.scm: New module, for the foreign function interface. 2010-01-26 Andy Wingo foreign.h presents a more pointer-centric interface * libguile/foreign.c: * libguile/foreign.h: Rework interface to be more pointer-centric. Details are: (SCM_FOREIGN_TYPE_STRUCT, SCM_FOREIGN_TYPE_POINTER): Removed; now the pointer in a foreign is first-class. If it points to a native type like uint32, then it still has a tag; but if it points to something else, like a struct or a pointer or something, then its type is VOID (i.e., void*). (SCM_FOREIGN_POINTER): Rename from SCM_FOREIGN_OBJECT. (SCM_FOREIGN_VALUE_REF, SCM_FOREIGN_VALUE_SET): Rename from SCM_FOREIGN_OBJECT_REF and SCM_FOREIGN_OBJECT_SET, to indicate that they only work with value types. (SCM_FOREIGN_HAS_FINALIZER): Reserve a bit to indicate if the foreign pointer in question has a finalizer registered. (SCM_FOREIGN_LEN): For void* pointers, optionally store the length in bytes of the associated memory region. (SCM_FOREIGN_VALUE_P): Rename from SCM_FOREIGN_SIMPLE_P. (SCM_VALIDATE_FOREIGN_VALUE): Rename from SCM_VALIDATE_FOREIGN_SIMPLE. (scm_take_foreign_pointer): Rename from scm_c_take_foreign. Remove scm_c_from_foreign. (scm_foreign_type): New accessor. (scm_foreign_ref, scm_foreign_set_x): Take some optional args, used when dereferencing void pointers. * libguile/dynl.h: * libguile/dynl.c (scm_dynamic_pointer): New function, used by scm_dynamic_func. Adapt code to foreign.h changes. * libguile/goops.c (scm_enable_primitive_generic_x) (scm_set_primitive_generic_x): Use the SCM_SET_SUBR_GENERIC macro. * libguile/gsubr.c (create_gsubr): Adapt to API change. * libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Store the pointer directly, not indirected. * libguile/snarf.h (SCM_DEFINE, SCM_IMMUTABLE_FOREIGN): Store subr pointers directly. Adapt to SCM_FOREIGN_TYPE_VOID change. * libguile/vm-i-system.c (subr-call): Access the void* directly. 2010-01-26 Andy Wingo add libffi dependency * configure.ac: * libguile/Makefile.am (AM_CFLAGS, libguile_la_LDFLAGS): Add a libffi dependency, for making a dynamic FFI. 2010-01-26 Ludovic Courtès Recognize structs with both "pr" and "pw" flags as simple. * libguile/struct.c (set_vtable_layout_flags): Keep the `SCM_VTABLE_FLAG_SIMPLE' flag when VTABLE has a mixture of `r' and `w' fields. * libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE): Adjust comment. 2010-01-25 Ludovic Courtès Add ASCII art representing the basic struct layout. * libguile/struct.h: Add ASCII art version of the basic struct layout as shown in Andy's diagrams. Reinstate 2-word displacement for structs. * libguile/struct.c (scm_init_struct): Reinstate 2-word displacement removed by 01e74380f6170b5cb1105e5df9a368ab257420ef. 2010-01-23 Michael Gran R6RS string escapes broken on string output scm_to_stringn failed to do the necessary escape conversion for R6RS hex escapes * libguile/strings.c (unistring_escapes_to_r6rs_escapes): new function (scm_to_stringn): use new function when r6rs hex escapes are enabled * test-suite/tests/reader.test: new test for string display 2010-01-23 Ludovic Courtès Revert "Install `standard-library.info'." This reverts commit 0e64cbea3d22411564af302a63b670fe0617ccf3. 2010-01-23 Ludovic Courtès Add `struct-ref' and `struct-set' VM opcodes. * libguile/vm-i-scheme.c (make_struct): Optimize the `SCM_VTABLE_FLAG_SIMPLE' case. (struct_ref, struct_set): New opcodes. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add `struct-ref' and `struct-set!'. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Likewise. (*effect-free-primitives*): Add `struct-ref'. 2010-01-23 Ludovic Courtès Slightly improve comments and style in `struct.c'. * libguile/struct.c (scm_i_struct_inherit_vtable_magic): Comment. Punctuate comments within the body, have them follow GCS. (scm_make_vtable_vtable): Clarify comments. Clarify GC-registered displacements for structs. * libguile/struct.c (scm_init_struct): Remove unneeded `GC_REGISTER_DISPLACEMENT ()' call. Comment the remaining one. 2010-01-23 Ludovic Courtès Optimize struct initialization and accessors for the common case. * libguile/struct.c (set_vtable_layout_flags): New function. (scm_i_struct_inherit_vtable_magic): Use it. (scm_struct_init): Optimize the case where HANDLE's vtable has the `SCM_VTABLE_FLAG_SIMPLE' flag. (scm_struct_ref): Likewise. (scm_struct_ref): Likewise, when `SCM_VTABLE_FLAG_SIMPLE_RW' is also set. * libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Update comment for the next-to-last hidden field. (scm_vtable_index_reserved_6): Rename to... (scm_vtable_index_size): ... this. (SCM_VTABLE_FLAG_RESERVED_0): Rename to... (SCM_VTABLE_FLAG_SIMPLE): ... this. (SCM_VTABLE_FLAG_RESERVED_1): Rename to... (SCM_VTABLE_FLAG_SIMPLE_RW): ... this. * test-suite/tests/structs.test ("low-level struct procedures")["struct-ref", "struct-set!", "struct-ref out-of-range", "struct-set! out-of-range"]: New tests. 2010-01-22 Ludovic Courtès Install `standard-library.info'. * doc/ref/Makefile.am (BUILT_SOURCES): Move `standard-library.texi' to... (nodist_info_TEXINFOS): ... here. New variable. 2010-01-20 Ludovic Courtès Fix `uniform-vector-read!' and `uniform-vector-write'. * libguile/deprecated.c (scm_uniform_vector_read_x, scm_uniform_vector-write): Account for optional arguments. Make sure the former always returns an integer. * libguile/deprecated.h (scm_uniform_vector_read_x, scm_uniform_vector_write, scm_uniform_array_read_x, scm_uniform_array_write): Mark as `SCM_DEPRECATED'. 2010-01-19 Ludovic Courtès Bump version number for 1.9.7. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Update `NEWS'. Document `guile-tools compile'. * doc/ref/api-evaluation.texi (Compilation): Document `guile-tools compile'. 2010-01-19 Ludovic Courtès Reinstate `scm_is_bool ()' as a function. * libguile/boolean.c (scm_is_bool): New function. * libguile/boolean.h (scm_is_bool): New function declaration. 2010-01-19 Ludovic Courtès Make `sockets.test' more robust. * test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): Gracefully handle cases where this combination is not supported. 2010-01-19 Michael Gran Document modal encodings problem in ref doc * doc/ref/api-io.texi (Ports): note that modal encodings are not supported 2010-01-19 Ludovic Courtès Fix use of utimensat(2). * libguile/posix.c (scm_utime): Use "#ifdef HAVE_UTIMENSAT", not "#if HAVE_UTIMENSAT". Fix GCC warning around call to utimensat(2): "passing argument 3 of 'utimensat' from incompatible pointer type". * test-suite/tests/posix.test ("utime"): New test prefix. 2010-01-18 Michael Gran Move string internals description in ref doc * doc/ref/api-data.texi: move string internals section String ref doc updates for case and conversion * doc/ref/api-data.texi: clarifications on Alphabetic Case Mapping and Conversion To/From C. Document string-bytes-per-char and %string-dump * doc/ref/api-data.texi (String Internals): new subsubsection. Document string-bytes-per-char and %string-dump. 2010-01-17 Michael Gran object->assembly shouldn't presume existence of %nil The %nil constant only exists if SCM_ENABLE_ELISP is defined. * module/language/assembly (object->assembly): check for existence of %nil 2010-01-17 Michael Gran reader options macros incorrect when SCM_ENABLE_ELISP undefined When compiled with SCM_ENABLE_ELISP undefined, the reader options macros SCM_R6RS_ESCAPES_P and SCM_SQUARE_BRACKETS_P point past the end of the scm_read_opts struct. *libguile/private-options.h (SCM_R6RS_ESCAPES_P) [!SCM_ENABLE_ELISP]: modified (SCM_SQUARE_BRACKETS_P) [!SCM_ENABLE_ELISP]: modified (SCM_N_READ_OPTIONS): modified 2010-01-17 Andy Wingo fix doc snarfing with fedora 12 * module/scripts/snarf-check-and-output-texi.scm (process-multiline-directive): Be more accepting of source location markers in the preprocessed source, by adding a couple cases in which they can appear. Not foolproof, but it does adapt to what new GCCs are putting out (e.g. cpp (GCC) 4.4.2 20091222 (Red Hat 4.4.2-20)). 2010-01-17 Andy Wingo nanosecond timestamp support in stat and utime * libguile/posix.h: * libguile/posix.c (scm_utime): Add optional nanosecond arguments. This is an incompatible change on the C level, but it's unlikely people are using this POSIX wrapper function, because they would just use the POSIX function directly. Hopefully, anyway. * module/system/base/compile.scm (call-with-output-file/atomic): Propagate source timestamps to targets with nanosecond precision, if available. Fixes build on systems with ext4 filesystems. * libguile/filesys.c (scm_stat2scm): * module/ice-9/posix.scm (stat:atimensec, stat:mtimensec) (stat:ctimensec): Add three new elements to Scheme stat structures, for nanosecond-level timestamps. * configure.ac: Add checks for utimensat, and for nanosecond fields in struct stat. We should switch to using Gnulib things for these, though. * doc/ref/posix.texi (File System): Add documentation for utime's additional arguments, and nanosecond stat timestamp accessors. 2010-01-15 Andy Wingo fix (class-of #u32()) * libguile/goops.c (scm_class_of, create_standard_classes): Return or for bytevectors, as appropriate. add reader option for parsing [] as (). * libguile/private-options.h: * libguile/read.c (scm_read_opts, SCM_SQUARE_BRACKETS_P): Add an option for treating [ and ] as parentheses, on by default. Note that this makes them delimiters also, so [ and ] cannot appear in a symbol name, with this read option on. (scm_read_sexp): If we start with [, we end with ]. (scm_read_expression): Add case for [. 2010-01-14 Andy Wingo fix call counting in statprof, enhance repl support * module/statprof.scm: Use VM modules, instead of using @ hacks. (statprof): New public export, a functional interface to the profiler. (profile-signal-handler, count-call, statprof-start, statprof-stop): Fix call counting with the VM. (statprof-call-data->stats): Hack around a case in which a call could be sampled but not counted, if you get my drift. (procedure=?): Update for current API. (with-statprof): Use `statprof'. * module/system/repl/command.scm (profile): Use the `statprof' procedural interface. 2010-01-14 Andy Wingo vm.c uses scm_c_take_bytevector instead of scm_take_u8vector * libguile/vm.c (really_make_boot_program): Use scm_c_take_bytevector to avoid loading srfi-4 at boot time. 2010-01-14 Andy Wingo 1.8 compat in ice-9 syncase * module/ice-9/syncase.scm: Export datum->syntax-object and syntax-object->datum as aliases of datum->syntax and syntax->datum. Thanks to Daniel Llorens del Río for the suggestion. vm-trace prints return values * module/system/vm/trace.scm (vm-trace): Add a #:width argument. Print return values, as Chez Scheme does. 2010-01-13 Andy Wingo RETURN_HOOK communicates the number of returned values * libguile/vm-engine.h (RUN_HOOK1): Add some machinery whereby a hook can push an arg on the stack, run the hook, then drop the value. (RETURN_HOOK): Use it here, so we push the number of returned values. * libguile/vm-i-system.c (return, return-values): Adapt to RETURN_HOOK changes. 2010-01-13 Andy Wingo vm-trace only traces execution of its thunk * module/system/vm/trace.scm (vm-trace): Change to just export the one procedure, vm-trace. This way it's threadsafe and more robust. Also refactor to not print any of Guile's internal bits. Hopefully Neil will be happier :) * module/system/repl/command.scm (option): Adapt to removal of vm-trace-on! and vm-trace-off!, as those are unlikely to DTRT. 2010-01-13 Andy Wingo remove unused var in read.c * libguile/read.c (scm_read_character): Remove unused var. 2010-01-13 Thien-Thi Nguyen Use `mkstemp' instead of `mktemp'. * test-suite/standalone/test-unwind.c (check_ports): Use `mkstemp' instead of `mktemp'. Update configure script hints wrt precious env vars. * README: Don't suggest setting vars before running configure. Instead, suggest specifying them on the configure command-line. 2010-01-13 Michael Gran Document R6RS hex escapes * doc/ref/api-data.texi (Characters, String Syntax): document r6rs hex escapes * doc/ref/api-options.texi (Reader Options): document r6rs-hex-escapes reader option 2010-01-13 Michael Gran Disable \u and \U escapes when r6rs-hex-escapes enabled When the reader option 'r6rs-hex-escapes is enabled, the \uNNNN and \UNNNNNN string escape sequences should be disabled. * libguile/read.c (scm_read_string): added checks for SCM_R6RS_ESCAPES_P 2010-01-13 Michael Gran Move r6rs-hex-escape tests into reader.test * test-suite/tests/reader.test (r6rs-hex-escapes): new tests * test-suite/tests/chars.test (R6RS Hex escapes): remove tests by reverting to previous version * test-suite/tests/strings.test (R6RS Hex escapes): remove tests by reverting to previous version 2010-01-13 Michael Gran Reader option for R6RS hex escapes This adds a reader option 'r6rs-hex-escapes that modifies the behavior of numeric escapes in characters and strings. When enabled, variable-length character hex escapes (#\xNNN) are allowed and become the default output format for numerically-escaped characters. Also, string hex escapes switch to a semicolon terminated hex escape (\xNNNN;). * libguile/print.c (PRINT_CHAR_ESCAPE): new macro (iprin1): use new macro PRINT_CHAR_ESCAPE * libguile/private-options.h (SCM_R6RS_ESCAPES_P): new #define * libguile/read.c (scm_read_opts): add new option r6rs-hex-escapes (SCM_READ_HEX_ESCAPE): modify to take a terminator parameter (scm_read_string): parse R6RS hex string escapes (scm_read_character): parse R6RS hex character escapes * test-suite/tests/chars.test (with-read-options): new procedure (R6RS hex escapes): new tests * test-suite/tests/strings.test (with-read-options): new procedure (R6RS hex escapes): new tests 2010-01-12 Andy Wingo fix texinfo reflection for procedures * module/system/vm/program.scm (program-arguments-alist): Rename from program-arguments, a name shadowed by features.c (arglist->arguments-alist, arity->arguments-alist) (arguments-alist->lambda-list, program-lambda-list, write-program): Adapt callers. * module/system/vm/frame.scm (frame-lookup-binding): Return #f if the binding is not found, not an error. (frame-binding-set!, frame-binding-ref): Adapt to error appropriately. (frame-arguments): Dispatch to frame-call-representation. (frame-call-representation): Refactor a bit. * module/ice-9/session.scm (procedure-arguments): Adapt to program-arguments name change. * module/texinfo/reflection.scm (get-proc-args): Refactor to actually work with VM procedures. 2010-01-12 Andy Wingo allow simple value definitions with define*-public * module/ice-9/optargs.scm (define*-public): Allow (define*-public ID VAL). hopefully fix shared c32 / c64 uniform arrays * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Add a width parameter, indicating the number of sizeof(ctype) entries comprised by one element of the uniform; normally 1, but 2 for c32 and c64. make-array bugfix * libguile/vm-i-scheme.c (make-array): Fix terrible stack corruption bug. inspector integration in debugger * module/system/vm/debug.scm: Integrate with the inspector. Add a "procedure" command. fix srfi-4 shared vector access from c * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix elements/writable_elements for shared vectors. Thanks to Daniel Llorens del Río for the info. 2010-01-12 Andy Wingo programs print as # * module/system/vm/program.scm (write-program): Print as #. Fix stdin printing. * doc/ref/vm.texi: Update a little bit. 2010-01-12 Andy Wingo add a silly inspector * module/Makefile.am: * module/system/vm/inspect.scm: Add a very simple and stupid inspector. 2010-01-11 Andy Wingo remove section on enclose-array * doc/ref/api-compound.texi (Array Procedures): Remove section on `enclose-array', as it doesn't exist any more. fix compilation of #2((1 2 3) (4 5 6)) * module/language/glil/compile-assembly.scm (dump-object): Whoops, really fix for multidimensional arrays. allow (define* SYM VAL) * module/ice-9/psyntax.scm (define*): Allow (define* SYM VAL), as 1.8 did. Thanks to Patrick McCarty for the report. 2010-01-11 Andy Wingo allow compilation of #@2(1 2 3) * libguile/arrays.h: * libguile/arrays.c (scm_from_contiguous_array): New public function, like scm_from_contiguous_typed_array but for arrays of generic Scheme values. * libguile/vm-i-scheme.c (make-struct): Sync regs before making the struct, so if we get a GC the regs are on the heap. (make-array): New instruction, makes an generic (untyped) Scheme array. * module/language/glil/compile-assembly.scm (dump-object): Correctly compile arrays. 2010-01-11 Andy Wingo fix erroneous compilation of #@2(1 2 3) as #(1 2 3) * module/language/glil/compile-assembly.scm (dump-object): Fix the vector case to only match 0-indexed, vectors, not arrays like #@2(1 2 3). 2010-01-11 Ludovic Courtès Evaluate the `export' and `re-export' forms at compile-time. * module/ice-9/boot-9.scm (export, re-export): Evaluate at compile-time in addition to load/eval. * test-suite/tests/tree-il.test ("warnings")["unused-toplevel"]("unused but define-public"): Remove throw to `unresolved'. 2010-01-11 Ludovic Courtès The reference graph in `-Wunused-toplevel' may contain cycles. * module/language/tree-il/analyze.scm (, dag-reachable-nodes, dag-reachable-nodes*, unused-toplevel-analysis): Replace occurrences of "dag" by "graph". 2010-01-11 Michael Gran Refactor repeated code in scm_read_string * libguile/read.c (SCM_READ_HEX_ESCAPE): new macro (scm_read_string): use new macro SCM_READ_HEX_ESCAPE 2010-01-11 Ludovic Courtès Move `feature?' to `deprecated.scm'. * module/ice-9/boot-9.scm (feature?): Move to... * module/ice-9/deprecated.scm (feature?): ... here. 2010-01-11 Ludovic Courtès Make `(ice-9 deprecated)' a module of its own. * module/ice-9/boot-9.scm: Load `deprecated.scm' with `resolve-interface' instead of `primitive-load-path'. * module/ice-9/deprecated.scm: Turned into a module, `(ice-9 deprecated)'. 2010-01-11 Ludovic Courtès Make `boot-9.scm' more friendly with `-Wunused-toplevel'. * module/ice-9/boot-9.scm: Switch back to the `(guile)' modules at the end when compiling. Fix SRFI-19 exports. * module/srfi/srfi-19.scm: Export `time-monotonic->julian-day' and `time-monotonic->modified-julian-day'. Remove obscure `current-time' hack. Use `(define-module :export ...)' instead of `(export ...)'. 2010-01-11 Ludovic Courtès Remove unused top-level variables. * module/ice-9/runq.scm (fork-strips): Remove. * module/language/assembly.scm (*block-alignment*): Remove. * module/language/assembly/disassemble.scm (disassemble-objects, simplify): Remove. * module/srfi/srfi-18.scm (mutex-owners): Remove. * module/srfi/srfi-19.scm (leap-year?): Remove. * module/system/base/compile.scm (dsu-sort): Remove. * module/texinfo.scm (ascii->char): Remove. * module/texinfo/html.scm (ignored?): Remove. * module/texinfo/indexing.scm (def-name): Remove. * module/texinfo/plain-text.scm (ignore): Remove. 2010-01-11 Ludovic Courtès Have "guile-tools compile" use the current locale. * meta/guile-tools.in (main): Install the user's locale. Provide Guile-friendly `coding:' meta-data. * module/ice-9/i18n.scm, module/rnrs/bytevector.scm, module/rnrs/io/ports.scm, module/scripts/compile.scm, module/srfi/srfi-35.scm, module/srfi/srfi-88.scm: Write `coding:' comment at the top. 2010-01-11 Ludovic Courtès Add `-Wunused-toplevel' compiler warning. * module/language/tree-il/analyze.scm (): New record type. (dag-reachable-nodes, dag-reachable-nodes*, unused-variable-analysis): New variables. (unbound-variable-analysis): Slightly simplify the `up' procedure. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `unused-toplevel'. * module/system/base/message.scm (%warning-types): Likewise. * test-suite/tests/tree-il.test (%opts-w-unused-toplevel): New variable. ("warnings")["unused-toplevel"]: New test prefix. 2010-01-11 Michael Gran Merge branch 'master' of git.sv.gnu.org:/srv/git/guile 2010-01-11 Michael Gran Add R6RS backspace string escape R6RS suggests that '\b' should be a string escape for the backspace character. * libguile/read.c (scm_read_string): parse backspace escape * test-suite/tests/strings.test (R6RS backslash escapes): new test (Guile extensions backslash escapes): remove R6RS escapes from test. * doc/ref/api-data.texi (Strings): document new string escape 2010-01-11 Michael Gran Add R6RS backslash string escape R6RS suggests that '\b' should be a string escape for the backslash character. * libguile/read.c (scm_read_string): parse backspace escape * test-suite/tests/strings.test (R6RS backslash escapes): new test (Guile extensions backslash escapes): remove R6RS escapes from test. * doc/ref/api-data.texi (Strings): document new string escape 2010-01-11 Michael Gran Add R6RS character names R6RS adds new names for some of the control characters. * libguile/chars.c (scm_r6rs_charnames, scm_r6rs_charnums) (SCM_N_R6RS_CHARNAMES): new character name constants (scm_alt_charnames, scm_alt_charnums): modified to remove duplicates (scm_i_charname, scm_i_charname_to_char): use new constants * test-suite/tests/chars.test (R5RS character names, R6RS character names): new tests * doc/ref/api-data.texi (Characters): updated 2010-01-10 Andy Wingo fix properties disassembly * module/language/assembly/disassemble.scm (disassemble-meta): Properties start with the fourth element, not the third. (The third is the set of arities.) show args to subr calls in backtraces * module/system/vm/frame.scm (frame-arguments): For subrs, we don't get names in the lambda-list, we get #f instead. But still, parse out the args in that case, assuming they are on the stack in that order. update NEWS * NEWS: Update for 1.9.7, and fold new entries into the main text. fold 1.9.6 NEWS into the main text * NEWS: Incorporate 1.9.6 NEWS items into the main text. 2010-01-09 Thien-Thi Nguyen Fix bug: Use correct `FUNC_NAME' for `scm_macro_binding'. * libguile/macros.c (scm_macro_binding): Use correct FUNC_NAME. Add cast in `make_vm' to silence compiler warning. * libguile/vm.c (make_vm): Add cast for .stack_base assignment. Fix bug: Init auto var to unrandomize `stack_depth' rv. * libguile/stacks.c (stack_depth): Init `n'. 2010-01-09 Andy Wingo fix SCM_STACK_OVERFLOW_P bug * libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Fix a potential overflow, depending on the absolute values of the thread base and the stack limit. Thanks to Ivan Shcherbakov for the report. slight tweak to stack narrowing in the debugger * module/system/vm/debug.scm: Really narrow two frames and not by function, so it works in the evaluator. fix bug in subr-call and smob-call * libguile/vm-i-system.c (subr-call, smob-call): Unlike the previous situation, in which a call to a subr or a smob didn't actually build a frame, we no longer need to explicitly pop the procedure and its arguments. Indeed the procedure and its arguments must remain on the stack, for hooks and ticks and such always to see frames with valid procedures. Two lines out, two bugs less, and faster to boot. Narrow one more frame in debug.scm:debug-pre-unwind-handler * module/system/vm/debug.scm (debug-pre-unwind-handler): Narrow two frames instead of stack-reffing past one. The second frame is necessary, now that make-stack itself is on the stack. print the error more nicely when we enter the debugger * module/system/vm/debug.scm (debug-pre-unwind-handler): Nicer printing of the error. 2010-01-09 Andy Wingo make backtraces prettier * module/system/vm/debug.scm (print-frames): Clean up a bit, reverting part of the previous change. (The problem was that in the else branch of the conditional, it didn't consume an arg.) In the future I would like to preserve the clean look of the backtraces. It's easier to read that way. 2010-01-09 Andy Wingo port-encoding returns #f if port encoding not set * libguile/ports.c (scm_port_encoding): Instead of returning "NONE" if we don't know the encoding, return #f. Allows truncated-print to work if you don't have a locale set. 2010-01-09 Andy Wingo allocate free variables inline to closures * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/programs.h (SCM_PROGRAM_FREE_VARIABLES) (SCM_PROGRAM_FREE_VARIABLE_REF, SCM_PROGRAM_FREE_VARIABLE_SET) (SCM_PROGRAM_NUM_FREE_VARIABLES): * libguile/programs.c (scm_make_program, scm_program_num_free_variables) (scm_program_free_variable_ref, scm_program_free_variable_set_x): Allocate free variables inline with programs, instead of being in a vect. Should improve locality, and require fewer local variables in the VM. * libguile/vm-engine.c (vm_engine): Remove free_vars and free_vars_count variables. * libguile/vm-engine.h (CACHE_PROGRAM): No need to muck with free_vars and free_vars_count. (CHECK_FREE_VARIABLE): Update for inline free vars. * libguile/vm-i-system.c (FREE_VARIABLE_REF): Update for inline free vars. (make-closure, fix-closure): Take the closure vals as separate stack args, and copy or fix them inline into the appropriate closure. * module/language/objcode/spec.scm (program-free-variables): Define a local version of this removed function. * module/language/tree-il/compile-glil.scm (flatten): Adjust to not make a vector when making closures. * module/system/vm/program.scm: Export program-num-free-variables, program-free-variable-ref, program-free-variable-set!, and remove program-free-variables. * test-suite/tests/tree-il.test ("lambda"): Update to not make vectors when making closures. 2010-01-09 Andy Wingo smobs are applied with vm trampoline procedures * libguile/smob.c: Instead of having special evaluator support for applying smobs, we use the same strategy that gsubr uses, that smob application should happen via a trampoline VM procedure, which uses a special opcode (smob-apply). So statically allocate all of the desired trampoline procedures here. (scm_i_smob_apply_trampoline): Unfortunately there's no real place to put the trampoline, so instead use a weak-key hash. It's nasty, but I think the benefits of speeding up procedure calls in the general case are worth it. * libguile/smob.h (scm_smob_descriptor): Remove fields apply_0, apply_1, apply_2, and apply_3; these were never public. Also remove the gsubr_type field. Instead cache the trampoline objcode here. (SCM_SMOB_APPLY_0, SCM_SMOB_APPLY_1, SCM_SMOB_APPLY_2, SCM_SMOB_APPLY_3): Just go through scm_call_0, etc here. * libguile/vm-i-system.c (call, tail-call, mv-call): Simplify. All procedure calls are VM calls now. (smob-call): New instruction, used in smob trampoline procedures. * libguile/vm.c (apply_foreign): Remove. Yay! * libguile/procprop.c (scm_i_procedure_arity): Refactor a bit for the smob changes. 2010-01-09 Andy Wingo re-add SCM_GSUBR_MAX * libguile/gsubr.h (SCM_GSUBR_MAX): Restore this define, which specifies the max number of args to a gsubr. * libguile/smob.c: Remove local SCM_GSUBR_MAX define. 2010-01-08 Ludovic Courtès Fix frame printing in the debugger. * module/system/vm/debug.scm (location-string): New procedure. (print-frames): Use it. This fixes cases where LINE is #f and makes a distinction between FILE = stdin and FILE is unknown. Factorize the location stack handling in warning analyses. * module/language/tree-il/analyze.scm (analyze-tree)[traverse]: New argument UPDATE-LOCS. Update users. [keep-locs, extend-locs, shrink-locs]: New procedures. (, ): Remove `locs' field. (unused-variable-analysis, unbound-variable-analysis): Update accordingly. 2010-01-08 Ludovic Courtès Use `HORIZONTAL ELLIPSIS' when available in `truncated-print'. * module/ice-9/pretty-print.scm (truncated-print): Set `%default-port-encoding' to the encoding of PORT. Choose either U+2026 or "..." depending on PORT's encoding. * test-suite/tests/print.test ("truncated-print")[tprint]: New ENCODING argument. Update existing tests accordingly. Add UTF-8 tests. * doc/ref/misc-modules.texi (Pretty Printing): Mention the possible use of U+2026. 2010-01-07 Andy Wingo remove scm_tc7_gsubr * libguile/tags.h (scm_tc7_gsubr): Return to the pool of unused tc7s, as there are no more gsubrs. Yay :) * libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE): (SCM_PROGRAM_IS_PRIMITIVE): New flag and accessor. * libguile/gsubr.c (create_gsubr): * libguile/snarf.h (SCM_STATIC_PROGRAM): Give subrs a PRIMITIVE flag. * libguile/smob.h: * libguile/smob.c (scm_i_smob_arity): New internal procedure. Uses the old GSUBR type macros, local to the file. * libguile/procprop.c (scm_i_procedure_arity): Call out to scm_i_smob_arity, and remove a gsubr case. * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): * libguile/vm.c (apply_foreign): * libguile/hash.c (scm_hasher): * libguile/debug.c (scm_procedure_name): * libguile/print.c (iprin1): Remove gsubr cases. * libguile/gsubr.h (SCM_PRIMITIVE_P): Fix to work with the new VM program regimen. (SCM_GSUBR_TYPE, SCM_GSUBR_MAKTYPE, SCM_GSUBR_MAX, SCM_GSUBR_REQ) (SCM_GSUBR_OPT, SCM_GSUBR_REST): Remove these macros, that are no longer useful. * libguile/gsubr.c (scm_i_gsubr_apply, scm_i_gsubr_apply_list) (scm_i_gsubr_apply_array): Remove internal gsubr application functions. 2010-01-07 Andy Wingo fix procedure-name on applicable structs * libguile/debug.c (scm_procedure_name): Fix for applicable structs. 2010-01-07 Andy Wingo subrs are now VM trampoline procedures * libguile/_scm.h: Add foreign.h and programs.h to the private include list, as snarfing subrs with static allocation now needs access to some of their enums and macros. * libguile/gsubr.c (create_gsubr): Instead of creating a tc7_gsubr object, create a VM program with the call-subr opcode, so that the representation of subrs is now gsubrs. CPP and elisp, together at last. (scm_subr_objcode_trampoline): New function, used by the SCM_DEFINE snarf macro. * libguile/gsubr.h (SCM_SUBR_META_INFO, SCM_SUBR_PROPS) (SCM_SET_SUBR_GENERIC_LOC, SCM_SUBR_ARITY_TO_TYPE): Remove these macros. They were never deprecated, but hopefully people aren't using them. (SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC): Update to work on the new subr representation. * libguile/objcodes.h (SCM_F_OBJCODE_IS_STATIC): New flag, indicates that the "backing store" of the objcode is statically allocated. * libguile/procprop.c (scm_sym_name): Define here instead of in gsubr.c. * libguile/snarf.h (SCM_DEFINE): If we are doing static allocation, statically allocate the foreign object, the object table, and the program, and use some SCM_SNARF_INITtery to fix things up. Unfortunately I have not been able to make this immutable. It might be possible, though. (SCM_IMMUTABLE_CELL, SCM_STATIC_DOUBLE_CELL, SCM_IMMUTABLE_FOREIGN): (SCM_STATIC_SUBR_OBJVECT, SCM_STATIC_PROGRAM): New helper macros. 2010-01-07 Andy Wingo better scm_subr_p deprecation * libguile/deprecated.h (scm_subr_p): Dispatch instead to scm_i_subr_p so we get link-time and run-time warnings. * libguile/deprecated.c (scm_i_subr_p): Here we call SCM_PRIMITIVE_P. provide missing prototypes * libguile/array-map.c: * libguile/chars.c: * libguile/eq.c: * libguile/strorder.c: Provide declarations missing after the asubrs/rpsubrs -> gsubr conversion. boot the VM very early in init.c * libguile/init.c (scm_i_init_guile): Now that the VM doesn't depend on smobs, we can boot it before anything. 2010-01-07 Andy Wingo tc7 tags for vm-related data * libguile/tags.h (scm_tc7_frame, scm_tc7_objcode, scm_tc7_vm) (scm_tc7_vm_cont): Take more tc7s for VM-related data structures. * libguile/evalext.c (scm_self_evaluating_p): * libguile/gc.c (scm_i_tag_name): * libguile/goops.c (scm_class_of, create_standard_classes): * libguile/print.c (iprin1): Add cases for the new tc7s. * libguile/frames.c: * libguile/frames.h: * libguile/objcodes.c: * libguile/objcodes.h: * libguile/vm.c: * libguile/vm.h: Desmobify. * libguile/vm.c (scm_vm_apply): Export to Scheme, because VM objects are no longer applicable. * module/system/repl/command.scm (profile): * module/system/vm/trace.scm (vm-trace): * module/system/vm/vm.scm (vm-load): Call vm-apply to run a program in a VM instead of treating the VM as applicable. 2010-01-07 Andy Wingo properly integrate vm bootstrapping into init.c * libguile/Makefile.am (modinclude_HEADERS): * libguile/vm-bootstrap.h: Remove vm-bootstrap.h. * libguile/frames.c: No more vm-bootstrap.h. * libguile/instructions.c (scm_init_instructions): * libguile/objcodes.c (scm_init_objcodes): * libguile/programs.c (scm_init_programs): No need to call scm_bootstrap_vm, init.c does that for us. * libguile/vm.c (scm_bootstrap_vm): No need call e.g. scm_bootstrap_frames, init.c does that. Remove a twice-calling guard, should be unnecessary. Don't define the load-compiled subr here. * libguile/load.c (scm_init_load): Define the load-compiled subr here. * libguile/vm.h: Declare scm_bootstrap_vm here. * libguile/init.c (scm_i_init_guile): Properly integrate VM bootstrapping into this file. 2010-01-07 Andy Wingo boot bytevectors earlier * libguile/init.c (scm_i_init_guile): It turns out generalized-vectors and generalized-arrays don't actually block anyone in the dependency graph, so punt those back to the end. Bootstrap bytevectors earlier, though, which don't actually depend on smobs. inline srfi-4 vector accessors * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Inline srfi-4 vector accessors. 2010-01-07 Andy Wingo update uniform vector docs * doc/ref/api-compound.texi (Uniform Numeric Vectors): Make a subsection of "Vectors", and link out to SRFI-4, where the main text has been moved. * doc/ref/api-data.texi (Bytevectors as Uniform Vectors): New section. * doc/ref/srfi-modules.texi (SRFI-4): Move body of uniform vector docs here. Discuss new module separation. Discuss relation to bytevectors. 2010-01-07 Andy Wingo reimplement srfi-4 vectors on top of bytevectors * libguile/srfi-4.h: * libguile/srfi-4.c (scm_make_srfi_4_vector): New function, exported by (srfi srfi-4 gnu). * libguile/srfi-4.i.c: Removed. * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: Reimplement srfi-4 vectors on top of bytevectors. The implementation is mostly in Scheme now. * test-suite/tests/unif.test: Update to use (srfi srfi-4 gnu). * libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64) (bytevector_set_c32, bytevector_set_c64): Fix some embarrassing bugs. Still need to do an upper bounds check. * libguile/deprecated.h: Remove deprecated array functions: scm_i_arrayp, scm_i_array_ndim, scm_i_array_mem, scm_i_array_v, scm_i_array_base, scm_i_array_dims, and the deprecated macros: SCM_ARRAYP, SCM_ARRAY_NDIM, SCM_ARRAY_CONTP, SCM_ARRAY_MEM, SCM_ARRAY_V, SCM_ARRAY_BASE, SCM_ARRAY_DIMS. * libguile/deprecated.c (scm_uniform_vector_read_x) (scm_uniform_vector_write, scm_uniform_array_read_x) (scm_uniform_array_write): Newly deprecated functions. * libguile/generalized-arrays.c (scm_array_type): Remove the bytevector hack. * libguile/objcodes.c (scm_bytecode_to_objcode, scm_objcode_to_bytecode): Rework to operate on bytevectors, as scm_make_u8vector now causes a module lookup, which can't be done e.g. when loading the VM boot program for psyntax-pp.go on a fresh bootstrap. * libguile/objcodes.h (SCM_F_OBJCODE_IS_BYTEVECTOR): (SCM_OBJCODE_IS_BYTEVECTOR): s/U8VECTOR/BYTEVECTOR/. * module/ice-9/boot-9.scm (the-scm-module): A terrible hack to pull in (srfi srfi-4), as the bindings are primarily there now. We'll worry about this later. 2010-01-07 Andy Wingo Revert "Remove unused internal bytevector functions." This reverts commit c4daa519107798d06ae96d2f69dc211fc57cc8a3. clean up includes in vectors.[ch] * libguile/vectors.h: * libguile/vectors.c: Clean up the includes... mostly. fix array->list * libguile/generalized-arrays.c (array_to_list): Fix buggy implementation. Thanks to Daniel Llorens del Río for the bug repor. 2010-01-07 Ludovic Courtès Enclose hooks tests in their own module. * test-suite/tests/hooks.test: Enclose in `(test-suite test-hooks)' module. Fix 1.8-compatibility of `scm_search_path ()'. * libguile/load.c (scm_search_path): Handle the 1.8-compatibility case where REST is `SCM_UNDEFINED'. Reported by Dale P. Smith. Use Gnulib's `full-write' instead of custom code. * libguile/fports.c (write_all): Remove. (fport_write): Use `full_write ()' instead of `write_all ()'. 2010-01-07 Ludovic Courtès Use `encoding-error' instead of `misc-error' for string encoding errors. * libguile/strings.c (scm_encoding_error): New function. (scm_from_stringn, scm_to_stringn): Use it instead of `scm_misc_error ()'. * test-suite/lib.scm (exception:encoding-error): Adjust accordingly. * test-suite/tests/encoding-escapes.test (exception:conversion): Remove. Use `exception:encoding-error' instead. * test-suite/tests/encoding-iso88591.test: Likewise. * test-suite/tests/encoding-iso88597.test: Likewise. * test-suite/tests/encoding-utf8.test: Likewise. 2010-01-07 Ludovic Courtès Have string ports honor `%default-port-encoding'. * libguile/strports.c (scm_i_mkstrport): Remove. (scm_mkstrport): Don't change the port's encoding to UTF-8; convert STR to the default port encoding. (scm_strport_to_string): Fix documentation & indentation. * libguile/strports.h (scm_i_mkstrport): Remove. * test-suite/lib.scm (exception:encoding-error): New variable. (format-test-name): Set `%default-port-encoding' to "UTF-8". * test-suite/tests/ports.test ("string ports")["%default-port-encoding is honored", "suitable encoding [latin-1]", "suitable encoding [latin-3]", "wrong encoding"]: New tests. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with UTF-16 string port", "put-bytevector with wrong-encoding string port"]: New tests. * test-suite/tests/reader.test (read-string): Set `%default-port-encoding' to `#f'. ("reading")["unprintable symbol"]: Use a string that doesn't contain zeros. * doc/ref/api-io.texi (String Ports): Document encoding issues with `call-with-output-string' and `with-output-to-string'. 2010-01-07 Ludovic Courtès Add in-source documentation of `scm_to_stringn ()'. * libguile/strings.c (scm_to_stringn): Add documentation comment. 2010-01-07 Andy Wingo fix compiler warnings in foreign.c * libguile/foreign.c (scm_c_from_foreign, scm_c_take_foreign): Fix compiler warnings on 64-bit machines. add subr-call VM op * libguile/vm-i-system.c (subr_call): Add subr-call VM op. add SCM_PROGRAM_IS_PRIMITIVE_GENERIC flag and checker * libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC) (SCM_PROGRAM_IS_PRIMITIVE_GENERIC): Add a primitive-generic flag and accessor, for when we switch primitives to be implemented using VM trampolines. program-meta procedures get their program's objtable * libguile/programs.c (scm_program_meta): Give the program meta procedure the same object table as the main procedure. Will allow for easier hand-crafting of meta programs. Of course when compiling a metadata procedure from Scheme, one still wants to avoid preallocating the heap objects needed by the metadata... 2010-01-07 Julian Graham Attempt to narrow normalized strings. * libguile/strings.c (normalize_str): Clean up indentation. Add call to scm_i_try_narrow_string. 2010-01-05 Andy Wingo remove unused snarf macros * libguile/snarf.h (SCM_DEFINE1, SCM_PRIMITIVE_GENERIC_1, SCM_PROC1) (SCM_GPROC1): Remove, as these deal in the removed typed subr constructors. * libguile/tags.h (scm_tcs_subrs): Remove this. Use scm_tc7_gsubr instead, though hopefully that will go too, soon. 2010-01-05 Andy Wingo move subr implementation details to gsubr.[ch] * libguile/procs.h: Move subr macros to gsubr.h. * libguile/procs.c (scm_c_make_subr, scm_c_make_subr_with_generic) (scm_c_define_subr, scm_c_define_subr_with_generic): Remove these, because they deal in subr types, and now there is only one subr type. The body of this code is now in gsubr.c. * libguile/deprecated.h (scm_subr_p): Remove from procs.[ch] and define as a deprecated macro. Only used internally, but who knows who's out there. * libguile/goops.c (scm_generic_capability_p) (scm_enable_primitive_generic_x, scm_set_primitive_generic_x) (scm_primitive_generic_generic): Use the new SCM_PRIMITIVE_GENERIC_P macro instead of calling scm_subr_p. * libguile/gsubr.h (SCM_PRIMITIVE_P, SCM_PRIMITIVE_GENERIC_P): New macros, to replace scm_subr_p and hacky checking for generic capability. (SCM_SUBR_META_INFO, SCM_SUBR_NAME, SCM_SUBRF, SCM_SUBR_PROPS) (SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC) (SCM_SUBR_ARITY_TO_TYPE): Moved here from procs.h. * libguile/gsubr.c (create_gsubr): Inline the scm_c_make_subr definition here, and work for generics too. Removed a scm_remember_upto_here_1 that was added earlier in the year when meta_info was not being traced by the GC. Adapt callers. 2010-01-05 Andy Wingo clean up macros.[ch] There are some incompatible changes here, but only to interfaces that were introduced earlier in 1.9, or interfaces which have been broken since early in 1.9. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the macro changes affect the interface that is called by psyntax-generated macro definitions. * libguile/inline.h (scm_words): New function, allocates a variable number of contiguous scm_t_bits locations, with a given value in the 0th word, and 0 in the rest of the words. * libguile/macros.h: Rework interface to correspond more closely, and minimally, to the needs of memoize.c and psyntax. (SCM_ASSYNT, SCM_MACRO_TYPE_BITS, SCM_MACRO_TYPE_MASK) (SCM_F_MACRO_EXTENDED, SCM_MACROP, SCM_MACRO_TYPE) (SCM_MACRO_IS_EXTENDED, SCM_BUILTIN_MACRO_P, SCM_SYNCASE_MACRO_P) (SCM_MACRO_CODE, scm_tc16_macro): Remove CPP macros related to the representation of Scheme macros. (scm_i_make_primitive_macro): Renamed from scm_i_makbimacro. (scm_i_macro_primitive): New accessor so that memoize.c can get to the primitive syntax transformer. (scm_make_syncase_macro, scm_make_extended_syncase_macro) (scm_syncase_macro_type, scm_syncase_macro_binding): Removed these functions, replaced by make-syntax-transformer and its accessors. (scm_macro_binding): New accessor, the same as what scm_syncase_macro_binding was. * libguile/macros.c: All representation details of syntax transformers are private to this file now. (macro_print): Print macros as #, or # if psyntax has not attached a transformer of its own. (scm_i_make_primitive_macro): Represent macros as 5-word smobs. (scm_make_syntax_transformer): New constructor for syntax transformers (macros), exported to scheme. Takes a name, and looks it up in the current module to determine the previous primitive transformer, if any. (scm_macro_type): Instead of returning 'builtin-macro!, etc, return the type as set by psyntax, or #f if it's a primitive. (scm_macro_name): Return the stored macro name. (scm_macro_transformer): Return the psyntax-set syntax transformer. Hacky, but should help introspection somewhat. * libguile/memoize.c (memoize_env_ref_transformer): Use the new scm_i_macro_primitive, and adapt to other macro API changes. * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook, chi-install-global): Call (and generate calls to) the new macro constructors and accessors. * module/ice-9/psyntax-pp.scm: Doubly regenerated. * module/ice-9/debugging/traps.scm (trap-here): Comment out this definition and export, while it's not working. 2010-01-05 Andy Wingo remove mmacros, SCM_SYNTAX snarf macro * libguile/snarf.h (SCM_SYNTAX): Remove snarf macro, users can't define primitive syntax any more. * libguile/memoize.c (SCM_SYNTAX): Define locally, and just call scm_i_makbimacro as there's no difference between that and scm_makmmacro. Alter invocations to suit. * libguile/macros.h: * libguile/macros.c (scm_i_makmmacro): Remove; users can't define primitive syntax any more. Use define-syntax instead. (scm_make_synt): Remove, this was only used by the SCM_SYNTAX snarf macro. (scm_i_makbimacro): Change prototype of this internal function to make the gsubr on behalf of the caller. (macro_print, scm_macro_type): Remove cases for mmacros. 2010-01-05 Andy Wingo remove scm_makacro and scm_makmacro * libguile/macros.h: * libguile/macros.c (scm_makacro): Remove this function for making "acros", as it is unused and won't work with the compiler. (scm_makmacro): Remove this deprecated function for making non-memoizing macros, as they won't work with the compiler. (macro_print, scm_macro_type): Remove a couple of cases for macros that can't be created any more. fix include paths in foreign.c * libguile/foreign.c: Fix include paths. remove the deprecatd scm_make_subr_* * libguile/deprecated.h: * libguile/deprecated.c (scm_make_subr, scm_make_subr_with_generic) (scm_make_subr_opt): Remove these functions that were deprecated in 2003, as they explicitly reference subr types. 2010-01-04 Andy Wingo dynamic-func returns foreign objects, not bignums * libguile/dynl.c (scm_dynamic_func, scm_dynamic_call) (scm_dynamic_args_call): Change the representation of dynamic functions to be foreign objects. Shouldn't affect any users, as people should be treating the return value of dynamic-func as an opaque object. 2010-01-04 Andy Wingo add foreign value wrapper * libguile/foreign.h: * libguile/foreign.c: New files, implementing simple wrappers around foreign values, such as those that one might link in dynamically from a library. * libguile/tags.h (scm_tc7_foreign): Take a tc7 for foreign values. * libguile.h: * libguile/init.c: Add foreign.h to headers and init. * libguile/print.c (iprin1): Add printer for foreign values. * libguile/gc.c (scm_i_tag_name): Case for foreign values. * libguile/goops.c (scm_class_of, create_standard_classes): Add a class for foreign values. * libguile/evalext.c (scm_self_evaluating_p): Add case for foreign values. * libguile/Makefile.am: Add foreign.[ch] to the build. 2010-01-03 Ludovic Courtès Update `.gitignore'. Add per-directory Emacs local variables. 2010-01-03 Ludovic Courtès Remove dependency on GNU Make and reliance on /usr/bin/env. Both were introduced in commit c55cb58a ("integrate guile-lib docs"). * doc/ref/Makefile.am ($(snarf_doc)scmfiles): Rename target to... ($(snarf_doc)-scmfiles): ... this. Change to generate a makefile snippet containing a variable definition. Automake-include the generated snippet, `standard-library.am'. (EXTRA_DIST): Add `$(snarf_doc).am'. (CLEANFILES): Remove `$(snarf_doc)scmfiles'. * doc/ref/make-texinfo.scm: Remove executable bit and "#!/usr/bin/env". * doc/ref/standard-library.am: New file. 2010-01-03 Andy Wingo rename goto/args and friends to tail-call, tail-apply, etc * libguile/vm-i-system.c (tail-call, tail-call/nargs, tail-apply) (tail-call/cc): Rename these back to tail-* from goto/*. We should reserve the rename-then-goto name for when you actually do a rename and goto, not when you shuffle the stack. * doc/ref/vm.texi: * module/language/glil/decompile-assembly.scm: * module/language/tree-il/compile-glil.scm: * test-suite/tests/tree-il.test: Adapt all callers and documentation. 2010-01-03 Andy Wingo add truncated-print tests * doc/ref/misc-modules.texi (Pretty Printing): Fix an error in truncated-print example. * test-suite/Makefile.am: * test-suite/tests/print.test: Add truncated-print tests. 2010-01-03 Andy Wingo fix bug in generalized-vector->list * libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix bug iterating over indices of array. Thanks to Tristan Colgate for the report. * test-suite/tests/srfi-4.test: Add tests that uniform-vector->list works for all kinds of uniform vectors. 2010-01-03 Julian Graham Support for Unicode string normalization functions * libguile/strings.c, libguile/strings.h (normalize_str, scm_string_normalize_nfc, scm_string_normalize_nfd, scm_normalize_nfkc, scm_string_normalize_nfkd): New functions. * test-suite/tests/strings.test: Unit tests for `string-normalize-nfc', `string-normalize-nfd', `string-normalize-nfkc', and `string-normalize-nfkd'. * doc/ref/api-data.texi (String Comparison): Documentation for normalization functions. 2009-12-29 Andy Wingo cleanups to debugger * module/system/vm/debug.scm (debugger-repl): Remove the `bindings' command, it is superseded by `locals'. Update the TODO. (debug-pre-unwind-handler): Remove scary "beta" warning. Already being able to bt #:width 1000 #:full? #t is quite useful... debugger's backtrace implemented in scheme * module/system/vm/debug.scm (print-locals): Factor out to a function. (collect-frames, print-frames): Implement the guts of `backtrace' in Scheme. (debugger-repl): Add #:width and #:full? options to `backtrace'. Backtrace uses the backtrace code implemented in scheme. frames.c no longer exports frame-source -- frame.scm does so already * libguile/frames.c (scm_frame_source): No longer exported to Scheme via init's call to scm_init_frames; in fact just calls the Scheme version. Perhaps this function is on its way out, though :) ~:@y allows for truncation to an absolute maximum width * module/ice-9/format.scm (format): Allow ~:@y to interpret the width as the maximum width, inclusive of whatever else has already been output. * doc/ref/misc-modules.texi (Formatted Output): Document this. integers at debugger select frames * module/system/vm/debug.scm (debugger-repl): Fix implementation of frame-at-index. Allow integers as commands, as a shorthand for "frame N". 2009-12-29 Andy Wingo clean up (system vm frames), add locals command to debugger * libguile/frames.c (scm_init_frames): No need to bootstrap the VM here, it should be already bootstrapped by init.c. (scm_bootstrap_frames): No need to register an extension, as scm_init_frames is called by init.c. * module/system/vm/frame.scm: Don't load the scm_init_frames extension, as the primitives from frames.c are loaded by Guile's init. (frame-bindings): Change to return bindings, as can be accessed by the binding: accessors from program.scm. (frame-lookup-binding): Revive and make this one work with current code. (frame-binding-set!): (frame-binding-ref): Use the new frame-lookup-binding. Perhaps these should handle boxing and unboxing, though. (frame-source): New accessor, returns a source object. (frame-call-representation): Change to return a full list, as truncated-print can truncate for us. (frame-environment, frame-object-binding, frame-object-name): Update not to take an address, as the address is part of the frame. (frame-variable-exists?, frame-variable-ref, frame-variable-set!) (frame-local-variables, frame-program-name, print-frame) (print-frame-chain-as-backtrace, frame-file, frame-line-number) (make-frame-chain, bootstrap-frame?, frame-number, frame-address): Remove these outdated functions. * module/system/vm/debug.scm (debugger-repl): Use frame-call-representation, and ~@y. (locals): New command, prints local variables in a frame. 2009-12-29 Andy Wingo add ~@y truncated printing directive to format * doc/ref/misc-modules.texi (Formatted Output): Add documentation for the new ~@y format directive. (Pretty Printing): Add documentation for truncated-write. * module/ice-9/format.scm (format): Add ~@y, for doing a truncated print. Also, allow both ~y variants to take a width parameter. 2009-12-29 Andy Wingo add truncated-print to (ice-9 pretty-print) * module/ice-9/pretty-print.scm (pretty-print): Rework so "port" is the kwarg, and "port*" is the optional arg. #:port is still the keyword. (truncated-print): Add a printer that will ensure that the output stays within a certain width. It could use genwrite but it doesn't because it seems nice to allow breadth-first allocation of screen space, and it's also nice to balance some delimiters (e.g. #< and >). 2009-12-29 Andy Wingo fix bug in string array implementation type mask * libguile/strings.c (SCM_ARRAY_IMPLEMENTATION): The mask for the string array implementation should be 0x7f, without masking out 0x2. Otherwise numbers were being thought to be vectors! * test-suite/tests/unif.test: Add test. * libguile/vectors.c (SCM_ARRAY_IMPLEMENTATION): Only register one implementation, because weak vectors can be checked with the mask & ~2, and the functions are the same. 2009-12-29 Michael Gran Add documentation for scm_c_upcase et al * doc/ref/api-data.texi: document scm_c_upcase, scm_c_downcase, scm_c_titlecase, and scm_t_wchar 2009-12-28 Andy Wingo pretty-print is a lambda* * module/ice-9/pretty-print.scm (pretty-print): Fix to always be a define*. Shouldn't change behavior, but it will be more introspectible. fix bug bindings lexical vars within optargs initializers * module/language/tree-il/analyze.scm (analyze-lexicals): Fix bug in which variables bound within inits were being improperly allocated. * module/language/tree-il/compile-glil.scm (vars->bind-list): More detail in terrible debugging clause. * test-suite/tests/optargs.test ("lambda* inits"): Add tests for binding vars within inits. Merge branch 'read-fix' 2009-12-28 Andy Wingo Fix bugs reading long tokens The commit "don't take string-write mutex in read.c:read_token", from 8b0d7b9d94b9f142dc4f08ce12b345321359b3cd, had a number of bugs. Not sure how I missed these before. * libguile/read.c (read_token): Remove a couple of bogus scm_i_string_stop_writing () calls, now that we no longer take the string-write mutex. (read_complete_token): read_token really needs a fresh buffer, which was not the case when we are reading long tokens and thus hit the overflow case. Fixes fractions.test. 2009-12-28 Andy Wingo fix defmacro* * module/ice-9/optargs.scm (defmacro*): Fix implementation -- defmacro* takes Lisp-like arguments. (defmacro*-public): Fix also, expanding into defmacro*. * THANKS: Thanks to Tristan Colgate for the report. * test-suite/tests/optargs.test: Add defmacro* tests. 2009-12-28 Andy Wingo (syntax foo) -> #'foo in boot-9 * module/ice-9/boot-9.scm: Change instances of (syntax foo) to use the reader macro #'. 2009-12-28 Michael Gran Incorrect indexing into character name list When converting a character into a character name, an incorrect character name could theoretically have been returned. * libguile/chars.c (scm_i_charname): used wrong index into scm_alt_charnames 2009-12-28 Neil Jerram Automatic manual updates following libguile docstring changes Affecting the following procedures: * doc/ref/api-compound.texi (Uniform Numeric Vectors): uniform-array-read! * doc/ref/api-data.texi (Complex): make-rectangular, string=?, string?, string>=?, string-ci=?, string-ci?, string-ci>=?, string-append/shared * doc/ref/api-evaluation.texi (Reader Extensions): read-hash-extend * doc/ref/api-procedures.texi (Procedures with Setters): procedure, macro?, macro-type * doc/ref/api-undocumented.texi: module-import-interface, %method-more-specific? * doc/ref/new-docstrings.texi: uniform-array->bytevector, %start-stack, guardian-destroyed?, guardian-greedy?, destroy-guardian!, gc-dump, gc-disable, gc-enable, make-generalized-vector, set-primitive-generic!, nl-langinfo, %warn-autocompilation-enabled, make-syncase-macro, make-extended-syncase-macro, syncase-macro-type, syncase-macro-binding, memoize-expression, unmemoize-expression, memoized-expression-typecode, memoized-expression-data, memoized-typecode, memoize-variable-access!, module-local-variable, module-variable, eval-closure-module, module-transformer, module-public-interface, define!, module-reverse-lookup, cddr, make-promise, %get-stack-size, %string-dump, %symbol-dump, string-bytes-per-char, uniform-vector-element-type, uniform-vector-element-size, canonicalize-path, getrlimit, setrlimit * doc/maint/guile.texi: Corresponding tracking updates. 2009-12-27 Neil Jerram Doc for getsid * NEWS: Note new getsid primitive. * doc/ref/posix.texi (Processes): Document getsid. 2009-12-27 Neil Jerram Add support for getsid * configure.ac: Check availability of getsid() C library call. * libguile/posix.c (scm_getsid): New primitive. * libguile/posix.h: Declaration for new primitive. 2009-12-24 Julian Graham Support for Unicode general categories * libguile/chars.c, libguile/chars.h (scm_char_general_category): New function. * test-suite/tests/chars.test: Unit tests for `char-general-category'. * doc/ref/api-data.texi (Characters): Documentation for `char-general-category'. 2009-12-24 Andy Wingo implement up, down, frame, and bindings in the repl * module/system/vm/debug.scm (debugger-repl): Implement up, down, frame, and bindings using the new command infrastructure. rewrite debugger command loop * module/system/vm/debug.scm: Rewrite the command loop to have better introspection and argument handling. 2009-12-23 Andy Wingo keyword arg errors throw to 'keyword-argument-error * libguile/vm-engine.c (VM_NAME): Keyword arg errors are now thrown to 'keyword-argument-error. * libguile/vm.c: Define sym_keyword_argument_error, and statically allocate some other symbols. * module/ice-9/optargs.scm (parse-lambda-case): Throw to 'keyword-argument-error in kwarg error cases. * module/ice-9/psyntax.scm (build-lambda-case): Remove a couple workarounds for the old memoizer. Throw to 'wrong-number-of-args if the lambda-case fails to parse. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/optargs.test: Update expected exceptions. 2009-12-22 Andy Wingo implement a silly debugger * module/system/vm/debug.scm: Implement the skeleton of a debugger. Not very useful yet. * module/system/repl/repl.scm (call-with-backtrace): Have the pre-unwind hook drop the user into the debugger. Hopefully we can have something better within a couple weeks. 2009-12-22 Andy Wingo fix warning-caught bug in boot-9 * module/ice-9/boot-9.scm: Fix bug caught by warnings. 2009-12-22 Julian Graham Complete support for version information in Guile's `module' form. * module/ice-9/boot-9.scm (try-load-module, try-module-autoload): Check for version argument and use `find-versioned-module' if present. * module/ice-9/boot-9.scm (find-versioned-module, version-matches?) (module-version, set-module-version!, version-matches?): New functions. * module/ice-9/boot-9.scm (module-type, make-module, resolve-module) (try-load-module, process-define-module, make-autoload-interface) (compile-interface-spec): Add awareness and checking of version information. * doc/ref/api-modules.texi (R6RS Version References): New subsubsection. (General Information about Modules): Explain differences in search process when version references are used. (Using Guile Modules) (Creating Guile Modules): Document `#:version' keyword. 2009-12-22 Julian Graham Support for renaming bindings on module export. * module/ice-9/boot-9.scm (module-export!, module-replace!) (module-re-export!): Allow members of export list to be pairs, mapping internal names to external ones. * doc/ref/api-modules.texi (Creating Guile Modules): Update documentation for `#:export', `#:export-syntax', `#:replace', `#:re-export', `#:re-export-syntax', `export', and `re-export' to reflect new format for arguments. 2009-12-22 Julian Graham Improved support for Unicode title case in Guile's string and character APIs. * doc/ref/api-data.texi (Characters): Documentation for `char-titlecase'. * doc/ref/api-i18n.texi (Character Case Mapping): Documentation for `char-locale-titlecase' and `string-locale-titlecase'. * libguile/chars.c, libguile/chars.h (scm_char_titlecase, scm_c_titlecase): New functions. * libguile/i18n.c, libguile/i18n.h (chr_to_case, scm_char_locale_titlecase, str_to_case, scm_string_locale_titlecase): New functions. * libguile/i18n.c (scm_char_locale_downcase, scm_char_locale_upcase, scm_string_locale_downcase, scm_string_locale_upcase): Refactor to share code via chr_to_case and str_to_case, as appropriate. * module/ice-9/i18n.scm (char-locale-title-case, string-locale-titlecase): New functions. * libguile/srfi-13.c (string_titlecase_x): Use uc_totitle instead of uc_toupper. * test-suite/tests/chars.test: Tests for `char-titlecase'. * test-suite/tests/i18n.test: Tests for `char-locale-titlecase' and `string-locale-titlecase'. * test-suite/tests/srfi-13.test: Tests for `string-titlecase'. 2009-12-22 Andy Wingo untabify boot-9.scm * module/ice-9/boot-9.scm: Untabify. 2009-12-21 Andy Wingo tracing at repl * module/system/repl/command.scm (option, trace): Integrate tracing (via ,trace or ,tr). (system vm trace) sorta working * module/system/vm/trace.scm: Update to work with the current VM and its tracing infrastructure. don't take string-write mutex in read.c:read_token * libguile/read.c (read_token): Don't take the string-write mutex when reading a token into a buffer, because it's assumed that the buffer is fresh (not seen by other threads), and a soft port can call a procedure that needs the string-write mutex. 2009-12-21 Andy Wingo rework vm tracing * libguile/vm-engine.c (VM_NAME): Engines take the VM itself (not the vp), so they can pass the VM to hooks. No more hook args, we dispatch without them. * libguile/vm-engine.h (RUN_HOOK): Dispatch the hook if the trace level is positive (instead of if the hook is there). Don't cache registers on return from the dispatch. * libguile/vm.h: * libguile/vm.c (vm_dispatch_hook): Don't bother with a dynwind; instead decrement the trace level when going into a hook, and if we have a nonlocal exit, the trace level never gets incremented again. Worse is better. (make_vm, scm_vm_trace_level, scm_set_vm_trace_level_x): New concept, trace level. If positive, we run the hooks, otherwise we don't. Should work. Removed scm_vm_trace_frame, I don't think that was the right way to do it. * module/system/vm/vm.scm: Replace vm-trace-frame with vm-trace-level and set-vm-trace-level!; the hooks actually get the frame as an argument now. 2009-12-21 Andy Wingo add scm_call_n, scm_c_run_hookn * libguile/eval.h: * libguile/eval.c (scm_call_n): New function, applies a function to an array of args. * libguile/hooks.h: * libguile/hooks.c (scm_c_run_hookn): New function, runs a hook with an array of args. 2009-12-21 Andy Wingo remove "module system quirks" from the manual * doc/ref/api-modules.texi (Module System Quirks): Remove this outdated section. 2009-12-21 Neil Jerram Placeholders for expected remaining Intro sections * doc/ref/intro.texi (Introduction): Add menu entries and sections for `Guile and the GNU Project', `Interactive Programming' and `Supporting Multiple Languages'. More intro text on combining with C code * doc/ref/intro.texi (Combining with C): New paragraph. 2009-12-21 Andy Wingo poor man's statprof integration with the repl: ,pr * module/system/repl/command.scm (profile): Add a very poor integration of statprof with the repl. add test suites integrate guile-lib docs texinfo fixes * module/texinfo.scm (parser-error): Throw to 'parser-error, as ssax's input-parse does. (texi-command-depth): Fix docstring so as not to confuse emacs. (parse-table-args): Fix parser-error call to include port. tweaks to statprof * module/statprof.scm (make-call-data): Change so that call-data holds the proc, not its name. Remove set-call-data-name!. (get-call-data): Adapt caller. (sample-stack-procs): Always sample procedures on the stack, even anonymous ones. (profile-signal-handler): Fix stack cutting to work with compiled statprof.scm. (count-call): Always count calls, even to anonymous procedures. (statprof-call-data->stats): Use call-data-printable for printing the call data. (statprof-display-anomolies): Fix a couple longstanding bugs caught by compiler warnings. 2009-12-21 Andy Wingo import statprof, sxml, and texinfo from guile-lib * module/Makefile.am (LIB_SOURCES): Add statprof, sxml, and texinfo to the build. (NOCOMP_SOURCES): Reindent, and add the upstream SSAX files. * module/statprof.scm: * module/sxml/apply-templates.scm: * module/sxml/fold.scm: * module/sxml/simple.scm: * module/sxml/ssax.scm: * module/sxml/ssax/input-parse.scm: * module/sxml/transform.scm: * module/sxml/upstream/COPYING.SSAX: * module/sxml/upstream/SSAX.scm: * module/sxml/upstream/SXML-tree-trans.scm: * module/sxml/upstream/SXPath-old.scm: * module/sxml/upstream/assert.scm: * module/sxml/upstream/input-parse.scm: * module/sxml/xpath.scm: * module/texinfo.scm: * module/texinfo/docbook.scm: * module/texinfo/html.scm: * module/texinfo/indexing.scm: * module/texinfo/plain-text.scm: * module/texinfo/reflection.scm: * module/texinfo/serialize.scm: * module/texinfo/string-utils.scm: Add files from guile-lib to Guile. It's only Richard, Andreas, Rob, and myself that have copyright on these, and we have all assigned to the FSF. SSAX itself is in the public domain. 2009-12-20 Andy Wingo version.h depends on config.status * libguile/Makefile.am (version.h): Depend on config.status, so if we reconfigure we make sure to regenerate the version. handle interrupts in mv-call, return/values * libguile/vm-i-system.c (mv-call, return/values): Interrupt before entering and leaving MV frames as well as normal frames. remove scm_add_method * libguile/goops.h: * libguile/goops.c (scm_add_method): Remove this function. It didn't work, and even if we fixed it to work it wouldn't be as good as using Scheme's `add-method!'. guile-config depends on config.status * meta/Makefile.am (guile-config): Depend on config.status, so that if $prefix changes, guile-config gets rebuilt. in the load path, look in library-dir before site-dir * libguile/load.c (scm_init_load_path): Search first in Guile's version-specific path (the library path), *then* in the site dir. This should allow us to import some of Guile-lib's modules into Guile, perhaps customizing them with Guile-version-specific foo, without accidentally falling back to system-installed guile-lib in the sitedir. Also should reduce the number of stats by half, in the common case. 2009-12-20 Andy Wingo psyntax's labels and marks now unique over a read/write boundary * module/ice-9/psyntax.scm (gen-label, new-mark): Labels and marks need to be unique across read/write boundaries -- it's not sufficient for them to simply be unique within a process by virtue of (string #\i) constructing a new object. This used to mostly work before, because the collapsing of duplicate constants didn't catch many syntax-object cases -- but for some reason the attached test case brings out the problem. So switch to use gensyms. Potentially more costly, but it's what upstream psyntax does now. This bug took me fully two days to figure out. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("serializable labels and marks"): Add test case. 2009-12-20 Neil Jerram Typo and formatting * doc/ref/intro.texi (Introduction): "onScheme" -> "on Scheme". Add blank lines around @itemize block - looks better in Info. 2009-12-20 Neil Jerram Remove obsolete and empty Tcl/Tk file * doc/ref/Makefile.am (guile_TEXINFOS): Remove tcltk.texi. * doc/ref/tcltk.texi: Deleted. 2009-12-20 Neil Jerram More about Guile's relationship to Scheme standards Also continue adding a bit more structure to the introductory "what is Guile" material. * doc/ref/intro.texi (Introduction): Split `What is Guile?' (which is a bad heading, since we've already answered that...) into `Guile and Scheme' and `Combining with C'. Further splits will follow, to cover the other toplevel bullet points. (Guile and Scheme): Remove `packaged for use in a wide variety of environments', as I don't see what this can mean to the reader at this point. Add text about R6RS and SRFIs. 2009-12-20 Neil Jerram Format `Revised^n' more nicely in TeX * doc/ref/intro.texi (Introduction): Format Revised^n differently for TeX. 2009-12-19 Neil Jerram Document need for pkg-config to build Guile * README: Say that ./configure needs pkg-config; why; and how to work around it. 2009-12-19 Neil Jerram New introductory text about Guile * doc/ref/guile.texi (Top): Rename `Introduction to Guile' as just `Introduction'. * doc/ref/intro.texi: Add new introductory text. [Not yet complete] * doc/ref/preface.texi (Preface): Update for chapter renaming. 2009-12-19 Neil Jerram Move Conventions section to after `Reporting Bugs' (Reporting Bugs fits better immediately after the tour of how to use Guile) * doc/ref/intro.texi: Move `Manual Conventions' to after `Reporting Bugs', and rename to `Typographical Conventions'. 2009-12-19 Neil Jerram Move "Discouraged and Deprecated" from Introduction to API chapter * doc/ref/intro.texi (Discouraged and Deprecated): Move from here... * doc/ref/api-discdepr.texi: ...to new file here. * doc/ref/guile.texi: Include api-discdepr.texi, and include `Discouraged and Deprecated' in API chapter menu. * doc/ref/Makefile.am (guile_TEXINFOS): Add api-discdepr.texi. 2009-12-19 Neil Jerram Remove page breaks except before new chapters and indices * doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-data.texi, doc/ref/api-debug.texi, doc/ref/api-evaluation.texi, doc/ref/api-i18n.texi, doc/ref/api-io.texi, doc/ref/api-memory.texi, doc/ref/api-modules.texi, doc/ref/api-options.texi, doc/ref/api-overview.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-smobs.texi, doc/ref/api-translation.texi, doc/ref/api-utility.texi, doc/ref/expect.texi, doc/ref/libguile-concepts.texi, doc/ref/libguile-program.texi, doc/ref/misc-modules.texi, doc/ref/repl-modules.texi, doc/ref/scheme-debugging.texi, doc/ref/scheme-reading.texi, doc/ref/scheme-scripts.texi, doc/ref/script-getopt.texi, doc/ref/scsh.texi, doc/ref/srfi-modules.texi: Remove @page before @section. Remove obsolete material about GH * doc/ref/extend.texi: Delete. 2009-12-19 Neil Jerram Streamline the manual's Preface material (The principle here is that Preface should only contain meta-information about the manual, such as how to use it and who wrote it; plus any political points that we want to draw attention to.) * doc/ref/preface.texi (Preface): Make unnumbered, for consistency with other GNU manuals (e.g. Emacs, GSL). Merge layout text into top level. Simplify first sentence. Move section on conventions away... * doc/ref/intro.texi (Introduction to Guile): ...to here. 2009-12-18 Neil Jerram Update and simplify statement about RnRS support * doc/ref/scheme-intro.texi (Guile Scheme): Mention R6RS as well as R5RS. Simplify text. 2009-12-18 Brian Gough make the use of the 5-argument @xref command consistent A few of the @xref references to external manuals in the documentation are using an old 4-argument form that produces an undefined reference in the printed manual. The following patch makes them consistent with the 5-argument @xrefs used elsewhere in the manual. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 6ca0417830dc5a98699a15808591dc1f2a90dfac Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 14 Dec 2009 21:34:59 +0000 Subject: [PATCH] make the use of the 5-argument @xref command consistent when referring to other manuals. 2009-12-18 Ken Raeburn Allow more characters in coding system names in Emacs-style declarations. * libguile/read.c (scm_i_scan_for_encoding): Allow more punctuation symbols in coding system names. 2009-12-18 Brian Gough more typo fixes More spelling corrections and fixes for doubled words (e.g. "the the") -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 7be02beedc739c32cce2c8ec8f4ac814c994a13f Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 14 Dec 2009 22:06:22 +0000 Subject: [PATCH] fix various documentation typos (spelling & doubled words) 2009-12-18 Brian Gough typo fix Correction for garbled sentence. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From f819b597a46ad4ed23597e5a81d1acab46f15147 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 14 Dec 2009 20:04:34 +0000 Subject: [PATCH] typo fix 2009-12-18 Brian Gough added brief introduction about SLIB This patch adds a short introduction to the SLIB section of the manual with a link to the SLIB homepage. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 60548b6e039bf57694b7841996cfda011cb8a4bf Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 14 Dec 2009 20:49:27 +0000 Subject: [PATCH] added brief introduction about SLIB 2009-12-18 Brian Gough Hash Table examples - hashq takes different number of arguments In the "Hash Tables Example" in the manual, hashq needs 2 arguments instead of 1 (patch below). I've updated the hash table output as well to match the current version. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From fdb6101d2e064620746ebfc9f9cd28bbdd2470e8 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Mon, 14 Dec 2009 19:59:32 +0000 Subject: [PATCH] update docs for Hash Table Examples hashq now takes two arguments order of elements in hash table is different now 2009-12-18 Brian Gough replace ascii figures with scalable ps/pdf versions. use ascii figures in HTML output, to work around deficiency in makeinfo where images are not copied to target directory. use explicit ./scriptname to help novice users use correct url to ftp.gnu.org 2009-12-15 Ludovic Courtès Bump version number for 1.9.6. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Remove unneeded #include . * libguile/backtrace.c, libguile/eval.c, libguile/gc.c, libguile/goops.c, libguile/memoize.c, libguile/threads.c, libguile/uniform.c, libguile/vm.c, test-suite/standalone/test-conversion.c, test-suite/standalone/test-list.c: Don't include . 2009-12-15 Ludovic Courtès Use Gnulib's `sys_stat' module; update Gnulib. * .x-sc_prohibit_S_IS_definition: New file. * m4/gnulib-cache.m4: Add `sys_stat'. * libguile/filesys.c: Remove `S_IS*' macro definitions for Ultrix and MinGW. 2009-12-15 Ludovic Courtès Remove obsolete test-suite makefile snippets. * test-suite/Makefile.am (SCM_TESTS_DIRS): Remove. (dist-hook): Remove target. Disable thread-local storage on Solaris 8. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Special-case `*solaris2.8'. Change the Elisp compiler from GPLv2+ to LGPLv3+. * module/language/elisp/bindings.scm, module/language/elisp/lexer.scm, module/language/elisp/parser.scm, module/language/elisp/runtime.scm, module/language/elisp/runtime/function-slot.scm, module/language/elisp/runtime/macro-slot.scm, module/language/elisp/runtime/value-slot.scm: Switch from GPLv2+ to LGPLv3+; fix copyright year. Use portable shell in `meta/uninstalled-env'. * meta/uninstalled-env.in: Don't use the `-q' and `-E' options, which are specific to GNU grep. Don't set-and-export environment variables at once since this is a GNU Bash extension. Use the right `grep' command. * libguile/Makefile.am (.c.i): Use $(GREP), not `grep'. (check_signals, check_errnos): Use $(EGREP), not `egrep'. Remove GNU Make-specific function call. * libguile/Makefile.am (c-tokenize.$(OBJEXT)): Remove use of GNU Make's `filter-out' function. Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' & co. * libguile/bitvectors.c, libguile/srfi-4.c, libguile/strings.c, libguile/vectors.c: Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' and `SCM_VECTOR_IMPLEMENTATION' invocations. Remove extraneous functions from `AC_REPLACE_FUNCS'. * configure.ac: Remove `inet_aton' and `putenv' from `AC_REPLACE_FUNCS'. 2009-12-15 Ludovic Courtès Avoid `SCM_UNPACK ()' in constant expressions. They made Sun C 5.8 emit a warning such as: line 71: warning: dead part of constant expression is nonconstant * libguile/print.c (scm_print_opts): Don't use `SCM_UNPACK ()' here. * libguile/read.c (scm_read_opts): Likewise. 2009-12-15 Ludovic Courtès Remove `return' from `void' function. * libguile/print.c (scm_print_symbol_name): Remove `return' statement. 2009-12-15 Ludovic Courtès Don't use GCC zero-length arrays. * libguile/frames.c, libguile/objcodes.c, libguile/programs.c, libguile/vm-engine.c, libguile/vm-i-system.c, libguile/vm.c: Use `SCM_C_OBJCODE_BASE ()' instead of accessing the `base' field of `struct scm_objcode'. * libguile/objcodes.h (struct scm_objcode)[base]: Remove. 2009-12-15 Ludovic Courtès Remove uses of the non-standard `__FUNCTION__'. * libguile/gc.c (scm_gc_sweep): Replace `__FUNCTION__' by `FUNC_NAME'. * libguile/read.c (scm_read_r6rs_block_comment): Likewise. 2009-12-15 Andy Wingo expose frame-previous, once again * libguile/frames.h: * libguile/frames.c (scm_frame_previous): Rename from scm_c_frame_prev, and expose to Scheme. Skip boot frames. * libguile/stacks.c (stack_depth, narrow_stack, scm_make_stack) (scm_stack_ref): Adjust for scm_frame_previous skipping boot frames. 2009-12-14 Ludovic Courtès Fix test environment issue with ltdl from Libtool 2.2.6b. Earlier versions of ltdl would look for extensions under $PWD; this behavior changed in 2.2.6b. * test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Define $builddir. * test-suite/standalone/test-asmobs: Specify the full path to `libtest-asmobs', using $builddir. * test-suite/standalone/test-extensions: Likewise. 2009-12-13 Andy Wingo more NEWS updates * NEWS: Update some more. 2009-12-13 Andy Wingo primitive-eval passes first N args on stack directly, not via apply * libguile/memoize.c (MAKMEMO_CALL): Memoize in the number of arguments at the call site. (memoize, scm_m_cond, memoize_named_let, unmemoize): * libguile/eval.c (eval): Adapt to changes in call memoization. * module/ice-9/eval.scm (primitive-eval): For calls, pass the first N arguments directly on the stack, and only the rest as a consed argument list to apply. Currently N is 4. 2009-12-13 Andy Wingo interpreted closures cons less. * module/ice-9/eval.scm (primitive-eval): When making a closure with N formals, actuall return a closure with N formals, if N is less than *max-static-argument-count*, which currently is 8. If N is greater than 8, do the arg-parsing loop as we did before. Requires some macrology, but should reduce unnecessary consing for interpreted closures. * test-suite/tests/goops.test: * test-suite/tests/hooks.test: Now that checks like (thunk? foo) are going to work as a for interpreted code, remove some (throw 'unresolved). 2009-12-12 Andy Wingo commit draft of NEWS lame tweak to the inliner * module/language/tree-il/inline.scm: Tweak to avoid a (if #t #t #f). Yes, it's lame. prepare NEWS for 1.9.6 * NEWS: Prepare NEWS for 1.9.6. 2009-12-11 Ludovic Courtès Tweak the "unused modules are removed" test. * test-suite/tests/gc.test ("gc")["unused modules are removed"]: Add loop to clean up stale references from the stack. SRFI-1: Use the built-in optional argument support. * module/srfi/srfi-1.scm (iota, unfold, unfold-right, alist-delete, alist-delete!): Use `define*' and optional arguments instead of rest arguments. Fix expansion of `(+ 1 x)'. * module/language/tree-il/primitives.scm (+): Fix typo. Typo. * test-suite/Makefile.am (SCM_TESTS): Fix typos: `.text' -> `.test'. SRFI-9: Make accessors inlinable. * module/srfi/srfi-9.scm (define-inlinable): New macro. (define-record-type): Use it. SRFI-9: Reimplement in terms of structs, using `syntax-case'. * module/srfi/srfi-9.scm (define-record-type): Rewrite to use raw structs instead of records. Use `syntax-case' instead of `define-macro'. 2009-12-11 Ludovic Courtès Add struct & vector benchmarks. * benchmark-suite/benchmarks/structs.bm, benchmark-suite/benchmarks/vectors.bm: New files. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add. * benchmark-suite/benchmarks/bytevectors.bm: Fix copyright. 2009-12-11 Ludovic Courtès Add opcodes for `struct?', `struct-vtable', and `make-struct'. * libguile/vm-engine.c (VM_NAME)[vm_error_not_a_struct]: New label. * libguile/vm-i-scheme.c (VM_VALIDATE_STRUCT): New macro. (struct_p, struct_vtable, make_struct): New instructions. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add `struct?', `struct-vtable', and `make-struct'. * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Likewise. 2009-12-11 Andy Wingo vm no longer measures bogoclock or times, relies on os for that * libguile/vm.h (struct scm_vm): Remove "time" and "clock" members. The time was bogusly measured, and the "clock" measured instructions retired, which is not a very useful measurement, and it was causing lots of memory accesses. Not that I have done a proper profile, though... (scm_vm_stats): Remove this procedure, which provided access to "time" and "clock". * libguile/vm.c: * libguile/vm-engine.h: * libguile/vm-engine.c: * libguile/vm-i-system.c: Adapt to scm_vm changes and scm_vm_stats removal. * module/system/repl/command.scm: * module/system/vm/vm.scm: Adapt to vm-stats removal by removing vm-stats from . 2009-12-11 Andy Wingo inline calls to (memv foo CONSTANT-LIST) * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Recognize memv and memq as well. * module/language/tree-il/inline.scm (inline!): Inline calls to memq and memv where the list is a constant. 2009-12-11 Andy Wingo rename then and else to consequent and alternate * module/language/tree-il.scm (): Rename the "then" and "else" clauses of to "consequent" and "alternate". More verbose, yes, but that way we avoid unexpected behavior with "else". (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold): (make-tree-il-folder, post-order!, pre-order!) * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (flatten): * module/language/tree-il/fix-letrec.scm (simple-expression?): Update callers. 2009-12-11 Andy Wingo rename lambda-case-else to lambda-case-alternate * module/language/tree-il.scm (): Rename the "else" field of to "alternate". Conflicts less with the "else" keyword as used by case, cond, record-case, pmatch, etc. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold) (make-tree-il-folder, post-order!, pre-order!): Adapt traversal operators for change. * module/language/tree-il/analyze.scm (analyze-lexicals) (validate-arity): * module/language/tree-il/compile-glil.scm (flatten): * module/language/tree-il/inline.scm (inline!): Adapt for change. 2009-12-11 Andy Wingo vm: handle interrupts on backwards jumps * libguile/vm-i-system.c (BR, br): Handle interrupts on backwards jumps, so we can Ctrl-C an endless loop. less overhead for handling interrupts in the vm * libguile/__scm.h (SCM_ASYNC_TICK): Add some branch prediction. (SCM_ASYNC_TICK_WITH_CODE): New helper for when BUILDING_LIBGUILE, runs code only if we're going to call async_click(). * libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): New helper, uses SCM_ASYNC_TICK_WITH_CODE to only save regs if we'll handle an interrupt. * libguile/vm-i-system.c (call, goto/args, return): use VM_HANDLE_INTERRUPTS. 2009-12-11 Andreas Rottmann add partial support for tail patterns in syntax-rules/syntax-case I've prepared a patch that adds partial support for tail patterns. Things like the the SRFI-34 `guard' macro from [0] are supported, but you still can't combine dotted patterns with tail patterns, e.g. (syntax-rules (else) ((foo bar ... (else something) . rest) )) will *not* work; there's the issue that one can't just transcribe the implementation of this feature from the latest version of psyntax, as I've done for non-dotted tail patterns, as it's implemented using a dotted pattern like the above. Alas! [0] * module/ice-9/psyntax.scm (syntax-case, $sc-dispatch): Add support for tail patterns, transcribed from the latest psyntax. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test: Add tests for tail patterns. 2009-12-11 Andy Wingo merge from master to elisp * module/language/elisp/compile-tree-il.scm: Update for changes to tree-il (lambda-case, mainly). * module/language/elisp/spec.scm: Update GPL version to 3. Update reader for new taking a port and environment argument. * libguile/_scm.h: Bump objcode version. * libguile/vm-i-system.c: Fix conflicts. * module/Makefile.am: Fix conflicts, and add elisp modules to the build. 2009-12-10 Andy Wingo add ice-9/quasisyntax.scm to NOCOMP_SOURCES * module/Makefile.am (NOCOMP_SOURCES): Add quasisyntax.scm. fix emission of meta procedures * module/language/glil/compile-assembly.scm: Fix the check for when to emit a "meta" procedure. Fixes http://thread.gmane.org/gmane.lisp.guile.user/7469/focus=7470. if we have no eval.go, load no .go * libguile/load.c (scm_init_eval_in_scheme): If we have no eval.go, null out the load-compiled path so that we load no compiled code. Prevents partially compiled Guile from turning tail-calls into stack-munching calls. add gbt macro to gdbinit, and fix a bug in program-arity * gdbinit: Add gbt macro, to make a Guile backtrace whenever you want. * module/system/vm/program.scm (program-arity): If ip is #f, just take the first arity. 2009-12-09 Andy Wingo fix arbiter compilation with the generic codepath * libguile/arbiters.c (scm_try_arbiter, scm_release_arbiter): Fix for the generic case; not sure why it wasn't working. fix FUNC_NAME of scm_memoize_variable_access_x * libguile/memoize.c (scm_memoize_variable_access_x): Fix FUNC_NAME definition. 2009-12-08 Andy Wingo add SCM_SMOB_TYPE_BITS and SCM_SMOB_TYPE_MASK * libguile/smob.h (SCM_SMOB_TYPE_BITS, SCM_SMOB_TYPE_MASK): New macros, for when you want to identify a SMOB by type and mask. * libguile/arrays.c: * libguile/bitvectors.c: * libguile/srfi-4.c: Use the new macros. 2009-12-08 Andy Wingo fix SCM_CELL macro usage. * libguile/vm.h (SCM_VM_CONT_DATA): Fix SCM_CELL macro usage. SCM_CELL in throw.c * libguile/throw.c (JBACTIVE, ACTIVATEJB, DEACTIVATEJB, JBJMPBUF) (SETJBJMPBUF, SCM_JBPREUNWIND, SCM_SETJBPREUNWIND) (pre_unwind_data_print, scm_ithrow): Fix SCM_CELL macro usage. SCM_VALIDATE_SMOB uses SCM_SMOB_PREDICATE * libguile/validate.h (SCM_VALIDATE_SMOB): Change to use SCM_SMOB_PREDICATE instead of SCM_TYP16_PREDICATE. SCM_CELL in srfi-4.c * libguile/srfi-4.c (SCM_UVEC_TYPE, SCM_UVEC_LENGTH, SCM_UVEC_BASE): Fix SCM_CELL macro usage. SCM_CELL in srcprop.c * libguile/srcprop.c (SRCPROPPOS, SRCPROPCOPY, SRCPROPALIST) (SETSRCPROPPOS, SETSRCPROPCOPY, SETSRCPROPALIST): Fix erroneous SCM_CELL macro usage. use the new public metatables from struct.c * libguile/procs.c (scm_init_procs): No need to lookup the applicable-struct-with-setter vtable, as it is now exported. scm_i_alloc_struct does not take a "what" arg * libguile/struct.h: * libguile/struct.c (scm_i_alloc_struct): Change to not take a "what" argument. Callers changed. reserve a vtable flag for smobs. * libguile/struct.h (SCM_VTABLE_FLAG_SMOB_0): Reserve a vtable flag for smobs. add vtable finalizer and printer setter macros * libguile/struct.h (SCM_VTABLE_INSTANCE_FINALIZER): Use DATA_REF, not SLOT_REF. (SCM_SET_VTABLE_INSTANCE_FINALIZER, SCM_SET_VTABLE_INSTANCE_PRINTER): New accessor macros. make some applicable struct vtable-vtable public to C * libguile/struct.h (scm_standard_vtable_vtable) (scm_applicable_struct_vtable_vtable) (scm_applicable_struct_with_setter_vtable_vtable) * libguile/struct.c: Make these stock meta-tables public to C. SCM_CELL in modules.c * libguile/modules.c (SCM_F_EVAL_CLOSURE_INTERFACE) (SCM_EVAL_CLOSURE_INTERFACE_P, scm_standard_interface_eval_closure): Fix to not use SCM_CELL macros. initialize smobs after structs * libguile/init.c (scm_i_init_guile): Move SMOB prehistory after structs init. No effect for now. SCM_CELL in guardians.c * libguile/guardians.c (GUARDIAN_DATA): Fix SCM_CELL macro usage. SCM_CELL in filesys.[ch] * libguile/filesys.h (SCM_DIR_FLAG_OPEN, SCM_DIR_OPEN_P) * libguile/filesys.c (scm_readdir, scm_rewinddir, scm_closedir) (scm_dir_print, scm_dir_free): Fix SCM_CELL macro usage. SCM_CELL in deprecated.c * libguile/deprecated.c (scm_smob_free): Fix SCM_CELL macro usage. fix SCM_CELL macro usage in continuations.[ch] * libguile/continuations.h (SCM_CONTREGS): * libguile/continuations.c (continuation_print): Fix SCM_CELL macro usage. fix SCM_CELL_* macro usage in async.c * libguile/async.c (ASYNC_GOT_IT, SET_ASYNC_GOT_IT, ASYNC_THUNK): Fix SCM_CELL_* macro usage. fix SCM_CELL_* macro usage in arbiters.c * libguile/arbiters.c (scm_try_arbiter, scm_release_arbiter): Fix erroneous SCM_CELL_* macro usage. fix erroneous SCM_CELL_* usage in arrays.[ch] * libguile/arrays.h (SCM_I_ARRAY_FLAG_CONTIGUOUS, SCM_I_ARRAY_NDIM): (SCM_I_ARRAY_CONTP, SCM_I_ARRAY_MEM): * libguile/arrays.c (SCM_SET_ARRAY_CONTIGUOUS_FLAG): (SCM_CLR_ARRAY_CONTIGUOUS_FLAG): Fix macros to use SCM_SMOB macros instead of SCM_CELL macros. 2009-12-08 Andy Wingo clean up smob macro implementation * libguile/smob.h: Regularize the SCM_SMOB macros, and make them all go through some generic SMOB accessor macros. * libguile/smob.c (scm_i_set_smob_flags): Remove, as it is unused. 2009-12-07 Andy Wingo add scm_c_make_struct[v] * libguile/struct.h (scm_c_make_struct, scm_c_make_structv): New functions with which you can make a struct without consing a rest list. * libguile/struct.c (scm_struct_init): Refactor to take an array of init values, not a list. (scm_make_struct, scm_make_vtable_vtable): Pull the rest arg out into a list and pass it down to the new array-taking functions. * libguile/memoize.c: Remove a neeless #include . 2009-12-07 Andy Wingo procedures-with-setters implemented in terms of structs * libguile/tags.h (scm_tc7_pws): No more. * libguile/procs.c (scm_procedure_with_setter_p) (scm_make_procedure_with_setter, scm_procedure, scm_setter): Implement procedures-with-setters in terms of applicable structs with setters. * libguile/procs.h: Remove a big, outdated comment, and the deprecated macros. * libguile/deprecated.h (SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE) (SCM_SETTER): Deprecate these. SCM_PROCEDURE and SCM_SETTER are bad names. * libguile/evalext.c (scm_self_evaluating_p): * libguile/gc.c (scm_i_tag_name): * libguile/goops.c: (scm_class_of): * libguile/print.c (iprin1): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p): * libguile/debug.c (scm_procedure_source): Remove a tc7_pws case. * libguile/goops.h: * libguile/goops.c (scm_class_procedure_with_setter): Remove this class; it is subsumed by applicable_struct_with_setter. * libguile/struct.h: Update a comment. * libguile/vm-i-system.c (call, goto/args, mv-call): Remove PWS cases. 2009-12-05 Andy Wingo structs are alive early in guile's boot * libguile/init.c (scm_i_init_guile): Reorder deps so structs are initialized early in the boot process. more annotations to scm_i_init_guile * libguile/init.c (scm_i_init_guile): Annotate things that need smobs. 2009-12-05 Andy Wingo decruftify scm_sys_protects * libguile/root.h * libguile/root.c (scm_sys_protects): It used to be that for some reason we'd define a special array of "protected" values. This was a little silly, always, but with the BDW GC it's completely unnecessary. Also many of these variables were unused, and none of them were good API. So remove this array, and either eliminate, make static, or make internal the various values. * libguile/snarf.h: No need to generate calls to scm_permanent_object. * guile-readline/readline.c (scm_init_readline): No need to call scm_permanent_object. * libguile/array-map.c (ramap, rafe): Remove the dubious nullvect optimizations. * libguile/async.c (scm_init_async): No need to init scm_asyncs, it is no more. * libguile/eval.c (scm_init_eval): No need to init scm_listofnull, it is no more. * libguile/gc.c: Make scm_protects a static var. (scm_storage_prehistory): Change the sanity check to use the address of protects. (scm_init_gc_protect_object): No need to clear the scm_sys_protects, as it is no more. * libguile/keywords.c: Make the keyword obarray a static var. * libguile/numbers.c: Make flo0 a static var. * libguile/objprop.c: Make object_whash a static var. * libguile/properties.c: Make properties_whash a static var. * libguile/srcprop.h: * libguile/srcprop.c: Make scm_source_whash a global with internal linkage. * libguile/strings.h: * libguile/strings.c: Make scm_nullstr a global with internal linkage. * libguile/vectors.c (scm_init_vectors): No need to init scm_nullvect, it's unused. 2009-12-05 Andy Wingo further boot cleanups * libguile/srfi-14.c (define_charset): * libguile/deprecated.c (scm_create_hook): Don't bother making the returned objects (hooks or charsets) into permanent objects; they are already defined, and then the caller probably stores them away too. * libguile/init.c (scm_i_init_guile): Add a couple annotations. 2009-12-05 Andy Wingo more boot cleanup * libguile/bytevectors.c (scm_bootstrap_bytevectors): Remove a call to scm_gc_protect_object. * libguile/gc.h: * libguile/gc.c (scm_init_gc_protect_object): Rename from scm_init_storage, and just return void. Make the GC boot procs have internal linkage. * libguile/init.c: Adapt to the name change. 2009-12-05 Andy Wingo remove a bunch of needless scm_permanent_object calls * libguile/array-handle.c: * libguile/bytevectors.c: * libguile/deprecated.c: * libguile/eval.c: * libguile/feature.c: * libguile/filesys.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/goops.c: * libguile/instructions.c: * libguile/load.c: * libguile/modules.c: * libguile/numbers.c: * libguile/options.c: * libguile/ports.c: * libguile/scmsigs.c: * libguile/srcprop.c: * libguile/srfi-4.c: * libguile/stacks.c: * libguile/threads.c: * libguile/vm.c: Remove calls to scm_permanent_object, as they are no longer needed with the BDW GC. 2009-12-05 Andy Wingo some scm_i_init_guile cleanups * libguile/init.c (scm_i_init_guile): Since hash tables are tc7 objects, things that depend on hash tables no longer depend on smobs, so move smob_prehistory up a bit. No more struct_prehistory. * libguile/struct.h: * libguile/struct.c (scm_struct_prehistory): Remove empty function. 2009-12-05 Andy Wingo remove scm_ports_prehistory * libguile/ports.h: * libguile/ports.c (scm_ports_prehistory): Remove this function. Just initialize global vars to NULL/0 instead of needing a prehistory function. add printer for dynamic-states * libguile/fluids.c: * libguile/fluids.h: * libguile/print.c: Add dynamic-state printing infrastructure. 2009-12-05 Andy Wingo fluids are tc7 objects If you're wondering what I'm doing, I'm trying to eventually reimplement smobs in terms of structs, so that applicable smobs can just follow the applicable struct dispatch path. But to do that I have to get structs initialized before things that use smobs, which means transforming a bunch of smobby things to tc7 things. But this transformation is good for performance anyway, and we currently have a glut of unused tc7s, so here we go... * libguile/tags.h (scm_tc7_fluid, scm_tc7_dynamic_state): Fluids (and dynamic states) now have tc7s. * libguile/fluids.h: Remove scm_fluids_prehistory, and add internal scm_i_fluid_print. Update a comment. * libguile/fluids.c: Update for tc7 representation. Also remove the next pointers while we're at it, as they aren't used in the new BDW GC. * libguile/eq.c (scm_equal_p): Remove the hashtable case. Hashtables could never be equal? before, I don't see why to add stubs doing the same thing now. * libguile/print.c (iprin1): * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): Add fluid and dynamic_state cases. * libguile/goops.h: Remove scm_class_hashtable; it will be static. * libguile/goops.c: Make static, and add and classes. * libguile/hashtab.h: * libguile/hashtab.c: Remove scm_i_hashtable_equal_p. * libguile/init.c (scm_i_init_guile): Remove call to fluids_prehistory. 2009-12-05 Andy Wingo hash tables have a tc7 * libguile/tags.h (scm_tc7_hashtable): Allocate a tc7 for hashtables. * libguile/hashtab.h: Adjust macros accordingly. (scm_i_hashtable_print, scm_i_hashtable_equal_p): New internal functions. (scm_hashtab_prehistory): Remove, no more need for this. * libguile/hashtab.c (scm_hash_fn_remove_x): Fix a longstanding bug. (make_hash_table): Adapt to the new hash table representation. * libguile/eq.c (scm_equal_p) * libguile/evalext.c (scm_self_evaluating_p) * libguile/print.c (iprin1) * libguile/gc.c (scm_i_tag_name): Add some tc7_hashtab cases. * libguile/init.c: Remove unused environments init functions. Remove call to hashtab_prehistory. * libguile/goops.h (scm_class_hashtable) * libguile/goops.c (scm_class_of, create_standard_classes): Have to make a class for hash tables manually, because they aren't smobs any more. 2009-12-04 Andy Wingo eval.c closures are now applicable smobs, not tc3s * libguile/debug.c (scm_procedure_name): Remove a SCM_CLOSUREP case and some dead code. (scm_procedure_module): Remove. This was introduced a few months ago for the hygienic expander, but now it is no longer needed, as the expander keeps track of this information itself. * libguile/debug.h: Remove scm_procedure_module. * libguile/eval.c: Instead of using tc3 closures, define a "boot closure" applicable smob type, and represent closures with that. The advantage is that after eval.scm is compiled, boot closures take up no address space (besides a smob number) in the runtime, and require no special cases in procedure dispatch. * libguile/eval.h: Remove the internal functions scm_i_call_closure_0 and scm_closure_apply, and the public function scm_closure. * libguile/gc.c (scm_storage_prehistory): No tc3_closure displacement registration. (scm_i_tag_name): Remove closure case, and a dead cclo case. * libguile/vm.c (apply_foreign): * libguile/print.c (iprin1): * libguile/procs.c (scm_procedure_p, scm_procedure_documentation); * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): Remove tc3_closure/tcs_closure cases. * libguile/hash.c (scm_hasher): * libguile/hooks.c (scm_add_hook_x): Use new scm_i_procedure_arity. * libguile/macros.c (macro_print): Print all macros using the same code. (scm_macro_transformer): Return any procedure, not just programs. * libguile/procprop.h: * libguile/procprop.c (scm_i_procedure_arity): Instead of returning a list that the caller has to parse, have the same prototype as scm_i_program_arity. An incompatible change, but it's an internal function anyway. (scm_procedure_properties, scm_set_procedure_properties) (scm_procedure_property, scm_set_procedure_property): Remove closure cases, and use scm_i_program_arity for arity. * libguile/procs.h (SCM_CLOSUREP, SCM_CLOSCAR, SCM_CODE) (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS) (SCM_CLOSURE_BODY, SCM_PROCPROPS, SCM_SETPROCPROPS, SCM_ENV) (SCM_TOP_LEVEL): Remove these macros that pertain to boot closures only. Only eval.c should know abut boot closures. * libguile/procs.c (scm_closure_p): Remove this function. There is a simple stub in deprecated.scm now. (scm_thunk_p): Use scm_i_program_arity. * libguile/tags.h (scm_tc3_closure): Remove. Yay, another tc3 to play with! (scm_tcs_closures): Remove. * libguile/validate.h (SCM_VALIDATE_CLOSURE): Remove. * module/ice-9/deprecated.scm (closure?): Add stub. * module/ice-9/documentation.scm (object-documentation) * module/ice-9/session.scm (help-doc, arity) * module/oop/goops.scm (compute-getters-n-setters) * module/oop/goops/describe.scm (describe) * module/system/repl/describe.scm (display-object, display-type): Remove calls to closure?. 2009-12-04 Andy Wingo remove cxrs * libguile/pairs.h: * libguile/pairs.c: Previously scm_cdadr et al were implemented as #defines that called scm_i_chase_pairs, and the Scheme-exposed functions themselves were cxr subrs, which got special help in the interpreter. Since now the special help is unnecessary (because the compiler inlines and expands calls to car, cdadr, etc), the complexity is a loss. So just implement cdadr etc using normal functions. There's an advantage too, in that the compiler can unroll the cxring, reducing branches. * libguile/tags.h (scm_tc7_cxr): Remove this tag. (scm_tcs_subrs): Now there's only one kind of subr, yay! * libguile/debug.c (scm_procedure_name) * libguile/evalext.c (scm_self_evaluating_p) * libguile/gc.c (scm_i_tag_name) * libguile/goops.c (scm_class_of) * libguile/hash.c (scm_hasher) * libguile/print.c (iprin1) * libguile/procprop.c (scm_i_procedure_arity) * libguile/procs.c (scm_procedure_p, scm_subr_p) (scm_make_procedure_with_setter) * libguile/vm.c (apply_foreign): Remove cxr cases. Replace uses of scm_tcs_subrs with scm_tc7_gsubr. 2009-12-04 Andy Wingo remove rpsubrs * libguile/tags.h: Remove rpsubrs (I chose to interpret the terse name as "recursive predicate subrs"). Just use gsubrs with rest arguments, or do a fold yourself. * libguile/array-map.c (scm_i_array_equal_p): Do the comparison in order, why not. * libguile/chars.c: * libguile/eq.c: * libguile/numbers.c: * libguile/strorder.c: Add 0,2,1 gsubr wrappers for rpsubrs like eq?, <, etc. * libguile/goops.c (scm_class_of) * libguile/procprop.c (scm_i_procedure_arity) * libguile/procs.c (scm_thunk_p) * libguile/vm.c (apply_foreign): Remove rpsubr cases. * test-suite/tests/numbers.test ("=", "<"): Turn a couple xfails into passes. 2009-12-03 Andy Wingo remove asubrs * libguile/tags.h (scm_tcs_subrs, scm_tc7_asubr): Remove definitions. * libguile/goops.c (scm_class_of) * libguile/procprop.c (scm_i_procedure_arity) * libguile/procs.c (scm_thunk_p) * libguile/vm.c (apply_foreign): Remove cases for asubrs. * libguile/array-map.c: Gut all of the optimizations, because there are no more asubrs, soon won't be rpsubrs, and all of this should happen on the Scheme level, ideally. 2009-12-03 Andy Wingo speed up scm_call_N for non-programs * libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3): All of these should dispatch through the VM, without consing. simplify apply_foreign * libguile/vm.c (apply_foreign): Simplify. +, -, min, lcm, gcd now documented * test-suite/tests/numbers.test: Change some xfail documented? tests to passes. change asubrs to be gsubrs * libguile/numbers.h: * libguile/numbers.c (scm_i_gcd, scm_i_lcm, scm_i_logand, scm_i_logior) (scm_i_logxor, scm_i_min, scm_i_max, scm_i_sum, scm_i_difference) (scm_i_product, scm_i_divide): Change asubrs to be gsubrs. + is not an asubr * libguile/numbers.h: * libguile/numbers.c (scm_i_sum): Rework so that scm_sum is just a normal function. Its generic is actually provided by scm_i_sum, a gsubr with rest args. In that way, + is no longer an asubr. 2009-12-03 Andy Wingo remove scm_tc7_dsubr * libguile/tags.h: Remove scm_tc7_dsubr. There are no more users of this. * libguile/array-map.c: * libguile/eval.c: * libguile/eval.i.c: * libguile/goops.c: * libguile/procprop.c: * libguile/procs.h: Remove all dsubr cases. 2009-12-03 Andy Wingo remove "primitive numerics" from the docs * doc/ref/api-data.texi: Update for $sin deprecation. 2009-12-03 Andy Wingo implement transcendental sin, cos etc in c; deprecate $sin, $cos, etc * libguile/deprecated.h: * libguile/deprecated.c (scm_asinh, scm_acosh, scm_atanh): Deprecate these stand-ins for the C99 asinh, acosh, and atanh functions. Guile is not gnulib. (scm_sys_atan2): Deprecate as well, in favor of scm_atan. * libguile/numbers.h: * libguile/numbers.c (scm_sin, scm_cos, scm_tan) (scm_sinh, scm_cosh, scm_tanh) (scm_asin, scm_acos, scm_atan) (scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): New functions, replacing the combination of dsubrs and boot-9 wrappers with C subrs that handle complex values. The latter three have _sys_ in their names due to the name conflict with the deprecated scm_asinh et al. Remove the $abs, $sin etc "dsubrs". * module/ice-9/boot-9.scm: Remove transcendental functions, as this all happens in C now. * module/ice-9/deprecated.scm: Add aliases for $sin et al. * test-suite/tests/ramap.test ("array-map!"): Adjust "dsubr" tests to use sqrt, not $sqrt. They don't actually test dsubrs now. In the two-source test, I'm pretty sure the dsubr array-map! should have been failing, as indeed it does now; I've changed the test case to expect the failure. I'd still like to know why it was succeeding before. 2009-12-03 Andy Wingo expt implemented in C, handles complex numbers * libguile/numbers.h: * libguile/numbers.c (scm_expt): Rename from scm_sys_expt, and handle the complex cases as well. * libguile/deprecated.h: * libguile/deprecated.c (scm_sys_expt): Add a deprecated shim. * module/ice-9/boot-9.scm (expt): Remove definition, scm_expt does all we need. 2009-12-03 Andy Wingo remove tc7_subr_* and tc7_lsubr_* * libguile/tags.h: Remove tc7 #defines for subrs, replacing them with placeholders. These were public, but hopfully unused. I don't see how to usefully deprecate them. * libguile/array-map.c (scm_array_map_x): Remove special cases for certain subr types. This might make things slower for the moment, otoh, native compilation should moot that question. * libguile/eval.i.c: * libguile/eval.c: Remove subr-handling cases. To regain this speed and more won't have to wait for native compilation, though -- this change smooths the way for subr dispatch in the VM. * libguile/gsubr.c (scm_i_gsubr_apply): Fix a bug in which we didn't detect too-many-arguments. This would only show up when using ceval, as only ceval called this function. * test-suite/tests/ramap.test ("array-map!"): Change the expected exception if passed a procedure of the wrong arity. It now gives wrong-num-args. more won't have to wait for native compilation, though -- this change smooths the way for subr dispatch in the VM. * libguile/goops.c (scm_class_of): Remove subr cases. No speed implication. * libguile/objects.c (scm_valid_object_procedure_p): Remove this public but undocumented, and useless, function. I do not think this will affect anyone at all. (scm_set_object_procedure_x): Replace a call to scm_valid_object_procedure_p with scm_procedure_p, and actually wrap with a scm_is_true. * module/oop/goops.scm (initialize-object-procedure): Don't call valid-object-procedure?. 2009-12-03 Andy Wingo all subrs are gsubrs * libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Always create gsubrs -- never the specialized tc7 types. Allow gsubrs to have generics, there doesn't seem to be any reason not to. * libguile/macros.c (scm_make_synt): * libguile/values.c (scm_init_values): * libguile/eval.c (scm_init_eval): * libguile/gc.c (scm_init_gc): Use scm_c_define_gsubr instead of scm_c_define_subr. * libguile/goops.c (scm_class_of): Allow gsubrs to be primitive generics. 2009-12-03 Andy Wingo replace frame implementation with VM frames * libguile/stacks.h: Rework so that a stack doesn't copy information out of VM frames, it just holds onto a VM frame, along with the stack id and length. VM frames are now the only representation of frames in Guile. (scm_t_info_frame, SCM_FRAME_N_SLOTS, SCM_FRAME_REF, SCM_FRAME_NUMBER) (SCM_FRAME_FLAGS, SCM_FRAME_SOURCE, SCM_FRAME_PROC, SCM_FRAME_ARGS) (SCM_FRAME_PREV, SCM_FRAME_NEXT) (SCM_FRAMEF_VOID, SCM_FRAMEF_REAL, SCM_FRAMEF_PROC) (SCM_FRAMEF_EVAL_ARGS, SCM_FRAMEF_OVERFLOW) (SCM_FRAME_VOID_P, SCM_FRAME_REAL_P, SCM_FRAME_PROC_P) (SCM_FRAME_EVAL_ARGS_P, SCM_FRAME_OVERFLOW_P): Remove these macros corresponding to the old frame implementation. (scm_frame_p scm_frame_source, scm_frame_procedure) (scm_frame_arguments): These definitions are now in frames.h. (scm_last_stack_frame): Remove declaration of previously-removed constructor. Probably should re-instate it though. (scm_frame_number, scm_frame_previous, scm_frame_next) (scm_frame_real_p, scm_frame_procedure_p, scm_frame_evaluating_args_p) (scm_frame_overflow_p) : Remove these procedures corresponding to the old stack implementation. * libguile/stacks.c: Update for new frames implementation. * libguile/frames.h: * libguile/frames.c: Rename functions operating on VM frames to have a scm_frame prefix, not scm_vm_frame -- because they really are the only frames we have. Rename corresponding Scheme functions too, from vm-frame-foo to frame-foo. * libguile/deprecated.h: Remove scm_stack and scm_info_frame data types. * libguile/vm.c (vm_dispatch_hook): Adapt to scm_c_make_frame name change. * module/system/vm/frame.scm: No need to export functions provided frames.c now, as we load those procedures into the default environment now. Rename functions, and remove a couple of outdated, unused functions. The bottom half of this file is still bitrotten, though. * libguile/backtrace.c: Rework to operate on the new frame representation. Also fix a bug displaying file names for compiled procedures. * libguile/init.c: Load the VM much earlier, just because we can. Also it allows us to have frames.[ch] loaded in time for stacks to be initialized, so that scm_frame_arguments can do the right thing. 2009-12-03 Andy Wingo remove debug frames * libguile/debug.h (scm_t_debug_frame): Remove this type, as it was internal to the old evaluator. (SCM_EVALFRAME, SCM_APPLYFRAME, SCM_VOIDFRAME, SCM_MACROEXPF) (SCM_TAILREC, SCM_TRACED_FRAME, SCM_ARGS_READY, SCM_DOVERFLOW) (SCM_MAX_FRAME_SIZE, SCM_FRAMETYPE) (SCM_EVALFRAMEP, SCM_APPLYFRAMEP, SCM_VOIDFRAMEP, SCM_MACROEXPFP) (SCM_TAILRECP, SCM_TRACED_FRAME_P, SCM_ARGS_READY_P, SCM_OVERFLOWP) (SCM_SET_MACROEXP, SCM_SET_TAILREC, SCM_SET_TRACED_FRAME) (SCM_SET_ARGSREADY, SCM_SET_OVERFLOW) (SCM_CLEAR_MACROEXP, SCM_CLEAR_TRACED_FRAME, SCM_CLEAR_ARGSREADY): Remove macro accessors to scm_t_debug_frame. (SCM_DEBUGOBJP, SCM_DEBUGOBJ_FRAME, SCM_SET_DEBUGOBJ_FRAME): (scm_debug_object_p, scm_make_debugobj): Remove debugobj accessors. (scm_i_unmemoize_expr): Remove unused declaration. * libguile/debug.c (scm_debug_options): No more max limit on frame sizes. (scm_start_stack): Just call out to scm_vm_call_with_new_stack. (scm_debug_object_p, scm_make_debugobj, scm_init_debug): No more debugobj smob type. * libguile/deprecated.h: * libguile/deprecated.c (scm_i_deprecated_last_debug_frame) (scm_last_debug_frame): Remove deprecated debug-frame bits. * libguile/stacks.c (scm_make_stack): Rework this function and its dependents to only walk VM frames. (scm_stack_id): Call out to the holder of the VM frame in question, which should be a VM or a VM continuation, for the stack ID. Currently this bit is stubbed out. (scm_last_stack_frame): Removed. It seems this is mainly useful for a debugger, and we need to rewrite the debugger to work on the Scheme level. * test-suite/tests/continuations.test ("continuations"): Remove test for last-stack-frame. * libguile/continuations.h (struct scm_t_contregs): * libguile/continuations.c (scm_make_continuation): (copy_stack_and_call, scm_i_with_continuation_barrier): No need to save and restore debug frames. * libguile/threads.h (scm_i_thread): Don't track debug frames. (scm_i_last_debug_frame, scm_i_set_last_debug_frame): Remove macro accessors. * libguile/threads.c (guilify_self_1): Don't track debug frames. * libguile/throw.c: No need to track debug frames in a jmpbuf. * libguile/vm-engine.c (vm_engine, VM_PUSH_DEBUG_FRAMES): Don't push debug frames. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): New function. Currently stubbed out though. 2009-12-03 Andy Wingo clarify comments in eval.scm * module/ice-9/eval.scm: Add some more comments. 2009-12-03 Andy Wingo really boot primitive-eval from scheme. * libguile/eval.c (scm_primitive_eval, scm_c_primitive_eval): (scm_init_eval): Rework so that scm_primitive_eval always calls out to the primitive-eval variable. The previous definition is the default value, which is probably overridden by scm_init_eval_in_scheme. * libguile/init.c (scm_i_init_guile): Move ports and load-path up, so we can debug when initing eval. Call scm_init_eval_in_scheme. Awesome. * libguile/load.h: * libguile/load.c (scm_init_eval_in_scheme): New procedure, loads up ice-9/eval.scm to replace the primitive-eval definition, if everything is there and up-to-date. * libguile/modules.c (scm_module_transformer): Export to Scheme, so it's there for eval.go. * module/ice-9/boot-9.scm: No need to define module-transformer. * module/ice-9/eval.scm (capture-env): Only reference the-root-module if modules are booted. (primitive-eval): Inline a definition for identity. Throw a more standard error for "wrong number of arguments". * module/ice-9/psyntax.scm (chi-install-global): The macro binding for a syncase macro is now a pair: the transformer, and the module that was current when the transformer was installed. The latter is used for hygiene purposes, replacing the use of procedure-module, which didn't work with the interpreter's shared-code closures. (chi-macro): Adapt for the binding being a pair, and get the hygiene from the cdr. (eval-local-transformer): Adapt to new form of macro bindings. * module/ice-9/psyntax-pp.scm: Regenerated. * .gitignore: Ignore eval.go.stamp. * module/Makefile.am: Reorder for fastest serial compilation, now that there are no ordering constraints. I did a number of experiments here and this seems to be the best; but the bulk of the time is compiling psyntax-pp.scm with eval.scm. Not so great. * libguile/vm-engine.c (vm-engine): Throw a more standard error for "wrong type to apply". * test-suite/tests/gc.test ("gc"): Remove a hack that shouldn't affect the new evaluator, and throw in another (gc) for good measure. * test-suite/tests/goops.test ("defining classes"): * test-suite/tests/hooks.test (proc1): We can't currently check what the arity is of a closure made by eval.scm -- or more accurately all closures have 0 required args and no rest args. So punt for now. * test-suite/tests/syntax.test ("letrec"): The scheme evaluator can't check that a variable is unbound, currently; perhaps the full "fixing letrec" expansion could fix this. But barring that, punt. 2009-12-01 Andy Wingo apply goes to the vm, not the interpreter * libguile/eval.c (eval): Call scm_vm_apply instead of apply. (apply): Deleted, no longer referenced. Heh. (scm_apply): Call scm_vm_apply. * libguile/init.c (scm_i_init_guile): Bootstrap the VM before the evaluator. * libguile/vm.c (scm_vm_apply): Actually it's not necessary that the procedure is a program; so that's cool, relax the check. 2009-12-01 Andy Wingo vm doesn't call the evaluator at all (at least not directly) * libguile/vm-i-system.c (goto/args, mv-call): Finish the port to use apply_foreign instead of scm_apply. 2009-12-01 Andy Wingo first step to make the vm stop calling the interpreter * libguile/eval.h: * libguile/eval.c (scm_closure_apply): New function, applies a closure. Won't be necessary in the future, but for now here it is, with internal linkage. * libguile/gsubr.h: * libguile/gsubr.c (scm_i_gsubr_apply_array): New function, applies a gsubr to an array of values, potentially extending that array for optional arguments and rest arguments and such. * libguile/vm.c (apply_foreign): New function, applies a foreign function to arguments on the stack, in place. * libguile/vm-i-system.c (call): Add a case for procedures-with-setters (will go away when they are applicable structs). Instead of calling the evaluator for foreign functions, call apply_foreign. 2009-12-01 Andy Wingo add new scheme evaluator * module/ice-9/eval.scm: New evaluator, written in Scheme. Whee! Batteries included but not wired up. * module/Makefile.am: Abuse touch(1) to make sure eval.go gets built before everything. Can't just depend on eval.go, because eval.go will get the timestamp of eval.scm, which might be newer than foo.go (and thus foo.scm). Something better is warranted. 2009-12-01 Andy Wingo add memoized expression accessors to scheme * libguile/eval.c: Fix a comment. (eval): Abstract out the variable memoization into a function, scm_memoize_variable_access_x. * libguile/memoize.c (memoized_tags): Fix a couple names. (scm_memoize_variable_access_x): New internal function. Actually it's public to Scheme, but we can't do much about that, because the new evaluator will need it. (scm_memoized_expression_typecode, scm_memoized_expression_data): New accessors for memoized code, for Scheme. (scm_memoized_typecode): Looks up the typecode for a symbol. 2009-12-01 Andy Wingo export scm_define to scheme as define! * libguile/modules.c (scm_define): Export to Scheme as `define!'. The evaluator needs it, and actually it's an OK thing to have around. 2009-12-01 Andy Wingo wire through the existing vm ops for variable-ref and variable-set! * module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile variable-ref and variable-set instructions specially. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add cases for variable-ref and variable-set!. The latter is a little tricky, because the args are switched for the VM op, and we can't really change that easily. 2009-12-01 Andy Wingo fixes to variable-ref, variable-set vm ops * libguile/vm-i-system.c (variable-ref, variable-set): Fix declared number of pops and pushes. promises are in their own file now * libguile.h: * libguile/Makefile.am: * libguile/eval.c: * libguile/eval.h: * libguile/init.c: * libguile/promises.c: * libguile/promises.h: Split promises out into their own file. 2009-12-01 Andy Wingo new evaluator, y'all * libguile/eval.c: So, ladies & gents, a new evaluator. It's similar to the old one, in that we memoize and then evaluate, but in this incarnation, memoization of an expression happens before evaluation, not lazily as the expression is evaluated. This makes the evaluation itself much cleaner, in addition to being threadsafe. In addition, since this C evaluator will in the future just serve to bootstrap the Scheme evaluator, we don't have to pay much concern for debugging conveniences. So the environment is just a list of values, and the memoizer pre-computes where it's going to find each individual value in the environment. Interface changes are commented below, with eval.h. (scm_evaluator_traps): No need to reset the debug mode after rnning te traps thing. But really, the whole traps system needs some love. * libguile/memoize.h: * libguile/memoize.c: New memoizer, which runs before evaluation, checking all syntax before evaluation begins. Significantly, no debugging information is left for lexical variables, which is not so great for interactive debugging; perhaps we should change this to have a var list in the future as per the classic interpreters. But it's quite fast, and the resulting code is quite good. Also note that it doesn't produce ilocs, memoized code is a smob whose type is in the first word of the smob itself. * libguile/eval.h (scm_sym_and, scm_sym_begin, scm_sym_case) (scm_sym_cond, scm_sym_define, scm_sym_do, scm_sym_if, scm_sym_lambda) (scm_sym_let, scm_sym_letstar, scm_sym_letrec, scm_sym_quote) (scm_sym_quasiquote, scm_sym_unquote, scm_sym_uq_splicing, scm_sym_at) (scm_sym_atat, scm_sym_atapply, scm_sym_atcall_cc) (scm_sym_at_call_with_values, scm_sym_delay, scm_sym_eval_when) (scm_sym_arrow, scm_sym_else, scm_sym_apply, scm_sym_set_x) (scm_sym_args): Remove public declaration of these symbols. (scm_ilookup, scm_lookupcar, scm_eval_car, scm_eval_body) (scm_eval_args, scm_i_eval_x, scm_i_eval): Remove public declaration of these functions. (scm_ceval, scm_deval, scm_ceval_ptr): Remove declarations of these deprecated functions. (scm_i_print_iloc, scm_i_print_isym, scm_i_unmemocopy_expr) (scm_i_unmemocopy_body): Remove declarations of these internal functions. (scm_primitive_eval_x, scm_eval_x): Redefine as macros for their less destructive siblings. * libguile/Makefile.am: Add memoize.[ch] to the build. * libguile/debug.h (scm_debug_mode_p, scm_check_entry_p) (scm_check_apply_p, scm_check_exit_p, scm_check_memoize_p) (scm_debug_eframe_size): Remove these vars that were tied to the old evaluator's execution model. (SCM_RESET_DEBUG_MODE): Remove, no more need for this. (SCM_MEMOIZEDP, SCM_MEMOIZED_EXP, SCM_MEMOIZED_ENV): Remove macros referring to old memoized code representation. (scm_local_eval, scm_procedure_environment, scm_memoized_environment) (scm_make_memoized, scm_memoized_p): Remove functions operating on old memoized code representation. (scm_memcons, scm_mem_to_proc, scm_proc_to_mem): Remove debug-only code for old evaluator. * libguile/debug.c: Remove code to correspond with debug.h removals. (scm_debug_options): No need to set the debug mode or frame limit here, as we don't have C stack limits any more. Perhaps this is a bug, but as long as we can compile eval.scm, we should be fine. * libguile/init.c (scm_i_init_guile): Init memoize.c. * libguile/modules.c (scm_top_level_env, scm_env_top_level) (scm_env_module, scm_system_module_env_p): Remove these functions. * libguile/print.c (iprin1): No more need to handle isyms. Adapt to new form of interpreted procedures. * libguile/procprop.c (scm_i_procedure_arity): Adapt to new form of interpreted procedures. * libguile/procs.c (scm_thunk_p): Adapt to new form of interpreted procedures. * libguile/procs.h (SCM_CLOSURE_FORMALS): Removed, this exists no more. (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS): New accessors. * libguile/srcprop.c (scm_source_properties, scm_source_property) (scm_set_source_property_x): Remove special cases for memoized code. * libguile/stacks.c (read_frame): Remove a source-property case for interpreted code. (NEXT_FRAME): Remove a case that I don't fully understand, that seems to be designed to skip over apply frames. Will be obsolete in the futures. (read_frames): Default source value for interpreted frames to #f. (narrow_stack): Don't pay attention to the system_module thing. * libguile/tags.h: Remove isyms and ilocs. Whee! * libguile/validate.h (SCM_VALIDATE_MEMOIZED): Fix to use the new MEMOIZED_P formulation. * module/ice-9/psyntax-pp.scm (do, quasiquote, case): Adapt for these no longer being primitive macros. * module/ice-9/boot-9.scm: Whitespace change, but just a poke to force a rebuild due to and/or/cond/... not being primitives any more. * module/ice-9/deprecated.scm (unmemoize-expr): Deprecate, it's unmemoize-expression now. * test-suite/tests/eval.test ("define set procedure-name"): XFAIL a couple of tests here; I don't know what to do about them. I reckon the expander should ensure that defined values are named. * test-suite/tests/chars.test ("basic char handling"): Fix expected exception when trying to apply a char. 2009-12-01 Andy Wingo goops moving away from evaluator opcodes, and a primitive compilation fix * module/oop/goops.scm (@slot-ref, @slot-set!): Define "primitives" for these. Probably should do something more general, though, allowing @struct-ref. * module/language/tree-il/primitives.scm (add-interesting-primitive!): Error if the primitive isn't bound. 2009-12-01 Andy Wingo remove (lang elisp), as it won't work with the new evaluator * lang/: Delete. This causes me some pain, but the new elisp compiler is coming soon, and the old one really won't work with the new evaluator. * Makefile.am: * configure.ac: Autotoolery for elisp removal. * test-suite/tests/elisp.test: Comment out the body of the elisp test. The tests themselves should be useful in the new world, though. 2009-12-01 Andy Wingo local-eval will go away * module/ice-9/debugger/commands.scm: * module/ice-9/debugging/traps.scm: * module/ice-9/emacs.scm: * module/ice-9/gds-client.scm: Add some FIXMEs due to impending local-eval removal. * module/oop/goops.scm (make-generic-bound-check-getter): Just the compiled closure case here. 2009-12-01 Andy Wingo no special treatment for memoized code in srcprop.c * libguile/srcprop.c (scm_set_source_properties_x): No need to treat memoized code specially. * test-suite/tests/srcprop.test ("set-source-property!") ("set-source-properties!"): Well, just throw 'unresolved on these for now, because we need a few more things to land before these can be fixed, or even considered. 2009-12-01 Andy Wingo factor copy-tree and cons-source out of eval.[ch] * libguile.h: * libguile/Makefile.am * libguile/init.c (scm_i_init_guile): Add trees.[ch] to the build. * libguile/eval.c: * libguile/eval.h: Remove scm_copy_tree and scm_cons_source... * libguile/trees.h: * libguile/trees.c: * libguile/srcprop.h: * libguile/srcprop.c: ... factoring them out here and here, respectively. * test-suite/tests/eval.test ("memoization"): Change expected exception for circular data structures, given new copy-tree location. 2009-12-01 Andy Wingo remove unused scm_eval_stack var * libguile/private-options.h: * libguile/eval.c (scm_eval_stack): Remove declaration and definition of unused scm_eval_stack variable. remove evaluator-specific code from macros.c * libguile/macros.c (macro_print): No special printing for macros whose code is an interpreted procedure. 2009-12-01 Andy Wingo remove class-environment slot, goops grubs less in the evaluator * libguile/goops.h (scm_sys_tag_body): Remove declaration of undefined function. (SCM_CLASS_CLASS_LAYOUT, scm_si_environment, SCM_N_CLASS_SLOTS) (scm_class_environment) Remove class environment slot and getter. * libguile/goops.c (compute_getters_n_setters): Use scm_primitive_eval to produce the init thunk, instead of scm_i_eval_x; though really we should be doing this in Scheme. (scm_basic_basic_make_class, build_class_class_slots) (create_basic_classes, scm_class_environment): Remove class environment slot. (get_slot_value, set_slot_value): Use scm_call_1 instead of evaluator tricks. * module/oop/goops.scm: Remove class-environment export, and environments throughout the file. 2009-12-01 Andy Wingo fix to gdb_eval to use newer interfaces * libguile/gdbint.c (gdb_eval): Use scm_primitive_eval instead of scm_i_eval_x. 2009-12-01 Andy Wingo formally deprecate trampolines * libguile/eval.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): Actually deprecate trampolines. * srfi/srfi-1.c: Fix all trampoline uses in srfi-1.c. 2009-12-01 Andy Wingo remove uses of trampolines within guile itself * libguile/eval.c (scm_map, scm_for_each) * libguile/hashtab.c (scm_hash_for_each_handle) * libguile/list.c (scm_filter, scm_filter_x) * libguile/quicksort.i.c: * libguile/sort.c (scm_restricted_vector_sort_x, scm_sorted_p) (scm_merge, scm_merge_list_x, scm_merge_x) (scm_merge_list_step, scm_sort_x, scm_sort, scm_merge_vector_x) (scm_merge_vector_step, scm_stable_sort_x, scm_sort_list_x) (scm_sort_list)nn * libguile/srfi-13.c (scm_string_any, scm_string_every) (scm_string_tabulate, scm_string_trim, string_trim_right) (scm_string_trim_both, scm_string_index, scm_string_index_right) (scm_string_skip, scm_string_skip_right, scm_string_count) (scm_string_map, scm_string_map_x, scm_string_for_each) (scm_string_for_each_index, scm_string_filter, scm_string_delete): Remove uses of trampolines. gut the backtrace implementation for memoized code * libguile/backtrace.c (display_header, display_expression) (display_error_body, display_backtrace_get_file_line, display_frame): Gut the implementation for memoized code, as memoized code as it is currently understood is going away. 2009-12-01 Andy Wingo remove some deprecated things, undeprecate scm_the_root_module() * libguile/deprecated.h * libguile/deprecated.c (SCM_ILOC00, SCM_IDINC, SCM_IDSTMSK) (scm_s_expression, scm_s_test, scm_s_body, scm_s_bindings) (scm_s_variable, scm_s_clauses, scm_s_formals, SCM_EVALIM2) (SCM_EVALIM, SCM_XEVAL, SCM_XEVALCAR): Remove these macros and constants, deprecated in 2003. (scm_the_root_module): Undeprecate, it's actually a useful function, that other parts of the code use. * libguile/modules.h (scm_the_root_module): Undeprecated. * libguile/modules.c (scm_the_root_module): Rename from the_root_module. Use it in the rest of this file. 2009-12-01 Andy Wingo tweak to eval.c * libguile/eval.c (eval_letrec_inits): Rename from ceval_letrec_inits. Caller changed. 2009-12-01 Andy Wingo eval.i.c -> eval.c * libguile/Makefile.am: * libguile/eval.i.c: Remove eval.i.c. * libguile/eval.c: Fold eval.i.c's contents into eval.c. 2009-12-01 Andy Wingo more ceval excision * libguile/eval.c: * libguile/eval.i.c: Rename deval to eval. Substitute in some preprocessor macros. remove code from eval.i.c that was only for CEVAL. * libguile/eval.i.c: Remove CEVAL-only code. 2009-12-01 Andy Wingo Don't double-include eval.i.c -- let's only build deval. * libguile/eval.c (SCM_I_XEVAL, SCM_I_XEVALCAR): No more debug_p args, we are always debugging. Adapt all callers. (ceval_letrec_inits): For some reason this function is used by deval. No idea why. Pull it out here. * libguile/eval.i.c (SCM_APPLY): scm_dapply is scm_apply. 2009-12-01 Andy Wingo gut trampolines * libguile/eval.c: Gut the trampoline implementation. We'll be doing much more clever things here that will obviate the need for the procedure arg of map and for-each to be allocated in many cases... trampolines were a noble attempt at optimizing in the wrong place. * srfi/srfi-1.c (scm_srfi1_lset_difference_x): Validate that we get a proc, because the trampoline won't do it for us. * test-suite/tests/sort.test ("sort"): * test-suite/tests/srfi-1.test ("count", "fold", "list-index"): Change expected exceptions, due to trampoline functions not doing any computation. 2009-12-01 Andy Wingo expand out named let to letrec in the eval case * module/ice-9/psyntax.scm: In the eval case, expand out named let to letrec. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-11-29 Ludovic Courtès Make `SCM' type definition acceptable for C++ compilers. * libguile/tags.h (SCM) [SCM_DEBUG_TYPING_STRICTNESS == 1]: Use a named struct to avoid errors from C++ compilers such as "error: non-local function ‘* foo(*)’ uses anonymous type". This fixes a regression introduced in c6054feaf03f8bde236f5e45a946f38827074923 ("Add support for static allocation of cells, strings and stringbufs."). Reported by Linas Vepstas . 2009-11-28 Ludovic Courtès Remove remaining uses of discouraged constructs, really. * libguile/throw.c, libguile/vm-engine.h, libguile/vm-i-system.c, libguile/vm.c: Replace uses of discouraged constructs by their current counterparts. Remove remaining uses of discouraged constructs. * libguile/frames.c, libguile/instructions.c, libguile/objcodes.c, libguile/programs.c, libguile/throw.c, libguile/vm-i-scheme.c, libguile/vm.c: Replace uses of discouraged constructs by their current counterparts. 2009-11-27 Ludovic Courtès Disable encoding scanning on non-seekable file ports. * libguile/read.c (scm_i_scan_for_encoding): Don't attempt to scan non-seekable file ports. 2009-11-26 Andy Wingo header tidyings * libguile/goops.h: * libguile/struct.h: c-backslash-region some vars. brace placement fixes * libguile/goops.c (scm_sys_allocate_instance): * libguile/vm-i-loader.c (load-wide-string): Fix some brace placements. push goops compile delay out to 30 invocations, for great justice * module/oop/goops/dispatch.scm (timer-init): Init to 30 for faster goops load time. generic method cache begone * libguile/goops.h (SCM_GENERIC_METHOD_CACHE) (SCM_SET_GENERIC_METHOD_CACHE, scm_si_generic_cache) * libguile/goops.c (create_standard_classes): Remove slot for generic method cache. Yay! 2009-11-26 Andy Wingo remove code that manages the method cache * libguile/goops.h (SCM_MCACHE_N_SPECIALIZED) (SCM_SET_MCACHE_N_SPECIALIZED, SCM_INITIAL_MCACHE_SIZE) (scm_make_method_cache, scm_memoize_method, scm_mcache_lookup_cmethod) (scm_mcache_compute_cmethod): * libguile/goops.c: Remove these procedures which managed the method cache. There's still a slot there but it's not initialized. The method cache is no longer necessary. * module/oop/goops/dispatch.scm (memoize-method!): Change to not take a "cache" argument. * libguile/eval.i.c: * libguile/vm-i-system.c: Remove dispatch via the method cache. 2009-11-26 Andy Wingo remove method cache management code from (oop goops dispatch) * module/oop/goops/dispatch.scm: Remove old method cache things. 2009-11-26 Andy Wingo generics now dispatch as applicable structs * libguile/eval.i.c (CEVAL, SCM_APPLY): Dispatch applicable structs before pure generics. In practice what this means is that we never hit the mcache case, because all pure generics are applicable structs. We're moving over to having generics dispatch themselves. Also, they don't prepend the struct as an arg; in order to have that effect, the user has closures. * libguile/goops.c (scm_apply_generic, scm_call_generic_0): (scm_call_generic_1, scm_call_generic_2, scm_call_generic_3): Dispatch directly to the struct procedures. (scm_var_make_extended_generic): Remove a duplicate definition for scm_var_make_extended_generic. (create_standard_classes): Mark all instances of (themselves classes) as applicable classes. Meaning: generics are now applicable structs. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT): The hashsets are actually uw slots -- or at least, making subclasses maps the int slots to be uw slots * libguile/vm-i-system.c (call, goto/args, mv-call): Dispatch applicable structs in the VM. * module/oop/goops/dispatch.scm (emit-linear-dispatch): Fix bug in the non-rest cache miss case. (delayed-compile): Rework to avoid fluids. (cache-dispatch): Don't call `equal?', it causes bootstrapping problems with the primitive-generic equal?. Using our own version is faster anyway. 2009-11-26 Andy Wingo make sure that when equal? is extended, that the generic has a method * libguile/goops.h: * libguile/goops.c (scm_set_primitive_generic_x): New function, for now local to the goops module. * module/oop/goops.scm (equal?): Make sure that when equal? is extended, that the generic already has a default method. 2009-11-26 Andy Wingo remove cache-mutex slot from generics * libguile/goops.c: * libguile/goops.h: Remove cache-mutex slot from generics, and renumber other slots. remove locking in method memoization * libguile/goops.c (scm_memoize_method): Don't lock around method memoization, as the new protocol will be reeentrant and lock-free. 2009-11-26 Andy Wingo limn goops flags, remove foreign objs, rename entity to applicable-struct * libguile/goops.c (scm_class_applicable_struct) (scm_class_applicable_struct_with_setter) (scm_class_applicable_struct_class): Rename from scm_class_entity, scm_class_entity_with_setter, and scm_class_entity_class. (scm_class_simple_method): Removed; this abstraction is not used. (scm_class_foreign_class, scm_class_foreign_object): Remove these, they are undocumented and unused. They might come back later. (scm_sys_inherit_magic_x): Simply inherit the vtable flags from the class's class. Flags are about layout, and it is the class that determines the layout of the instance. (scm_basic_basic_make_class): Don't bother setting GOOPS_OR_VALID, inherit-magic will do that. (scm_basic_make_class): Inherit magic after setting the layout. Allows the struct magic checker to do its job. (scm_accessor_method_slot_definition): Move implementation to Scheme. Removes the need for the accessor flag. (scm_sys_allocate_instance): Adapt to scm_i_alloc_struct name change, and that alloc-struct will handle finalization. (scm_compute_applicable_methods): Remove accessor check, as it's unnecessary. (scm_make): Adapt to new generic slot order, and no more simple-method. (create_standard_classes): What was the GF slot "dispatch-procedure" is now the applicable-struct slot "procedure". No more foreign class, foreign object, or simple method. Rename and friends to and friends. No more entity-with-setter -- though perhaps it will come back too. Instead generic-with-setter is its own thing. * libguile/goops.h (SCM_CLASSF_METACLASS): "A goops class that is a vtable" -- no need for a separate flag. (SCM_CLASSF_FOREIGN, SCM_CLASSF_SIMPLE_METHOD) (SCM_CLASSF_ACCESSOR_METHOD): Removed these unused flags. (SCM_ACCESSORP): Removed. Renumber generic slots, rename entity classes, and remove the foreign class, foreign object, and simple method classes. * libguile/struct.c (scm_i_struct_inherit_vtable_magic): New function, called when making new vtables.applicable structs (scm_i_alloc_struct): Remove 8-bit alignment check, as libGC guarantees this for us. Handle finalizer registration here. (scm_make_struct): Factor some things to scm_i_alloc_struct and scm_i_struct_inherit_vtable_magic. (scm_make_vtable_vtable): Adapt to scm_i_alloc_struct name change. * libguile/struct.h (scm_i_alloc_struct): Change name from scm_alloc_struct, and make internal. * module/oop/goops.scm (oop): Don't declare #:replace et al, because isn't defined in the core any more. (accessor-method-slot-definition): Defined in Scheme now. Remove methods. (initialize on ): Prep layout before inheriting magic, as in scm_basic_make_class. * module/oop/goops/dispatch.scm (delayed-compile) (memoize-effective-method!): Adapt to 'procedure slot name change. 2009-11-26 Andy Wingo %invalidate-method-cache invalidates the dispatch procedure too * libguile/goops.c (make_dispatch_procedure, clear_method_cache): Properly reset the dispatch procedure. 2009-11-26 Andy Wingo generic dispatch protocol in scheme, not yet wired up * module/oop/goops/dispatch.scm: Add a dispatch protocol in Scheme. The idea is that instead of using a hardcoded C protocol, we compile dispatch procedures at runtime. To avoid too much thrashing at bootup, there is a simple JIT mechanism -- dispatch will be data-driven, through the cache, for the first 5 invocations, then a dispatch procedure will be compiled from the cache. My initial timings indicate that interpreted dispatch takes about 100us, and that compiled dispatch takes about 60us. Compilation itself takes about 16000us (16 ms). The compiled procedure dispatch times will improve soon, hopefully. 2009-11-26 Andy Wingo eqv? not a generic, equal? dispatches to generic only for objects * libguile/eq.c (scm_eqv_p): Not a generic any more. Since eqv? is used by e.g. `case', which should be able to compile into dispatch tables, it really doesn't make sense to dispatch out to a generic. (scm_equal_p): So it was always the case that (equal? 'foo "foo") => #f. But (equal? 'foo 'bar) could actually be extended by a generic. This was a bug, if you follow the other logic of the code. Changed so that generic functions can only extend the domain of equal? when operating on goops objects. * oop/goops.scm: No more eqv? generic. * test-suite/tests/goops.test: Remove eqv? tests. 2009-11-26 Andy Wingo generic tweaks; realizing what the setter slot actually is * libguile/goops.h (scm_si_dispatch_procedure) (scm_si_effective_methods): Rename the new generics slots to "effective-methods" and "dispatch-procedure". (scm_si_generic_setter): Rename this one from "%setter" to "setter", and it's not a cache -- it's a pointer to the setter, which is also a generic. I didn't realize that before. It's better this way (like it always was.) (SCM_SET_GENERIC_DISPATCH_PROCEDURE) (SCM_CLEAR_GENERIC_EFFECTIVE_METHODS): New helper macros. * libguile/goops.c (clear_method_cache): Clear the new dispatch procedure and the effective methods as well. (create_standard_classes): Rename slots, and fix the setter slots. 2009-11-26 Andy Wingo more clarity in (oop goops dispatch) * module/oop/goops/dispatch.scm (memoize-method!): If we don't have a no-applicable-method, just call no-applicable-method directly. * test-suite/tests/goops.test ("no-applicable-method"): Add some tests. 2009-11-26 Andy Wingo remove code-table slot from methods * libguile/goops.c (scm_sys_invalidate_method_cache_x, scm_make) (create_standard_classes): Remove code-table slot from methods. The generic cache completely does its job, afaict. * libguile/goops.h (scm_si_formals, scm_si_body, scm_si_make_procedure): Renumber slots. * module/oop/goops.scm (initialize on ): No more code-table slot. * module/oop/goops/compile.scm: Always "compile" a method, instead of looking for a hit in an always-empty cache. 2009-11-26 Andy Wingo remove used-by slot from generics * libguile/goops.c (clear_method_cache) (scm_sys_invalidate_method_cache_x, scm_make) (create_standard_classes): Remove the used-by method from generics, as it is not used at all. * libguile/goops.h: Renumber generic slots. * module/oop/goops/dispatch.scm (memoize-method!): No more used-by slot. 2009-11-26 Andy Wingo first step towards effective methods * libguile/goops.c (create_standard_classes): * libguile/goops.h *scm_si_applicable_methods, scm_si_effective_method) (scm_si_applicable_setter_methods, scm_si_effective_setter_method): Add space for the new form of the generic cache and effective method. 2009-11-26 Andy Wingo a very big commit cleaning up structs & goops. also applicable structs. I tried to split this one, and I know it's a bit disruptive, but this stuff really is one big cobweb. So instead we'll pretend like these are separate commits, by separating the changelog. Applicable struct runtime support. * libguile/debug.c (scm_procedure_source): * libguile/eval.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): * libguile/eval.i.c (CEVAL): * libguile/goops.c (scm_class_of): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Allow for applicable structs. Whee! * libguile/deprecated.h (scm_vtable_index_vtable): Define as a synonym for scm_vtable_index_self. (scm_vtable_index_printer): Alias scm_vtable_index_instance_printer. (scm_struct_i_free): Alias scm_vtable_index_instance_finalize. (scm_struct_i_flags): Alias scm_vtable_index_flags. (SCM_STRUCTF_FLAGS): Be a -1 mask, we have a whole word now. (SCM_SET_VTABLE_DESTRUCTOR): Implement by hand. Hidden slots. * libguile/struct.c (scm_make_struct_layout): Add support for "hidden" fields, writable fields that are not visible to make-struct. This allows us to add fields to vtables and not break existing make-struct invocations. (scm_struct_ref, scm_struct_set_x): Always get struct length from the vtable. Support hidden fields. * libguile/goops.c (scm_class_hidden, scm_class_protected_hidden): New slot classes, to correspond to the new vtable slots. (scm_sys_prep_layout_x): Turn hidden slots into 'h'. (build_class_class_slots): Reorder the class slots to account for vtable fields coming out of negative-land, for name as a vtable slot, and for hidden fields. (create_standard_classes): Define and . Clean up struct.h. * libguile/struct.h: Lay things out cleaner. There are no more hidden (negative) words. Names are nicer. The exposition is nicer. But the basics are the same. The incompatibilities are that has more slots now, and that scm_alloc_struct's signature has changed. The former is ameliorated by the "hidden" slots mentioned before, and the latter, well, it was always a very internal thing... (scm_t_struct_finalize): New type, a finalizer function to be run when instances of a vtable are collected. (scm_t_struct_free): Removed, structs' data is managed by the GC now, and not freed by vtable functions. * libguile/struct.c: (scm_vtable_p): Now we keep flags on vtable-vtables, so this check is cheaper. (scm_alloc_struct): No hidden words. Yippee. (struct_finalizer_trampoline): Entersify. (scm_make_struct): No need to babysit extra words, though now we have to babysit flags. Propagate the vtable, applicable, and setter flags appropriately. (scm_make_vtable_vtable): Update for new simplicity. (scm_print_struct): A better printer. (scm_init_struct): Define , a magical vtable like CL's funcallable-standard-class. Also define . Remove foreign object implementation. * libguile/goops.h: * libguile/goops.c (scm_make_foreign_object, scm_make_class) (scm_add_slot, scm_wrap_object, scm_wrap_component): Remove, these were undocumented and unworking. Clean up goops.h, a little. * libguile/goops.h: * libguile/goops.c: Also clean up. * module/oop/goops/dispatch.scm (hashset-index): Adapt for new hashset index. 2009-11-25 Ludovic Courtès Remove uses of discouraged constructs. * libguile/vm-i-scheme.c, libguile/vm-i-system.c, libguile/vm.c: Replace uses of discouraged constructs by their current counterparts. Don't build `inet-aton' and `inet-ntoa' when --disable-networking. * libguile/deprecated.c (scm_inet_aton, scm_inet_ntoa): Conditionalize on `HAVE_NETWORKING'. 2009-11-24 Ludovic Courtès Use $(PATH_SEPARATOR) where appropriate. * examples/Makefile.am (AM_CFLAGS, AM_LIBS): Use $(PATH_SEPARATOR) instead of `:'. (installcheck): Likewise. 2009-11-24 Ludovic Courtès Fix makefile indentation. * benchmark-suite/Makefile.am, libguile/Makefile.am, meta/Makefile.am: Use TAB instead of 8 spaces... * .x-sc_makefile_check: New file. 2009-11-24 Ludovic Courtès Properly quote the first argument to `AC_DEFINE{,_UNQUOTED}'. * acinclude.m4, configure.ac, examples/compat/acinclude.m4: Properly quote the first argument for `AC_DEFINE' and `AC_DEFINE_UNQUOTED'. * .x-sc_m4_quote_check: New file. 2009-11-24 Ludovic Courtès Add `cfg.mk', for use by the top-level GNUmakefile. * cfg.mk: New file, with 1.9.5 `NEWS' hash. "filesystem" -> "file system" * doc/ref/misc-modules.texi, doc/sources/unix.texi, module/ice-9/ftw.scm: Replace "filesystem" by "file system". 2009-11-24 Ludovic Courtès Don't rely on `HAVE_' macros in public header "tags.h". * configure.ac: Check for `intptr_t' and `uintptr_t'. Substitute `SCM_I_GSC_T_INTPTR' and `SCM_I_GSC_T_UINPTR'. * libguile/__scm.h (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN, SCM_T_INTPTR_MAX): New macros. * libguile/_scm.h (SIZEOF_SCM_T_BITS): New macro. * libguile/gen-scmconfig.c (main): Produce typedefs for `scm_t_intptr' and `scm_t_uintptr'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_T_INTPTR, SCM_I_GSC_T_UINPTR): New macros. * libguile/tags.h: Don't check for `HAVE_INTTYPES_H' and `HAVE_STDINT_H'; don't include nor . (scm_t_signed_bits, scm_t_bits): Define unconditionally as aliases for `scm_t_intptr' and `scm_t_uintptr', respectively. (SCM_T_SIGNED_BITS_MAX, SCM_T_SIGNED_BITS_MIN, SCM_T_BITS_MAX): Likewise. (SIZEOF_SCM_T_BITS): Remove. 2009-11-24 Ludovic Courtès Remove unused, non-prefixed macros. * libguile/__scm.h (BIGNUMS, TICKS): Remove. Update to Gnulib v0.0-2923-g6575ab5. Really disable thread-local storage on NetBSD 5.0. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Adjust to match actual NetBSD 5 triplet, `x86_64-unknown-netbsd5.0.' (note the final dot). Fix compilation `--without-threads'. * configure.ac: For `--without-threads' and `--with-threads=null', set `SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=0'. This fixes compilation of `gen-scmconfig.c' in these cases. 2009-11-23 Ludovic Courtès Use Gnulib's `duplocale' module. * libguile/i18n.c (scm_make_locale): Simplify global locale handling, using duplocale(3) for all kinds of locales. (scm_init_i18n): Comment on why we don't just use `LC_GLOBAL_LOCALE' for `global_locale_smob'. * m4/gnulib-cache.m4: Add `duplocale'. 2009-11-23 Ludovic Courtès Use Gnulib's `locale' module. * configure.ac: Remove test for . * libguile/i18n.c: Remove conditional inclusion on `HAVE_XLOCALE_H'. * m4/gnulib-cache.m4: Add `locale' module. 2009-11-23 Ludovic Courtès Correct manual wrt. encoding names. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Don't suggest `latin1' as a good encoding name since Emacs cannot deal with it. * libguile/read.c (scm_file_encoding): Fix "Emacs" spelling. 2009-11-21 Andy Wingo better printing of procedures with keyword arguments * module/system/vm/program.scm (arguments->lambda-list): Print keyword arguments more sensibly. fix version-etc for older autoconf * lib/version-etc.c: Don't reference the undefined PACKAGE if PACKAGE_URL is undefined. Probably should go upstream. 2009-11-18 Ludovic Courtès autogen.sh: Don't presume /usr/bin/m4. * autogen.sh: Don't presume /usr/bin/m4. Work around path name length limitations in `socket.test'. * test-suite/tests/socket.test (%tmpdir, %curdir): New variables. Chdir to %TMPDIR. Switch back to %CURDIR at the end. (temp-file-path): Return a base file name, not an absolute path. 2009-11-18 Ludovic Courtès Remove conflicting definition of $PACKAGE from `GUILE-VERSION'. This obviates the need for the previous commit, 53da7372beca90a58b7401a84627815289a53d11. * GUILE-VERSION (VERSION, PACKAGE): Remove. The latter was conflicting with Automake's definition, which is "guile", not "GNU Guile". * Makefile.am (distdir): Remove. * configure.ac: Hardcode the package name passed to `AC_INIT'. (pkgdatadir, pkgincludedir, pkglibdir, pkglibexecdir): Remove. 2009-11-18 Ludovic Courtès Fix $(pkgdatadir) & co. so they refer to $(PACKAGE_TARNAME), not $(PACKAGE). This fixes a regression introduced in 4f02b98d0ed4a314916c69a225d7a45dda3f5f8c ("Use Gnulib's `version-etc-fsf' for `--version' and `--help' output."), which led $(pkgdatadir) & co. to contain the string "GNU Guile" instead of "guile". * configure.ac (pkgdatadir, pkgincludedir, pkglibdir, pkglibexecdir): New variables. 2009-11-17 Ludovic Courtès Bump version number for 1.9.5. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2009-11-17 Ludovic Courtès Don't use `-Werror' by default. * configure.ac (GUILE_ERROR_ON_WARNING): Default to "no". * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. * NEWS: Update. 2009-11-17 Ludovic Courtès Fix copyright headers. * module/system/vm/debug.scm, module/system/vm/frame.scm, module/system/vm/vm.scm: Switch to LGPLv3+. 2009-11-17 Ludovic Courtès Fix stylistic issues revealed by "make syntax-check". * libguile/gc-malloc.c (scm_must_free): Remove unnecessary `if' before `free ()'. * libguile/stime.c (scm_localtime, scm_mktime): Likewise. * libguile/eval.i.c (ceval): Don't cast the result of alloca(3). * libguile/i18n.c (SCM_STRING_TO_U32_BUF): Likewise. * test-suite/standalone/test-unwind.c: Likewise. * libguile/strings.c (scm_i_deprecated_string_chars): Don't end error message in period. 2009-11-17 Ludovic Courtès Add Gnulib maintainer modules. * m4/gnulib-cache.m4: Add `announce-gen', `gendocs', `gitlog-to-changelog', `gnupload', `gnu-web-doc-update', and `maintainer-makefile'. * .gnuploadrc, .x-sc_GPL_version, .x-sc_avoid_if_before_free, .x-sc_error_message_period, .x-sc_cast_of_alloca_return_value, .x-sc_cast_of_argument_to_free, .x-sc_error_message_uppercase, .x-sc_error_message_warn_fatal: New files. 2009-11-17 Ludovic Courtès Use Gnulib's `version-etc-fsf' for `--version' and `--help' output. * m4/gnulib-cache.m4: Add `version-etc-fsf'. Switch to LGPLv3+. * GUILE-VERSION (PACKAGE): Change to "GNU Guile". * Makefile.am (distdir): New variable. * libguile/script.c (scm_shell_usage): Improve formatting. Use `emit_bug_reporting_address ()'. (scm_compile_shell_switches): Use `version_etc ()'. 2009-11-17 Ludovic Courtès Build the C code with additional GCC warnings. * configure.ac (POTENTIAL_GCC_CFLAGS): Add `-Wdeclaration-after-statement -Wundef -Wswitch-enum'. 2009-11-17 Ludovic Courtès Remove references to undefined macros. The intent is to allow compilation with `-Wundef', which in turn should make it easier to catch erroneous uses of nonexistent macros. * libguile/__scm.h: Don't assume `BUILDING_LIBGUILE' is defined. * libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): Remove unneeded CPP conditional on `TYPE_MIN == 0'. * libguile/fports.c: Check for the definition of `HAVE_CHSIZE' and `HAVE_FTRUNCATE', not for their value. * libguile/ports.c: Likewise. * libguile/numbers.c (guile_ieee_init): Likewise with `HAVE_DINFINITY' and `HAVE_DQNAN'. * test-suite/standalone/test-conversion.c (ieee_init): Likewise. * libguile/strings.c: Likewise with `SCM_STRING_LENGTH_HISTOGRAM'. * libguile/strings.h: Likewise. * libguile/tags.h: Likewise with `HAVE_INTTYPES_H' and `HAVE_STDINT_H'. * libguile/threads.c: Likewise with `HAVE_PTHREAD_GET_STACKADDR_NP'. * libguile/vm-engine.c (VM_NAME): Likewise with `VM_CHECK_IP'. * libguile/gen-scmconfig.c (main): Use "#ifdef HAVE_", not "#if HAVE_". * libguile/socket.c (scm_setsockopt): Likewise. 2009-11-17 Ludovic Courtès Remove now unneeded `putenv.c'. * libguile/Makefile.am (EXTRA_libguile_la_SOURCES): Remove `putenv.c'. * libguile/putenv.c: Remove. 2009-11-17 Ludovic Courtès Remove `qt/'. 2009-11-17 Ludovic Courtès Fix C99-style declarations after statements. * libguile/eval.i.c (ceval): Move declarations before statements. * libguile/read.c (scm_read_extended_symbol): Likewise. * libguile/struct.c (scm_make_struct_layout): Likewise. * libguile/threads.c (fat_mutex_unlock): Likewise. * libguile/vm-i-system.c (br_if_nargs_ne, br_if_nargs_lt): Likewise. * libguile/vm.c (make_vm): Likewise. 2009-11-17 Ludovic Courtès Remove deprecated guardian code. * libguile/guardians.c (guardian_apply): Remove `#if ENABLE_DEPRECATED' section since it was never compiled in, not even in 1.8. (scm_init_guardians): Likewise. 2009-11-17 Ludovic Courtès Use Gnulib's `warning' module. * m4/gnulib-cache.m4: Add `warnings'. * configure.ac: Use `gl_WARN_ADD' to check whether compiler flags are supported. * libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBICONV). (libguile_la_LDFLAGS): Add $(INET_NTOP_LIB) $(INET_PTON_LIB). 2009-11-17 Andy Wingo fold 1.9.5 NEWS items into the main text * NEWS: Fold 1.9.5 things into the main text. Update NEWS. * NEWS: Update for 1.9.5. Still needs these entries to be folded into the main section though. 2009-11-16 Andy Wingo with a rest arg, allow for keywords anywhere * libguile/vm-i-system.c (br-if-nargs-gt): Fix variable declaration placement. (bind-kwargs): Patch mostly by Ludovic: it seems that in the mode in which we have rest args, the keywords can appear anywhere. Bummer. Change to allow for this. * module/ice-9/optargs.scm (parse-lambda-case): Same, add a permissive-keys clause that handles the case in which there's a rest argument. 2009-11-16 Ken Raeburn SCM_DEBUG fix: Don't apply SCM_CAR to non-pairs when walking argument lists in method cache matching. * libguile/goops.c (scm_mcache_lookup_cmethod): Don't apply SCM_CAR to non-pairs when walking argument lists in method cache matching. Don't check for CLASSP or symbol in the car slot, since the end of the specifier list is a non-pair. Update comments to reflect new structure of method cache entry. * module/oops/goops/dispatch.scm: Update comments here too. 2009-11-16 Ludovic Courtès Add `iconv_open-solaris.h' to remove dependency on gperf. * lib/iconv_open-solaris.h: New file. 2009-11-16 Ludovic Courtès Use Gnulib's `alignof' module. * m4/gnulib-cache.m4: Use `alignof'. * libguile/objcodes.c (scm_c_make_objcode_slice): Use `alignof_type'. 2009-11-16 Ludovic Courtès Deprecate `inet-ntoa' and `inet-aton'. Suggested by Bruno Haible. * libguile/inet_aton.c: Remove. * libguile/Makefile.am (EXTRA_libguile_la_SOURCES): Remove `inet_aton.c'. * libguile/deprecated.c (scm_inet_aton, scm_inet_ntoa): New functions. * libguile/deprecated.h: Update accordingly. * libguile/socket.c (scm_inet_aton, scm_inet_ntoa): Remove. * doc/ref/posix.texi (Network Address Conversion): Mark `inet-ntoa' and `inet-aton' as deprecated. 2009-11-16 Ludovic Courtès Use Gnulib's `inet_ntop' and `inet_pton' modules. * m4/gnulib-cache.m4: Add `inet_ntop' and `inet_pton'. * configure.ac: Don't check for `inet_ntop' and `inet_pton'. * libguile/socket.c (scm_inet_pton, scm_inet_ntop): Compile regardless of `HAVE_INET_PTON' and `HAVE_INET_NTOP' respectively. * libguile/filesys.c: Use instead of . 2009-11-16 Ludovic Courtès Re-add an indirection in bytevectors. The intent is to allow for mmap(3) bindings and to actually reuse user-provided buffers in `scm_c_take_bytevector ()'. * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Increment. (SCM_BYTEVECTOR_CONTENTS): Take the pointer from the second word. (SCM_BYTEVECTOR_CONTIGUOUS_P): New macro. (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust to live alongside the CONTIGUOUS flag. * libguile/bytevectors.c (SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_CONTIGUOUS_P): New macros. (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust. (SCM_BYTEVECTOR_TYPED_LENGTH): Properly parenthesize. (make_bytevector): Adjust to new bytevector header. (make_bytevector_from_buffer): Reuse CONTENTS. (scm_c_shrink_bytevector): Differentiate between contiguous and non-contiguous bytevectors. 2009-11-16 Ludovic Courtès Remove unused internal bytevector functions. * libguile/bytevectors.c (scm_i_make_typed_bytevector, scm_c_take_typed_bytevector): Remove. * libguile/bytevectors.h: Adjust accordingly. 2009-11-16 Ludovic Courtès Run the GC and retry `open-file' when getting `EMFILE'. * libguile/fports.c (scm_open_file): Run the GC and retry when getting `EMFILE'. 2009-11-16 Ludovic Courtès Improve documentation of supported encoding names. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Mention IANA as the list of supported character encodings. Thanks to Bruno Haible for pointing this out. * doc/ref/api-io.texi (Ports): Likewise. Improve documentation of `%default-port-encoding'. 2009-11-16 Ken Raeburn Fix off-by-one error in processing Emacs-style coding declaration. * libguile/read.c (scm_i_scan_for_encoding): Don't copy the first character after the coding declaration into the new string. 2009-11-15 Andy Wingo opcodes for bit twiddling (ash, logand, logior, logxor) * module/language/tree-il/compile-glil.scm: * module/language/tree-il/primitives.scm: * libguile/vm-i-scheme.c (ash, logand, logior, logxor): New opcodes. class-of has an opcode * libguile/vm-i-scheme.c (class-of): New opcode. * module/language/tree-il/compile-glil.scm: * module/oop/goops.scm: Compile class-of into an opcode. faster conditionals * module/language/tree-il/compile-glil.scm (flatten): Compile `if' statements with `eq?' and `null?', and their `not?' variants, into more specific bytecode. fix (apply f) -- without the args list * module/language/tree-il/primitives.scm (apply): Only inline if we actually have an argument to apply. 2009-11-15 Andy Wingo Revert "implement #:predicate" and remove predicate from Turns out this was not a very useful idea, and semantically tricky to boot. This reverts commit 24bf130fd15afbc8b3a2ccdc50a027f9b6c9e623, and makes the following additional changes: * module/ice-9/optargs.scm (parse-lambda-case, let-optional) (let-optional*, let-keywords, let-keywords*): * module/language/tree-il.scm: (, parse-tree-il) (unparse-tree-il, tree-il->scheme, tree-il-fold, make-tree-il-folder) (post-order!, pre-order!): * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (compile-glil): * module/language/tree-il/inline.scm (inline!): Remove all traces of #:predicate from tree-il. * module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case) (chi-lambda-case): Adapt to tree-il change. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/brainfuck/compile-tree-il.scm (compile-body): * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): * test-suite/tests/tree-il.test: Adapt to tree-il change. * doc/ref/api-procedures.texi (Case-lambda): Remove mention of #:predicate. 2009-11-15 Andy Wingo actually set all 8 hashsets in classes * libguile/goops.c (prep_hashsets): Actually set all 8 hashsets. Doh... remove goops-local %tag-body * libguile/goops.c (scm_sys_tag_body): Remove goops-local hack that is no longer necessary. SCM_VALIDATE_VTABLE tweak * libguile/validate.h (SCM_VALIDATE_VTABLE): Simply call scm_struct_vtable_p. fix printing-programs bug * module/system/vm/program.scm (write-program): Fix a bug if we couldn't get a procedure's arity. values.c defines a vtable, not a vtable-vtable * libguile/values.c (scm_init_values): Define a vtable, not a "metaclass". srfi-35 properly uses vtable-offset-user * module/srfi/srfi-35.scm (condition-type-id): (condition-type-parent, condition-type-all-fields): Don't ref fixed struct indices, use vtable-offset-user instead. fix a structs.test test * test-suite/tests/structs.test ("equal?"): Instantiate vtables, not vtable-vtables. "hello" is not a valid vtable layout. 2009-11-15 Andy Wingo remove redundant, unnecessary instance size from struct vtables * libguile/struct.h (scm_struct_i_size): Remove this shared field -- I mean, the slot is still there, but it's only used for flags. * libguile/goops.h (SCM_SET_CLASS_INSTANCE_SIZE): * libguile/goops.c (scm_sys_inherit_magic_x, scm_make_class): Remove uses and definition of SCM_SET_CLASS_INSTANCE_SIZE. Light structs used it, but you have that info in the layout; and foreign classes used it, but that is going away soon anyway :) 2009-11-15 Andy Wingo fold objects.[ch] into goops.[ch] Remove objects.h #includes as appropriate. 2009-11-15 Andy Wingo remove support for "entities" -- a form of applicable struct Entities were meant to be a form of applicable struct. Unfortunately, the implementation is intertwingled with generics. Removing them, for now, will make it possible to cleanly re-add applicable struct support. * libguile/struct.h (SCM_STRUCTF_ENTITY): Remove. (SCM_STRUCTF_GOOPS_HACK): New flag; sigh. * libguile/struct.c (scm_make_struct): We make "entity" structs if the GOOPS_HACK flag is set. This will be fixed when we rework flags and remove hidden words. * libguile/goops.c (scm_class_of): Structs are not applicable, for now at least. (scm_sys_inherit_magic_x, scm_basic_basic_make_class) (scm_sys_allocate_instance, scm_sys_set_object_setter_x): (make_struct_class): Adapt for no more entities (and thus no entity flag). (create_standard_classes): For some reason, generic functions were getting the LIGHT flag set, after the ENTITY flag was removed; so for now explicitly clear that flag. * libguile/goops.h (SCM_GENERIC_SETTER, SCM_SET_GENERIC_SETTER): New macros. * libguile/objects.h: * libguile/objects.c: Remove code for entities. * libguile/debug.c: (scm_procedure_source): Only work with generics. * libguile/eval.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): Only handle generics. * libguile/eval.i.c (CEVAL): #ifdef out the pieces about entities. * libguile/procprop.c (scm_i_procedure_arity): Remove support for entities. * libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Remove entity support. 2009-11-15 Andy Wingo SCM_GENERIC_METHOD_CACHE macro splits from SCM_ENTITY_PROCEDURE * libguile/goops.h (SCM_GENERIC_METHOD_CACHE) (SCM_SET_GENERIC_METHOD_CACHE): Two new macros; the same as SCM_[SET_]ENTITY_PROCEDURE, but more reflecting the reality of the generic hack. * libguile/eval.i.c: * libguile/goops.c: * libguile/objects.c: * libguile/vm-i-system.c: Use the new macros when it is appropriate to do so. 2009-11-15 Andy Wingo remove unused things from object.[ch] * libguile/objects.h: * libguile/objects.c (scm_object_procedure): Remove, it was only compiled with SCM_DEBUG. * libguile/objects.h: * libguile/objects.c (scm_make_class_object, scm_make_subclass_object, (scm_i_make_class_object, scm_metaclass_standard): Remove also. These implemented an undocumented object system, and are totally replaced by GOOPS. 2009-11-15 Andy Wingo remove operators generic dispatch in the vm (sorta) * libguile/vm-i-system.c (call, goto/args, mv-call): Add a case for generics, so we can avoid the evaluator in that case. Still have to cons up a list -- the real solution comes later. remove unused struct gc chain macros * libguile/struct.h (SCM_STRUCT_GC_CHAIN, SCM_SET_STRUCT_GC_CHAIN): Remove, no longer necessary given topological finalization, provided by libGC. de-inline goops dispatch from the evaluator * libguile/eval.i.c: De-inline goops dispatch from the evaluator. Part of a refactor. 2009-11-14 Andreas Rottmann add quasisyntax * module/Makefile.am: * module/ice-9/boot-9.scm: * module/ice-9/quasisyntax.scm: Add quasisyntax. Implementation by Andre van Tonder, patch by Andreas Rottmann. * test-suite/tests/srfi-10.test: Hack to remove srfi-10's clobbering of #,. * test-suite/tests/syncase.test: Add a quasisyntax test. 2009-11-14 Andy Wingo add include-from-path * module/ice-9/psyntax.scm (include-from-path): New syntax. Searches the load path for a file, and includes it. psyntax.scm uses #' shorthand for (syntax ...) * module/ice-9/psyntax.scm: Convert to use #'. 2009-11-14 Ludovic Courtès Add currently failing tests for optargs. * test-suite/tests/optargs.test (exception:unrecognized-keyword, exception:extraneous-arguments): New variables. ("define*")["extraneous arguments", "unrecognized keyword", "rest given before keywords"]: New tests. Explicitly disable TLS on NetBSD 5.0. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Explicitly disable TLS on NetBSD 5.0. 2009-11-14 Ludovic Courtès Have `scm_scan_for_encoding ()' use GC-managed memory. * libguile/read.c (scm_scan_for_encoding): Rename to ... (scm_i_scan_for_encoding): ... this; update callers. Use `scm_gc_strndup ()' instead of `scm_malloc ()'. * libguile/read.h: Update accordingly. * libguile/load.c (scm_primitive_load): Don't call free(3) on the value returned by `scm_i_scan_for_encoding ()'. 2009-11-14 Ludovic Courtès Replace `setbinary' by a public `%default-port-encoding' fluid. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Add reference to the "Ports" node. * doc/ref/api-io.texi (Ports): Document `%default-port-encoding'. * libguile/ports.c (scm_port_encoding_var): Rename to... (default_port_encoding_var): ... this; update callers. Make `static'. * libguile/posix.c (scm_setbinary): Remove. * libguile/posix.h: Adjust accordingly. * test-suite/tests/numbers.test: Remove unneeded `setbinary' call. * test-suite/tests/ports.test: Replace `setbinary' call by equivalent `%default-port-encoding' mutation and `set-port-encoding!' calls. * test-suite/tests/r6rs-ports.test: Replace `setbinary' call by equivalent `%default-port-encoding' mutation. 2009-11-14 Ludovic Courtès Explicitly require `sed'. * configure.ac: Use `AC_PROG_SED'. 2009-11-14 Andy Wingo fix bugs in ecmascript compiler * module/language/ecmascript/compile-tree-il.scm: Fix a number of bugs, fallen out from the ghil->tree-il conversion. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add a hack for "return" for javascript. Scheme shouldn't see this because it's not an "interesting primitive". 2009-11-14 Andy Wingo fix scoping in let-keywords * module/ice-9/optargs.scm (let-keywords): I thought that I had the scoping right here, but I didn't. Make sure that the lambda formals for the initializers are new, fresh identifiers, so that let scoping works appropriately. fix bug in string comparison * libguile/srfi-13.c (compare_strings): Switch the "longer" and "shorter" arguments. All the callers of this function assumed that shorter came first. Fixes (string Improve the printer of SRFI-35 error conditions. * module/srfi/srfi-35.scm (print-condition): Print the name and value of each field. 2009-11-08 Ludovic Courtès Add support for multiple arities in `arity-mismatch-analysis'. * module/language/tree-il/analyze.scm (validate-arity)[arity]: Rename to... [arities]: ... this. Return all the arities of PROC. Update caller accordingly. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("case-lambda", "case-lambda with wrong number of arguments", "case-lambda*", "case-lambda* with wrong arguments"): New tests. 2009-11-08 Ludovic Courtès Update `.gitignore'. Fix C99-style comments. * libguile/generalized-vectors.c, libguile/programs.c, libguile/vm.c: Replace C99-style comments by plain old C89 comments. Compile with `-Warity-mismatch'. * am/guilec (GUILE_WARNINGS): New variable; add `-Warity-mismatch'. (.scm.go): Use it. Add tests for `unbound-variable-analysis'. * test-suite/tests/tree-il.test ("warnings")["unbound variable"]("optional arguments are visible", "keyword arguments are visible"): New tests. Fix optional argument handling in `unused-variable-analysis'. * module/language/tree-il/analyze.scm (unused-variable-analysis): Fix optional argument handling in . 2009-11-08 Ludovic Courtès Add support for keyword arguments in `arity-mismatch-analysis'. * module/language/tree-il/analyze.scm (validate-arity)[filter-keyword-args]: New procedure. [arity]: Get accurate arity for programs, return ALLOW-OTHER-KEYS? as an additional value. Update to `arity' change; use `filter-keyword-args'. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("keyword not passed and quiet", "keyword passed and quiet", "keyword passed to global and quiet", "extra keyword", "extra keywords allowed"): New tests. 2009-11-07 Ludovic Courtès Fix typos leading to wrong argument counts. * module/ice-9/channel.scm (eval): Fix number of arguments to `guile:eval'. * module/oop/goops/save.scm (write-readably): Fix number of arguments to `write-array'. * module/srfi/srfi-19.scm (priv:char->int): Fix number of arguments to `priv:time-error'. 2009-11-07 Ludovic Courtès Fix typos in `psyntax'. * module/ice-9/psyntax.scm (lambda*-formals): Fix argument count in `rest' invocations. [pred]: Fix argument count in `syntax->datum' invocation. 2009-11-07 Ludovic Courtès Add `arity-mismatch' warning type. * module/language/tree-il/analyze.scm (): New record type. (validate-arity, arity-analysis): New variables. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `arity-mismatch'. * module/system/base/message.scm (%warning-types): Likewise. * test-suite/tests/tree-il.test (read-and-compile): Remove, as it's now public. (%opts-w-arity): New. ("warnings")["arity mismatch"]: New test prefix. 2009-11-06 Ludovic Courtès Coalesce tree traversals made for warnings. * module/language/tree-il/analyze.scm (): New type. (analyze-tree): New procedure. (report-unused-variables): Replace by... (unused-variable-analysis): ... this, as a . (report-possibly-unbound-variables): Replace by... (unbound-variable-analysis): ... this, as a . * module/language/tree-il/compile-glil.scm (%warning-passes): Adjust accordingly. (compile-glil): Likewise. Use `analyze-tree'. 2009-11-05 Ludovic Courtès Hold the GC lock when traversing weak hash table buckets. * libguile/hashtab.c (scm_fixup_weak_alist): Clarify comment. (struct t_assoc_args): New. (do_weak_bucket_assoc, weak_bucket_assoc): New. (START_WEAK_BUCKET_FIXUP, END_WEAK_BUCKET_FIXUP): Remove. (scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_remove_x): Use `weak_bucket_assoc ()' instead of `START_WEAK_BUCKET_FIXUP'/`END_WEAK_BUCKET_FIXUP'. Fix snarfing of `SCM_DEFINE' with static allocation. * libguile/snarf.h (SCM_DEFINE)[SCM_SUPPORT_STATIC_ALLOCATION]: Provide a declaration for FNAME since the last argument to `SCM_IMMUTABLE_SUBR ()' refers to it. 2009-11-04 Neil Jerram Fill code coverage holes in continuations.c and keywords.c * test-suite/Makefile.am (SCM_TESTS): Add tests/keywords.test. * test-suite/standalone/Makefile.am (test-loose-ends): New test. * test-suite/standalone/test-loose-ends.c: New file. * test-suite/tests/continuations.test: Three new tests. * test-suite/tests/keywords.test: New file. 2009-11-03 Neil Jerram Increase benchmark iterations to improve precision in comparisons over time * benchmark-suite/benchmarks/continuations.bm: Increase "call/cc" iterations from 300 to 12000. * benchmark-suite/benchmarks/srfi-13.bm ("strings"): Increase "copy" iterations from 1100 to 20000, and "pad" from 6800 to 34000. * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): Increase "uniform-vector-write" iterations from 500 to 4000, and "uniform-vector-read!" from 500 to 20000. 2009-11-02 Ludovic Courtès Allocate vectors in a contiguous memory area. * libguile/vectors.c (scm_c_make_vector): Allocate the whole vector and header with `scm_gc_malloc ()'. (scm_vector_copy): Use `scm_c_make_vector ()'. (scm_i_vector_free, MAKE_WEAK_VECTOR): Remove. (allocate_weak_vector): Rename to... (make_weak_vector): ... this. Change to return the whole weak vector, allocated with `scm_gc_malloc_pointerless ()'. (scm_i_make_weak_vector, scm_i_make_weak_vector_from_list): Use `make_weak_vector ()'. * libguile/vectors.h (SCM_I_VECTOR_HEADER_SIZE): New macro. (SCM_I_VECTOR_ELTS): Write in terms of `SCM_I_VECTOR_WELTS ()'. (SCM_I_VECTOR_WELTS): Update to the new representation. (SCM_I_WVECT_EXTRA, SCM_I_SET_WVECT_EXTRA): Likewise. (SCM_I_WVECT_GC_CHAIN, SCM_I_SET_WVECT_GC_CHAIN): Remove. * libguile/weaks.h (SCM_I_WVECT_DELTA, SCM_I_SET_WVECT_DELTA): Remove. 2009-11-01 Ludovic Courtès Restore signature of `scm_search_path ()' as found in 1.8. The incompatibly was introduced by 22f4ee48822db5e30df3abf9a11b6066f2bab9d3 ("make primitive-load-path load compiled files if available"). * doc/ref/api-options.texi (Build Config): Update `search-path' documentation. * libguile/load.c (scm_search_path): Change C prototype to expect only 3 arguments. Parse the rest argument accordingly. Update callers. * libguile/load.h (scm_search_path): Update accordingly. 2009-11-01 Ludovic Courtès Merge branch 'bdw-gc-static-alloc' Conflicts: acinclude.m4 libguile/__scm.h libguile/bdw-gc.h libguile/eval.c 2009-10-30 Ken Raeburn Clean up some uses of old GC macros that don't exist any more. * libguile/deprecated.h (SCM_GC8MARKP, SCM_SETGC8MARK, SCM_CLRGC8MARK): Delete. * libguile/gc.c (scm_assert_cell_valid): Remove check of SCM_GC_MARK_P. 2009-10-30 Ken Raeburn Since support for "futures" in C has been completely disabled for some time, and should be easily implementable in Scheme with the current thread support, delete the C code. * libguile/futures.c, libguile/futures.h: Delete. * libguile/Makefile.am (libguile_la_SOURCES, DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Delete references to futures.* files. * libguile.h: Don't include futures.h. * libguile/eval.c: Don't include futures.h. (isymnames): Delete "#@future" entry. (scm_m_future, s_future, scm_sym_future, unmemoize_future, unmemoize_builtin_macro): Delete disabled futures code. * libguile/eval.i.c (CEVAL): Delete disabled futures code. * libguile/init.c: Don't include futures.h. (scm_i_init_guile): Delete disabled futures initialization call. * libguile/tags.h (SCM_IM_FUTURE): Delete. (SCM_IM_CALL_WITH_VALUES, SCM_IM_ELSE, SCM_IM_ARROW, SCM_IM_NIL_COND, SCM_IM_BIND): Renumber. * doc/ref/api-scheduling.texi: Delete commented-out node on Futures. * doc/maint/guile.texi: Delete make-future and future-ref mentions. 2009-10-30 Ken Raeburn * meta/gdb-uninstalled-guile.in: Specify a path to libtool. Fix autogen.sh for Mac OS X. * autogen.sh: If uname indicates that the OS is Darwin, run "glibtool" instead of "libtool" for the version number check. 2009-10-28 Michael Gran Fix incorrect display of wide strings in decompilation A byte ordering error caused incorrect display of wide strings when using the ",c" decompilation from the REPL. * module/language/assembly/decompile-bytecode.scm (decode-bytecode): wide strings are encoded in native endianness 2009-10-28 Michael Gran Modify bytevectors/string conversions to allow wide strings The bytevector to string conversion functions were accomplished by converting via locale strings. This did not allow conversions of wide strings in an 8-bit locale. This is avoided by using knowledge of the storage format of the string. * libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8): modify string to bytevector conversion to use internal string information (UTF_TO_STRING, scm_utf8_to_string): modify bytevector to string conversion 2009-10-27 Mark H Weaver fix nil handling in the vm * libguile/vm-i-scheme.c (not, not-not): Treat nil as false. (null?, not-null?): Treat nil as null. * libguile/vm-i-system.c (br-if, br-if-not): Treat nil as false. (br-if-null, br-if-not-null): Treat nil as null. 2009-10-27 Mark H Weaver the cube of lisp booleans (#f nil () #t) * Renumbers the IFLAG constants. * Adds several macros related to boolean type tests, null tests, and boolean-truth testing (including lisp-style boolean-truth tests). * Adds compile-time checks to verify the necessary IFLAG numbering properties needed for the checks to work properly. * Changes some existing code to use the new optimized macros, without changing the semantics of the code at all (except that scm_is_bool is changed from a function to a macro). I added the following macros, whose names explicitly state how %nil should be handled. See the comments in the patch for more information about these. scm_is_false_assume_not_lisp_nil scm_is_true_assume_not_lisp_nil scm_is_false_and_not_lisp_nil scm_is_true_or_lisp_nil scm_is_false_or_lisp_nil scm_is_true_and_not_lisp_nil scm_is_lisp_false scm_is_lisp_true scm_is_null_assume_not_lisp_nil scm_is_null_and_not_lisp_nil scm_is_null_or_lisp_nil scm_is_bool_and_not_lisp_nil scm_is_bool_or_lisp_nil The following already-existing macros are defined as aliases, such that their semantics is unchanged (although scm_is_bool used to be a function and is now a macro). scm_is_null --> scm_is_null_and_not_lisp_nil scm_is_false --> scm_is_false_and_not_lisp_nil scm_is_true --> scm_is_true_or_lisp_nil scm_is_bool --> scm_is_bool_and_not_lisp_nil (I still believe that these should be changed to versions that handle %nil properly, but await approval on that point, so these patches do not make those changes) Also, if the preprocessor macro SCM_ENABLE_ELISP is not true (this macro already existed and was used in lang.h), all overheads associated with %nil handling are eliminated from the above macros. * libguile/tags.h (SCM_BOOL_F, SCM_BOOL_T, SCM_UNSPECIFIED) (SCM_UNDEFINED, SCM_UNBOUND, SCM_ELISP_NIL): Renumber, so that a number of important distinctions (false versus true, end-of-list, etc) can be made by masking a single bit. Also define a number of build-time tests to assert that this condition holds. * libguile/boolean.h (scm_is_false_and_not_nil, scm_is_true_or_nil) (scm_is_false_assume_not_nil, scm_is_true_assume_not_nil): (scm_is_false_or_nil, scm_is_true_and_not_nil) (scm_is_bool_or_nil, scm_is_bool_and_not_nil): New exciting macros to test certain boolean/end-of-list properties. (scm_is_false, scm_is_true): Use a restrictive definition, where only SCM_BOOL_F is false. Should probably change in the future. (scm_is_bool): Incompatible change: changed to be a macro. Was a function before. Probably should allow nil as a boolean, but that will be for a later patch. (scm_is_lisp_false, scm_is_lisp_true): New macros, implementing the standard Lisp boolean predicates, where '() is actually false. * libguile/eval.i.c (CEVAL): Fix a number of false-or-nil and similar tests to use the new macros. * libguile/lang.h (SCM_NULL_OR_NIL_P): Use scm_is_null_or_nil. * libguile/pairs.c: Add a compile-time check that null and nil differ by only one bit. * libguile/pairs.h (scm_is_null_and_not_nil, scm_is_null_assume_not_nil) (scm_is_null_or_nil): New exciting macros! (scm_is_null): Just be scm_is_null_and_not_nil, for now. * libguile/print.c: Adapt to the reordering, and print suitably nasty things for the not-to-be-used values. 2009-10-27 Ludovic Courtès Use proper fold/for-each function types in `hashtab.h'. * libguile/hashtab.h (scm_t_hash_fold_fn, scm_t_hash_handle_fn): New types. (scm_internal_hash_fold, scm_internal_hash_for_each_handle): Use them. * libguile/hashtab.c (scm_internal_hash_fold): Take an `scm_t_hash_fold_fn'. Update callers. (scm_internal_hash_for_each_handle): Take an `scm_t_hash_handle_fn'. Update callers. 2009-10-27 Ludovic Courtès Use proper assoc/hash function types in `hashtab.c'. This is a followup to d587c9e8b27219e68f8813fb648fc6913c93be0f ("Use proper types for hash/assoc functions in `hashtab.h'."). * libguile/hashtab.c (scm_i_rehash, scm_hash_fn_create_handle_x, scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Use `scm_t_hash_fn' and `scm_t_assoc_fn' as appropriate. 2009-10-27 Andy Wingo update procedure docs for programs, lambda*, case-lambda * module/system/vm/program.scm: Export the arity things again, and program-arity. Why not. * doc/ref/api-procedures.texi (Compiled Procedures): Update for current API. (Optional Arguments): Update to assume lambda* and define* are always available, and (ice-9 optargs) is now the ghetto. (Case-lambda): Now here, moved from SRFI-16 docs. Also docs case-lambda*. * doc/ref/srfi-modules.texi: Point to core case-lambda docs. 2009-10-26 Andy Wingo implement #:predicate will be useful for making e.g. typecase-lambda. Tough to tell though. * module/ice-9/psyntax.scm (lambda-formals, lambda*-formals): Parse out a #:predicate, which goes right before the rest args. The vanilla lambda doesn't parse it out of course, but it does return another value. (chi-lambda-case, lambda*, lambda): Expand and pass the predicate on to build-lambda-case. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il/compile-glil.scm (flatten): Compile a failing predicate without an else clause into a call to `error'. Also, fix something the compile warnings caught. 2009-10-26 Ludovic Courtès Don't use memset(3) after `GC_MALLOC ()' calls. * libguile/gc-malloc.c (scm_gc_calloc): Don't use memset(3) as it's not needed. Reported by Andy Wingo. 2009-10-25 Julian Graham Resolve warning in gcc-4.3 about transposed parameters passed to memset * libguile/gc-malloc.c (scm_gc_calloc): Add explicit check on size parameter 2009-10-25 Ludovic Courtès SRFI-35: Provide nice vtable names, to make GOOPS happier. * module/srfi/srfi-35.scm (%make-condition-type): New procedure. (make-condition-type, make-compound-condition-type): Use it. * test-suite/tests/srfi-35.test ("condition types")["struct-vtable-name"]: New test. 2009-10-25 Ludovic Courtès Fix GOOPS `class-of' for nameless structs. * libguile/goops.c (scm_class_of): Fix second argument for `scm_make_extended_class_from_symbol ()' for nameless structs. * test-suite/tests/goops.test ("classes for built-in types")["struct vtable"]: New test case. 2009-10-25 Andy Wingo srfi-16 just re-exports psyntax's case-lambda * module/srfi/srfi-16.scm (case-lambda): Just re-export the core's case-lambda, it's semantically the same but faster and better integrated. 2009-10-25 Andy Wingo case-lambda, case-lambda* in psyntax * module/ice-9/psyntax.scm (case-lambda, case-lambda*): Add implementations of these, present in the base environment. * module/ice-9/psyntax-pp.scm: Regenerated. * module/srfi/srfi-16.scm (case-lambda): Replace the core's case-lambda definition with our own. We're not quite ready to switch yet. 2009-10-25 Andy Wingo assembly/disassembly support for br-if-nargs-* * module/language/assembly/compile-bytecode.scm (write-bytecode): Handle br-if-nargs compilation. * module/language/assembly/decompile-bytecode.scm (decode-load-program): And decompile them nicely as well. * module/language/assembly/disassemble.scm (code-annotation): And, present the disassembly if br-if-nargs-* nicely. 2009-10-25 Andy Wingo arities can have noncontiguous starts and ends * module/language/glil/compile-assembly.scm (open-arity, close-arity) (begin-arity, glil->assembly): Refactor so that arities can have noncontiguous starts and ends. So within a prelude there is no arity -- only before (the previous arity) or after (the new arity). * module/system/vm/program.scm (arity:end): Add this private accessor. Arities are expected to be in the new format. While not a change in objcode format, it is an incompatible change, so I'll bump the objcode cookie. (program-arity): Check that the ip is within both bounds of the arity. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/programs.c (scm_i_program_arity): Update for new arity format. * module/system/vm/frame.scm (vm-frame-arguments): Avoid throwing an error in this function, which is called from the backtrace code. 2009-10-25 Andy Wingo refactor psyntax.scm's treatment of lambda and lambda* * module/ice-9/psyntax.scm (lambda-formals, chi-simple-lambda) (lambda*-formals, chi-lambda-case): Refactor the lambda transformations with an eye to being able to do case-lambda. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syntax.test: Adapted tests so that the errors we expect match what is given by psyntax. 2009-10-24 Andy Wingo define* in psyntax * module/ice-9/optargs.scm: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: Make define* available in the default environment, as lambda* is available there. procedure property table is only key-weak, not doubly-weak * libguile/procprop.c: Make the procedure property table only key-weak. It seems that we want the association as long as the key is around. 2009-10-23 Ken Raeburn Reduce some errors under -DSCM_DEBUG=1. * goops.c (scm_sys_modify_instance, scm_sys_modify_class): Use SCM_{,SET_}CELL_WORD_[01] instead of SCM_{,SET}C[AD]R since the objects passed are not pairs. 2009-10-23 Andy Wingo (ice-9 optargs) based on the new lambda* work * module/ice-9/optargs.scm (let-optional, let-optional*, let-keywords) (let-keywords*): Implement in terms of parse-lambda-case, so all the logic is in one place. (lambda*): Re-export from the default environment -- it's all in the VM now :-)) (define*, define*-public, defmacro*, defmacro*-public): Implement with syntax-case. 2009-10-23 Andy Wingo lambda* in psyntax * module/ice-9/psyntax.scm (build-lambda-case): Take an "inits" arg. Also work around a nasty memoizer bug: see http://article.gmane.org/gmane.lisp.guile.devel/9561. (lambda*): Implement in psyntax, in the default environment. Exciting stuff! * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/optargs.scm (parse-lambda-case): Helper for lambda* when we're running under the interpreter. 2009-10-23 Andy Wingo separate "inits" field in ; compile fixes for inits, kwargs * module/language/tree-il.scm (): Add "inits" field, so we don't have to parse it out of opt and kw. Adapt the traversal procedures. * module/language/tree-il/analyze.scm (analyze-lexicals): Analyze lexicals in the init expressions as well. Fix keyword allocation. * module/language/tree-il/compile-glil.scm (compile-glil): Adapt to make-lambda-case change. (flatten): Adapt to "inits" slot, actually init uninitialized args, and fix bugs related to keyword arguments. * module/language/tree-il/inline.scm (inline!): Adapt a little bit -- but with no effect. * module/language/glil/compile-assembly.scm (glil->assembly): Flesh out compilation some more. Add a "bound?" op for , which will push #t if the local is bound. * module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case): Update for new signature of make-lambda-case. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/brainfuck/compile-tree-il.scm (compile-body): * module/language/ecmascript/compile-tree-il.scm (comp): * test-suite/tests/tree-il.test ("lambda"): Update for new lambda-case syntax. 2009-10-23 Andy Wingo add some optargs tests * libguile/modules.c (scm_module_lookup, scm_lookup): Throw to 'unbound-variable, like eval.i.c does. * test-suite/tests/optargs.test: Add an optargs test. Run optargs tests under both the VM and the interpreter. 2009-10-23 Andy Wingo vm support for optional/kwarg init code, and bugfixes * libguile/vm-i-system.c (local-bound?, long-local-bound?) (variable-bound?): New instructions, push #f unless the local is bound. You can get unbound locals from optional arguments. (bind-optionals/shuffle): A number of bugfixes. (bind-kwargs): Bugfixes. If we enocunter an improper kwarg list but the procedure has a rest argument, just stop kwarg processing, but without an error. Renumbered ops. * libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump. 2009-10-23 Andy Wingo more work towards compiling and interpreting keyword args * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bumparoo * libguile/vm-i-system.c (push-rest, bind-rest): Logically there are actually two rest binders -- one that pops, conses, and pushes, and one that pops, conses, and local-sets. The latter is used on keyword arguments, because the keyword arguments themselves have been shuffled up on the stack. Renumber ops again. * module/language/tree-il/compile-glil.scm (flatten): Attempt to handle compilation of lambda-case with keyword arguments. Might need some help. * module/ice-9/psyntax.scm (build-lambda-case): An attempt to handle the interpreted case correctly. This might need a couple iterations, but at least it looks like the compile-glil code. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/glil.scm (): Rename "rest?" to "rest" in and , as it is no longer a simple boolean, but if true is an integer: the index of the local variable to which the rest should be bound. * module/language/glil/compile-assembly.scm (glil->assembly): Adapt to "rest" vs "rest?". In the keyword case, use "bind-rest" instead of "push-rest". * test-suite/tests/tree-il.test: Update for opt-prelude change. 2009-10-23 Andy Wingo finish support for optional & keyword args; update ecmascript compiler * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (br-if-nargs-ne, br-if-args-lt) (br-if-nargs-gt): New instructions, for use by different lambda cases. (bind-optionals, bind-optionals/shuffle, bind-kwargs): New instructions, for binding optional and keyword arguments. Renumber other ops. * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): Update for new tree-il. Use the new optional argument mechanism instead of emulating it with rest arguments. * module/language/glil/compile-assembly.scm (glil->assembly): Tweaks for optional and keyword argument compilation. * module/language/tree-il.scm (parse-tree-il, unparse-tree-il): Make the else case optional, in the s-expression serialization of tree-il. * module/language/tree-il/compile-glil.scm (flatten): Handle all of the lambda-case capabilities. 2009-10-23 Andy Wingo fix brainfuck for new tree-il, and add tests * test-suite/Makefile.am: * test-suite/tests/brainfuck.test: Add a brainfuck test. * module/system/base/compile.scm: Also export read-and-compile. * module/language/tree-il/spec.scm (join): Fix the joiner in the 0-expression case. * module/language/tree-il/primitives.scm (+): Recognize (+ x -1) as 1-. * module/language/brainfuck/parse.scm (read-brainfuck): Return EOF if we actually received EOF, and there were no expressions read. * module/language/brainfuck/compile-tree-il.scm (compile-body): Fix the compiler for the new format of "lambda" in tree-il. 2009-10-23 Andy Wingo tree-il support for case-lambda * module/language/tree-il.scm (, ): Split lambda into the lambda itself, denoting the procedure, and lambda-case, denoting a particular arity case. Lambda-case is fairly featureful, and has not yet been fully tested. (): Use a as the binding expression. Seems to suit the purpose well. Adapt parsers, unparsers, traversal operators, etc. Sometimes in this first version we assume there are no optional args, rest args, or a predicate. * module/language/tree-il/analyze.scm (analyze-lexicals): Adapt for the new case-lambda regime. Fairly well commented. It actually simplifies things. (report-unused-variables): Update for new tree-il. * module/language/tree-il/compile-glil.scm: Adapt for the new tree-il. There are some first stabs here at proper case-lambda compilation, but they are untested as of yet. * module/language/tree-il/inline.scm (inline!): Rework so we can recurse on a single node; though these transformations are strictly reductive, so they should complete in bounded time. Simplify accordingly, and adapt to case-lambda. Oh, and we handle lambda->let in not just the nullary case. * module/ice-9/psyntax.scm (build-simple-lambda, build-case-lambda) (build-lambda-case): New constructors. The idea is that after syntax expansion, we shouldn't have to deal with improper lists any more. Build-simple-lambda is a shortcut for the common case. The others are not fully exercised yet. Adapt callers. (syntax): Add some debugging in the lambda case. I don't fully understand this, but in practice we don't seem to see rest args here. (lambda): Inline chi-lambda-clause, and adapt for build-simple-lambda. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/tree-il.test: Update tests for new tree-il lambda format, and to expect post-prelude labels for all glil programs. 2009-10-23 Andy Wingo procedure property efficiency tweak * libguile/procprop.c (scm_procedure_property) scm_set_procedure_property_x): Fix to not call scm_procedure_properties(), and thus to avoid consing up the arity as well. 2009-10-23 Andy Wingo flesh out glil support for optional and keyword arguments * libguile/vm-i-system.c (bind-rest): Renamed from push-rest-list. (reserve-locals): Change so that instead of reserving space for some additional number of locals, reserve-locals takes the absolute number of locals, including the arguments. * module/language/glil.scm (, ) (): New GLIL constructs, to replace . * module/language/glil/compile-assembly.scm (glil->assembly): Compile the new preludes. Some instructions are not yet implemented, though. * module/language/tree-il/analyze.scm (analyze-lexicals): The nlocs for a lambda will now be the total number of locals, including arguments. * module/language/tree-il/compile-glil.scm (flatten-lambda): Update to write the new prelude. * module/system/vm/program.scm (program-bindings-for-ip): If a given index doesn't have a binding at the ip given, don't cons it on the resulting list. * test-suite/tests/tree-il.test: Update for GLIL changes. 2009-10-23 Andy Wingo de-nargs struct scm_objcode; procedure-property refactor * libguile/objcodes.h (struct scm_objcode): Remove nargs, nrest, and nlocs, as they are no longer needed. Also obviates the need for a padding word. * libguile/procs.c (scm_thunk_p): Use scm_i_program_arity for programs. * libguile/procprop.c (scm_i_procedure_arity): Use scm_i_program_arity for programs. (scm_procedure_properties, scm_set_procedure_properties_x) (scm_procedure_property, scm_set_procedure_property_x): Rework so that non-closure properties are stored directly in a weak hash, instead of needing a weak hash of "stand-in" closures to hold the properties. Fix docstrings also. * libguile/root.h (scm_stand_in_procs): Remove from the scm_sys_protects set. Actually with libGC, we should be able to store the elements of scm_sys_protects directly as global variables. * libguile/gc.c (scm_init_storage): Remove scm_stand_in_procs initialization. * libguile/programs.c (scm_i_program_arity): New private accessor, tries to determine the "minimum arity" of a program. * libguile/vm.c (really_make_boot_program): Adapt to changes in struct scm_objcode. * module/language/assembly.scm (*program-header-len*, byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): Adapt to changes in objcode. * module/system/xref.scm (program-callee-rev-vars): Adapt to changes in assembly. * module/language/glil.scm: Remove nargs, nrest, and nlocs from glil-program. * module/language/glil/compile-assembly.scm (make-meta, glil->assembly): * module/language/glil/decompile-assembly.scm (decompile-toplevel): (decompile-load-program): Adapt to changes in GLIL and assembly. * module/language/tree-il/compile-glil.scm (flatten-lambda): Adapt to changes in GLIL. * test-suite/tests/asm-to-bytecode.test: Adapt to assembly and bytecode changes. * test-suite/tests/tree-il.test: Adapt to GLIL changes. 2009-10-23 Andy Wingo callees now check their args, cons rest list, reserve locals * gdbinit: Ignore SIGPWR and SIGXCPU, which the BDW GC seems to use. * libguile/vm-engine.h (FETCH_WIDTH): Remove unused macro. (INIT_ARGS, INIT_FRAME): Remove; callees now check their args and reserve space for their locals. * libguile/vm-engine.c: * libguile/vm-i-system.c: Turn on callee arg checking and local reservation. Seems to work! 2009-10-23 Andy Wingo callees reserve their own local vars * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (reserve-locals): New instruction, to reserve space for local vars. Other ops renumbered. * module/language/tree-il/compile-glil.scm (flatten-lambda): Emit reserve-locals instructions as necessary. * test-suite/tests/tree-il.test: Update to expect reserve-locals as appropriate. 2009-10-23 Andy Wingo runtime and debugging support for callee-parsed procedure args * libguile/objcodes.h: Bump for metadata format change. * libguile/frames.h: Rework so we don't frob the program's nargs, nlocs, etc at runtime. Instead we don't really know what's a local var, an argument, or an intermediate value. It's a little unfortunate, but this will allow for case-lambda, and eventually for good polymorphic generic dispatch; and the nlocs etc can be heuristically reconstructed. Such a reconstruction would be better done at the Scheme level, though. (SCM_FRAME_STACK_ADDRESS): New macro, the pointer to the base of the stack elements (not counting the program). (SCM_FRAME_UPPER_ADDRESS): Repurpose to be the address of the last element in the bookkeeping part of the stack -- i.e. to point to the return address. * libguile/vm-engine.h: * libguile/vm-i-system.c: Adapt to removal of stack_base. Though we still detect stack-smashing underflow, we don't do so as precisely as we did before, because now we only detect overwriting of the frame metadata. * libguile/vm-engine.c (vm_engine): Remove the stack_base variable. It is unnecessary, and difficult to keep track of in the face of case-lambda. Also fix miscommented "ra" and "mvra" pushes. Push the vp->ip as the first ra... * libguile/vm-i-system.c (halt): ...because here we can restore the vp->ip instead of setting ip to 0. Allows us to introspect ips all down the stack, including in recursive VM invocations. * libguile/frames.h: * libguile/frames.c (scm_vm_frame_stack): Removed, because it's getting more difficult to tell what's an argument and what's a temporary stack element. (scm_vm_frame_num_locals): New accessor. (scm_vm_frame_instruction_pointer): New accessor. (scm_vm_frame_arguments): Defer to an implementation in Scheme. (scm_vm_frame_num_locals scm_vm_frame_local_ref) (scm_vm_frame_local_set_x): Since we can get not-yet-active frames on the stack now, with our current calling convention, we have to add a heuristic here to jump over those frames -- because frames have pointers in them, not Scheme values. * libguile/programs.h: * libguile/programs.c (scm_program_arity): Remove, in favor of.. (scm_program_arities): ...this, which a list of arities, in a new format, occupying a slot in the metadata. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Fix mv-call decompilation. * module/system/vm/frame.scm (vm-frame-bindings, vm-frame-binding-ref) (vm-frame-binding-set!): New functions, to access bindings by name in a frame. (vm-frame-arguments): Function now implemented in Scheme. Commented fairly extensively. * module/system/vm/program.scm (program-bindings-by-index) (program-bindings-for-ip): New accessors, parsing the program bindings metadata into something more useful. (program-arities, program-arguments): In a case-lambda world, we have to assume that programs can have multiple arities. But it's tough to detect this algorithmically; instead we're going to require that the program metadata include information about the arities, and the parts of the program that that metadata applies to. (program-lambda-list): New accessor. (write-program): Show multiple arities. * module/language/glil/compile-assembly.scm (glil->assembly): Add "arities" to the state of the compiler, and add arities entries as appropriate. 2009-10-23 Andy Wingo steps on the way to have the callee check the number of arguments * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (assert-nargs-ee, assert-nargs-ge) (push-rest-list): New instructions, which for now don't actually do anything. Renumber the rest of the ops in this file. * module/language/glil.scm (): New GLIL type, an entity that checks the number of args for a block, optionally consing a rest list, and either branching or erroring if the arity doesn't match. * module/language/glil/compile-assembly.scm (glil->assembly): Compile to assembly. Some of these VM ops are not implemented -- notably the branching case. * module/language/tree-il/compile-glil.scm (flatten-lambda): Emit . * test-suite/tests/tree-il.test: Update. 2009-10-22 Ludovic Courtès Compile Guile modules with `-Wunbound-variable'. * am/guilec (.scm.go): Compile with `-Wunbound-variable'. 2009-10-22 Ludovic Courtès Fix typos leading to unbound variable references. * module/ice-9/session.scm (help): Fix unbound reference to `env'. * module/system/vm/program.scm (program-property): Fix typo. * module/system/vm/frame.scm: Add missing `#:use-module (system vm objcode)'. * module/system/repl/command.scm (guile:load): New. (load): Use either `primitive-load' or `load'. * module/srfi/srfi-18.scm (thread-sleep!): Fix typo. * module/srfi/srfi-19.scm: Use `(ice-9 rdelim)'. (date->broken-down-time, priv:year-day, priv:char->int): Fix typo. (time-*->time-*, time-*->time-*!): Fix reference to unbound variable `caller'. * module/oop/goops.scm (bound-check-get): Fix typo. * module/language/glil/compile-assembly.scm (glil->assembly): Fix typo. * module/language/glil.scm (parse-glil): Fix typo. * module/language/ecmascript/base.scm (object->value/string, object->value/number, ->number): Fix typos. * module/language/assembly/disassemble.scm (disassemble-free-vars): Fix typo. 2009-10-22 Ludovic Courtès Adjust `unbound-variable' GOOPS heuristic for `goops.scm'. * module/language/tree-il/analyze.scm (goops-toplevel-definition): Add ENV argument. Deal with GOOPS macros expanded within `goops.scm'. (report-possibly-unbound-variables): Adjust. Fix bytecode disassembler. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Add missing argument to `ensure-label'. SRFI-88: Call `read-set!' at compile time and run time. * module/srfi/srfi-88.scm: Call `read-set!' both at compile time and run time. Remove obsolete `save-stack' case. * module/ice-9/boot-9.scm (save-stack): Remove obsolete `tk-stack' case. 2009-10-22 Ludovic Courtès Have `-Wunbound-variable' account for GOOPS top-level definitions. * module/language/tree-il/analyze.scm (goops-toplevel-definition): New procedure. (report-possibly-unbound-variables): Check for GOOPS top-level definitions. * test-suite/tests/tree-il.test ("warnings")["GOOPS definitions are visible"]: New test. 2009-10-21 Ludovic Courtès Add a `guile-2' SRFI-0 feature. * doc/ref/srfi-modules.texi (SRFI-0): Mention the `guile-2' feature. * module/ice-9/boot-9.scm (%cond-expand-features): Add `guile-2'. 2009-10-20 Ludovic Courtès Use proper types for hash/assoc functions in `hashtab.h'. Partly fixes bug #23681 ("Function declarators with empty parentheses should not be used"). * libguile/goops.c (scm_wrap_component): Cast `scm_sloppy_assq'. * libguile/hashtab.c (scm_hash_fn_get_handle): Update to take functions of type `scm_t_hash_fn' and `scm_t_assoc_fn'. Update callers. (scm_ihashx): Change to match `scm_t_hash_fn'. (scm_sloppy_assx): Change to match `scm_t_assoc_fn'. * libguile/hashtab.h (scm_t_hash_fn, scm_t_assoc_fn): New types. (scm_t_hashtable)[hash_fn]: Change to `scm_t_hash_fn'. (scm_i_rehash, scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Change to take `scm_t_hash_fn' and `scm_t_assoc_fn' parameters. * libguile/srcprop.h (scm_whash_get_handle, scm_whash_create_handle, scm_whash_lookup): Implement in terms of `scm_hashq_*' instead of `scm_hash_fn_*'. * libguile/struct.c (scm_struct_ihashq): Change to match `scm_t_hash_fn'. (scm_struct_create_handle): Cast `scm_sloppy_assq'. * libguile/struct.h (scm_struct_ihashq): Update, make internal. 2009-10-19 Julian Graham Fix typo in psyntax.scm related to syntax-violation reporting. * module/ice-9/psyntax.scm (chi-macro): Replace `s' with `(wrap-subst w)'. 2009-10-19 Ludovic Courtès Add support for R6RS/SRFI-30 nested block comments. Suggested by Andreas Rottmann . * libguile/read.c (flush_ws, scm_read_sharp): Add support for R6RS/SRFI-30 block comments. (scm_read_r6rs_block_comment): New function. * test-suite/tests/reader.test (exception:unterminated-block-comment): Adjust to match both block comment styles. ("reading")["R6RS/SRFI-30 block comment", "R6RS/SRFI-30 nested block comment", "R6RS/SRFI-30 block comment syntax overridden"]: New tests. ("exceptions")["R6RS/SRFI-30 unterminated nested block comment"]: New test. * doc/ref/api-evaluation.texi (Block Comments): Mention SRFI-30/R6RS block comments. * doc/ref/srfi-modules.texi (SRFI-30): New node. 2009-10-16 Andy Wingo comment fixups to tree-il/compile-glil.scm * module/language/tree-il/compile-glil.scm: Remove some outdated comments. 2009-10-16 Andy Wingo jumps encoded using 24 bits, not 19; blocks no longer aligned * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (FETCH_OFFSET, BR): Labels are no longer 8-byte aligned; instead, jumps are encoded into 3 bytes instead of 2. (br, br-if, br-if-not, br-if-eq, br-if-not-eq, br-if-null) (br-if-not-null, mv-call): Adapt for new length of br instructions (3 bytes instead of 2). * libguile/vm.c (really_make_boot_program): Adapt hand-coded bytecode for new offset regime. * module/language/assembly.scm (align-block): No alignment necessary. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out breaks as 24-bit relative jumps. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decompile break instructions. 2009-10-16 Andy Wingo compilation enviroments are always modules; simplifications & refactorings * module/ice-9/boot-9.scm (make-fresh-user-module): New public function, makes an anonymous beautified module. * module/language/objcode/spec.scm: We used to have some things in here that allowed lexical variable names and values to be a part of the environment, but no more. Now an environment is just a module. If you want to "inject" free variables into code, just use lambda. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Same here. Also, rely on the fact that an environment *will* be a module -- because (system base compile) guarantees that for us. * module/language/scheme/spec.scm (scheme): In the reader, rely on the environment being a module. Define a #:make-default-environment handler, which returns a beautified module, augmented with a fresh definition for current-reader, so that side effects to current-reader are restricted to the compilation unit. * module/language/tree-il/analyze.scm (report-possibly-unbound-variables): * module/language/tree-il/compile-glil.scm (compile-glil): * module/language/tree-il/optimize.scm (optimize!): The environment will be a module. * module/system/base/language.scm (): New field, `make-default-environment'. Defaults to `make-fresh-user-module'. (default-environment): New accessor, returns a default environment for a language. * module/system/repl/common.scm (repl-compile): Always compile relative to the current module, because a module is always acceptable as an environment. * module/system/base/compile.scm (compile-file, compile-and-load): Both of these have a new keyword argument, #:env. For `compile-file', it defaults to the default environment of the source language, and for `compile-and-load', to the current module. (read-and-compile): If there are no expressions read, pass the joiner its default environment (via `default-environment joint'). 2009-10-16 Andy Wingo no more *compilation-environment* fluid * module/system/base/compile.scm (current-compilation-environment): Remove, as the only thing that needed it (language readers) now get the environment as an argument. (read-and-compile, compile): Rework for no *compilation-environment*, and default the environment using the define* mechanism. * module/language/tree-il/analyze.scm (env-module): Hack around the lack of a current compilation module. Will fix this in the next commit so that the environment is always valid. 2009-10-16 Andy Wingo language-readers receive environment as an arg * module/language/assembly/spec.scm: * module/language/brainfuck/spec.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/spec.scm: * module/language/glil/spec.scm: * module/language/scheme/spec.scm: * module/language/tree-il/spec.scm: Language-readers now take two arguments: the port and the environment. This should allow for compile-environment-specific reader behavior. * module/system/base/compile.scm (read-and-compile): * module/system/repl/common.scm (repl-read): Pass the environment to the language-reader. * module/system/repl/repl.scm (meta-reader, prompting-meta-read): * module/system/repl/command.scm (define-meta-command): Use the second argument to repl-reader, so we avoid frobbing current-reader. 2009-10-16 Andy Wingo repl-reader accepts optional "read" argument * module/ice-9/boot-9.scm (repl-reader): Accept an optional second argument, the reader to use. If it is given, use it instead of dereferencing the current-reader fluid. * guile-readline/ice-9/readline.scm (activate-readline): Make our replacement definition of repl-reader compatible with boot-9. 2009-10-16 Andy Wingo remove GHIL, Elisp, and R5RS languages GHIL is obsolete, and it's about time we got rid of it. Elisp and R5RS were unmodified since their import from Guile-VM, so we ditch them too. R5RS compilation is supported via compiling Scheme within an R5RS environment. Elisp will be supported when we merge in Daniel's work. 2009-10-16 Andy Wingo bitvector tweaks * libguile/arrays.c (scm_from_contiguous_typed_array): * libguile/bytevectors.c (scm_uniform_array_to_bytevector): Error if the uniform element size is more than 8 bits, but not divisible by 8 -- because our math could overflow in that case. * module/ice-9/deprecated.scm (#\y): Indeed, #* is the valid bitvector syntax :) 2009-10-15 Ludovic Courtès Improve TLS detection for systems with compiler support but no libc support. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Use `AC_LINK_IFELSE' instead of `AC_COMPILE_IFELSE'. Bump version number for 1.9.4. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2009-10-15 Ludovic Courtès Fix compilation of literal bitvectors. * libguile/arrays.c (scm_from_contiguous_typed_array): Fix BYTE_LEN sanity check for bitvectors. * test-suite/tests/unif.test ("syntax")["bitvector is self-evaluating"]: New test. * module/ice-9/deprecated.scm (#\y): Fix deprecation comment: `#*' is not a read syntax. 2009-10-15 Ludovic Courtès Fix segfault for `(uniform-array->bytevector (bitvector))'. * libguile/bytevectors.c (scm_uniform_array_to_bytevector): Fix BYTE_LEN computation for bitvectors. * test-suite/tests/bytevectors.test ("uniform-array->bytevector"): New test prefix. 2009-10-15 Ludovic Courtès Fix `gitlog-to-changelog' on NixOS. 2009-10-15 Ludovic Courtès Document the interaction of the "compilee" with the compiler's current module. This is a followup to 87c595c757b7db84ffdcfda96f736ab235e674a8 ("Compile in a fresh module by default.") and f65e2b1ec5ae1962e57322ac3085ab4d44025694 ("Honor and confine expansion-time side-effects to `current-reader'."). * doc/ref/api-evaluation.texi (Loading): Explain how to change `current-reader' in a compiler-friendly way. * doc/ref/compiler.texi (The Scheme Compiler): Explain use of a fresh compilation module and separate `current-reader' fluid. * test-suite/tests/compiler.test ("current-reader")["with eval-when"]: New test. 2009-10-15 Ludovic Courtès Fix REPL environment for languages other than scheme. * module/system/repl/common.scm (repl-compile): Use `#:env #f' for languages other than scheme. 2009-10-15 Andy Wingo signedness fix fix fix * libguile/inline.h: Fix signedness fix fix. `load' autocompiles -- in the current module. * module/ice-9/boot-9.scm (load): Pull `autocompiled-file-name' inside `load', and make it autocompile in the current module. Should fix Julian's issue noted in http://article.gmane.org/gmane.lisp.guile.devel/9483. update NEWS for 1.9.4 fix scm_array_handle_ref signedness fix * libguile/inline.h: Fix signedness fix. add back support for #y bitvector read syntax * module/ice-9/deprecated.scm (#\y): Add deprecated support for #y(1 0 1 ...) bitvectors. 2009-10-15 Ludovic Courtès Use pointer-less memory for `scm_gc_strdup ()'. * libguile/gc-malloc.c (scm_gc_strndup): Use `GC_MALLOC_ATOMIC ()' instead of `GC_MALLOC ()'. 2009-10-15 Ludovic Courtès Restore signature of `scm_primitive_load_path ()' as found in 1.8. The incompatibility was introduced by 0fb81f95b0222c5ba49efd3e36cf797df54c0863 ("add exception_on_error optional arg to primitive-load-path"). * libguile/load.c (scm_primitive_load_path): Change to take 1 rest argument. Interpret the argument as either a file name (C-level backward compatibility with 1.8) or an actual argument list. (scm_c_primitive_load_path): Update caller. * libguile/load.h (scm_primitive_load_path): Update accordingly. * doc/ref/api-evaluation.texi (Loading): Update documentation of `primitive-load-path' and `scm_primitive_load_path ()'. 2009-10-15 Ludovic Courtès Use GC-managed memory for port->encoding. * libguile/ports.c (scm_new_port_table_entry): Use `scm_gc_strdup ()' instead of `strdup ()' for `entry->encoding'. (scm_i_set_port_encoding_x): Likewise. Remove free(3) call. (scm_i_remove_port): Don't explicitly free memory. (scm_unget_byte): Remove outdated and misleading comment. 2009-10-14 Ludovic Courtès Fix signed/unsigned mismatch in `scm_array_handle_{ref,set} ()'. * libguile/inline.h (scm_array_handle_ref, scm_array_handle_set): Cast `h->base' so that it matches the signedness of `p'. 2009-10-13 Ken Raeburn Flush output before forking, to make test output consistent and avoid duplication. * test-suite/tests/socket.test: Before calling primitive-fork, call force-output on the current output and error ports. 2009-10-13 Andy Wingo add $libir to the ltdl path, not $pkglibdir; add extensionsdir * libguile/Makefile.am (libpath.h): Fix SCM_LIB_DIR to point to the libdir, not pkglibdir. Add SCM_EXTENSIONS_DIR, for a dir to put in the dynamic-link search path that's not managed by ldconfig or the like; and put this dir in the "extensionsdir" key of %guile-build-info. * libguile/dynl.c (sysdep_dynl_init): Rename the installed-libdir environment var to GUILE_SYSTEM_EXTENSIONS_PATH (from GUILE_SYSTEM_LTDL_PATH). Also add SCM_EXTENSIONS_DIR to the ltdl search path in the default case. * meta/uninstalled-env.in: Adapt override to match. * meta/guile-2.0.pc.in: Add extensionsdir, so you can pkg-config --variable=extensionsdir guile-2.0. 2009-10-12 Michael Gran Modify regexp.test to work better with mac/darwin * test-suite/tests/regexp.test (set-latin-1): also add .ISO8859-1 as a possible extension for latin-1 locales. Use set-latin-1 exclusively to set the locale for tests. 2009-10-09 Michael Gran Revert changes that gather thread-specific local language The method used was not portable. However, the underlying problem still exists: the uc_locale_language used by libunistring does not work with thread-specific locale_t locales. * libguile/i18n.c (locale_language): avoid unpacking semi-opaque type locale_t. * test-suite/tests/i18n.test: set Turkish string and char locale upcase and downcase tests to throw untested 2009-10-09 Ludovic Courtès Adjust to match changes in libgc's CVS (pre-7.2). In libgc CVS the `GC_do_blocking ()' declaration is now public but it uses a slightly different signature for its first argument. * configure.ac: Check for `GC_fn_type'. * libguile/threads.c (GC_fn_type)[HAVE_GC_DO_BLOCKING && !HAVE_GC_FN_TYPE]: New typedef. (scm_without_guile): Explicitly cast `without_guile_trampoline' to `GC_fn_type'. This is because the upstream definition currently looks like `typedef void * (extern *GC_fn_type)(void *);', which isn't compatible. 2009-10-09 Ludovic Courtès Use TLS when available for `SCM_I_CURRENT_THREAD'. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): New macro. * configure.ac: Use it. * libguile/__scm.h (SCM_THREAD_LOCAL): New macro. * libguile/gen-scmconfig.c (main): Define `SCM_HAVE_THREAD_STORAGE_CLASS'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS): New. * libguile/threads.c (scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New. (SET_CURRENT_THREAD): New macro. (guilify_self_1, on_thread_exit, init_thread_key): Use it. * libguile/threads.h (scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New declaration. (SCM_I_CURRENT_THREAD)[SCM_HAVE_THREAD_STORAGE_CLASS]: New macro. (init_thread_key_once, init_thread_key): Conditionalize on `!defined SCM_HAVE_THREAD_STORAGE_CLASS'. (scm_i_init_thread_for_guile): Update accordingly. 2009-10-09 Ludovic Courtès Arrange so that `SCM_I_CURRENT_THREAD' is not accessed outside of libguile. * libguile/__scm.h (scm_async_tick): New declaration. (SCM_ASYNC_TICK)[!BUILDING_LIBGUILE]: Use `scm_async_tick ()'. * libguile/async.c (scm_critical_section_start, scm_critical_section_end, scm_async_tick): New functions. * libguile/async.h (scm_i_critical_section_mutex): Made internal. (scm_critical_section_start, scm_critical_section_end): New declarations. (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END)[!BUILDING_LIBGUILE]: Use the same-named function (lower-case). * libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Conditionalize on `BUILDING_LIBGUILE'. * libguile/threads.h (SCM_I_CURRENT_THREAD, scm_i_dynwinds, scm_i_set_dynwinds, scm_i_last_debug_frame, scm_i_set_last_debug_frame): Conditionalize on `BUILDING_LIBGUILE'. 2009-10-09 Ludovic Courtès Deprecate `scm_mask_ints'. * libguile/async.h (scm_mask_ints): Remove. * libguile/deprecated.c (scm_i_mask_ints): New. * libguile/deprecated.h (scm_mask_ints): New macro. (scm_i_mask_ints): New declaration. 2009-10-07 Neil Jerram Revert "Change dynwind flag enums to #defines, for greater portability" This reverts commit b25aa0b9373d2798469e0fe999cd915e8beedc4f. 2009-10-06 Ludovic Courtès Fix typo in `scm_array_p_2 ()'. * libguile/generalized-arrays.c (scm_array_p_2)[FUNC_NAME]: Fix. 2009-10-06 Ludovic Courtès Add compiler warning for possibly unbound variables. * module/language/tree-il/analyze.scm (): New record type. (env-module, report-possibly-unbound-variables): New procedures. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `unbound-variable'. * module/system/base/message.scm (%warning-types): Likewise. * test-suite/tests/tree-il.test (read-and-compile, %opts-w-unbound): New. ("warnings")["unbound variable"]: New test prefix. 2009-10-06 Ludovic Courtès tree-il: Pass the environment to warning passes. * module/language/tree-il/analyze.scm (report-unused-variables): Taken a new parameter, ENV. * module/language/tree-il/compile-glil.scm (compile-glil): Pass E to individual warning passes. 2009-10-02 Neil Jerram Change dynwind flag enums to #defines, for greater portability Thanks to Inge Gutheil for raising this problem. * doc/ref/api-control.texi (Dynamic Wind): Remove doc for scm_t_dynwind_flags, and change uses of scm_t_dynwind_flags to int. Mention possible flags inside doc for scm_dynwind_begin instead. Similarly for scm_t_wind_flags. In this case the doc on possible flags is moved to after the four functions that can use them. * libguile/dynwind.c (scm_dynwind_begin): Change scm_t_dynwind_flags to int. (scm_dynwind_unwind_handler): Change scm_t_wind_flags to int. (scm_dynwind_rewind_handler): Ditto. (scm_dynwind_unwind_handler_with_scm): Ditto. (scm_dynwind_rewind_handler_with_scm): Ditto. * libguile/dynwind.h (SCM_F_DYNWIND_REWINDABLE): Use #define instead of typedef enum. (SCM_F_WIND_EXPLICITLY): Ditto. (function declarations): Change scm_t_dynwind_flags and scm_t_wind_flags to int. * test-suite/standalone/test-unwind.c (check_cont_body): Change scm_t_dynwind_flags to int. 2009-10-02 Ludovic Courtès Use `SCM_DEPRECATED' in declarations of deprecated functions/variables. * libguile/deprecated.c (SCM_BUILDING_DEPRECATED_CODE): New macro. * libguile/async.c (SCM_BUILDING_DEPRECATED_CODE): Likewise. * libguile/macros.c (SCM_BUILDING_DEPRECATED_CODE): Likewise. * libguile/async.h, libguile/deprecated.h, libguile/eval.h, libguile/gc.h, libguile/gc.h, libguile/macros.h, libguile/ports.h, libguile/srfi-4.h, libguile/strings.h: Change declarations of deprecated functions and variables to use `SCM_DEPRECATED' instead of `SCM_API'. 2009-10-02 Ludovic Courtès Add `SCM_DEPRECATED' macro to declare deprecated C functions/variables. * libguile/__scm.h (SCM_DEPRECATED): New macro. 2009-10-02 Ludovic Courtès Fix the argument list of gsubr stack frames. This fixes a bug introduced in e20d7001c3f7150400169fecb0bf0eefdf122fe2 and reported by Neil. * libguile/eval.i.c (CEVAL)[DEVAL]: Don't duplicate ARG1 in `debug.info->a.args' for gsubr stack frames. (scm_apply): Likewise. * test-suite/tests/eval.test ("stacks")["arguments of a gsubr stack frame"]: New test. 2009-10-02 Neil Jerram Fix doc for inet-ntop: always produces a string Thanks to Scott McPeak for reporting this. * libguile/socket.c (scm_inet_ntop): In docstring, add quotes around IPv6 address (+ reflow a bit). * doc/ref/posix.texi (Network Address Conversion): Corresponding change. * doc/maint/guile.texi: Corresponding change. 2009-10-02 Neil Jerram Fix handling of IPv6 addresses Thanks to Scott McPeak for reporting this and providing a patch. * libguile/socket.c (scm_to_ipv6): When address is the wrong type, provide more information in the exception message. (scm_to_sockaddr): scm_to_ipv6 expects just an address, not the whole vector. * test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): New set of tests. 2009-10-01 Neil Jerram Fix incorrect doc mentions of INADDR_LOCALHOST Thanks to Scott McPeak for reporting this. * doc/ref/posix.texi (Network Sockets and Communication): Change INADDR_LOCALHOST to INADDR_LOOPBACK. 2009-10-01 Neil Jerram Add define-module to signals.test * test-suite/tests/signals.test (test-suite): Add define-module form. Change signals.test to LGPLv3+ * test-suite/tests/signals.test: Update licence statement. Remove unused environments code and tests * libguile/environments.c, libguile/environments.h, test-suite/tests/environments.nottest: Deleted. 2009-09-30 Neil Jerram Fix spurious `throw from within critical section' errors The crux of this problem was that the thread doing a throw, and so checking scm_i_critical_section_level, was different from the thread that was in a critical section. * libguile/async.h (scm_i_critical_section_level): Removed, replaced by per-thread critical_section_level. (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END): Use per-thread critical_section_level. * libguile/continuations.c (scm_dynthrow): Check per-thread critical_section_level. * libguile/threads.c (guilify_self_1): Init per-thread critical_section_level. (scm_i_critical_section_level): Removed. * libguile/threads.h (scm_i_thread): New critical_section_level field. * libguile/throw.c (scm_ithrow): Check per-thread critical_section_level. 2009-09-30 Neil Jerram Avoid throw from critical section, given invalid sigaction call * libguile/scmsigs.c (scm_sigaction_for_thread): Exit critical section before raising out-of-range error. * test-suite/Makefile.am (SCM_TESTS): Add signals.test. * test-suite/tests/signals.test: New file. 2009-09-28 Ludovic Courtès Make `weaks.test' slightly more robust. * test-suite/tests/weaks.test (global-weak): Use `string-copy' on all the keys, in case one of them is retained in `scm_source_whash' or similar. Improve description of `scm_set_smob_mark ()'. * doc/ref/api-smobs.texi (Smobs): Improve description of `scm_set_smob_mark ()'. Mention malloc(3) regions. 2009-09-28 Ludovic Courtès Remove unneeded SMOB/port mark/free procedures. * libguile/arrays.c (array_mark, array_free): Remove. (scm_init_arrays): Adjust accordingly. * libguile/bitvectors.c (bitvector_free): Remove. (scm_c_make_bitvector): Use `scm_gc_malloc_pointerless ()'. (scm_init_bitvectors): Adjust accordingly. * libguile/strports.c (scm_make_stptob): Remove `scm_set_port_mark ()' call. * libguile/vports.c (scm_make_sfptob): Likewise. 2009-09-28 Ludovic Courtès Remove default port/SMOB finalizers. * libguile/ports.c (scm_port_free0): Remove. (scm_make_port_type): Set `free' to NULL. * libguile/smob.c (scm_make_smob_type): Leave `free' to NULL. (scm_smob_free): Remove. * libguile/smob.h (scm_smob_free): Remove. * libguile/deprecated.c (scm_smob_free): New. * libguile/deprecated.h (scm_smob_free): New declaration. 2009-09-26 Neil Jerram Clean meta/guile-config * meta/Makefile.am (CLEANFILES): New, containing guile-config. 2009-09-25 Neil Jerram Don't include guile-config and guile-tools in distribution They need to be regenerated, with the correct prefix, when configure and make run. * meta/Makefile.am (EXTRA_DIST): Remove bin_SCRIPTS. 2009-09-25 Neil Jerram Fix make distcheck by looking for guile-config in $(srcdir) make distcheck is currently failing for me with: In file included from /usr/local/include/libguile/threads.h:35, from /usr/local/include/libguile/async.h:28, from /usr/local/include/libguile.h:37, from ../../examples/box/box.c:22: /usr/local/include/libguile/pthread-threads.h:33:31: error: libguile/boehm-gc.h: No such file or directory In file included from /usr/local/include/libguile.h:93, from ../../examples/box/box.c:22: - which is because it's picking up a load of installed headers, instead of those in the _inst tree - which is because there is no output from the preceding guile-config invocation: PATH=/home/neil/SW/Guile/ovnight/guile-master-20090924/_inst/bin:$PATH PKG_CONFIG_PATH=/home/neil/SW/Guile/ovnight/guile-master-20090924/_inst/lib/pkgconfig /home/neil/SW/Guile/ovnight/guile-master-20090924/_inst/bin/guile-config compile - which is because .../_inst/bin/guile-config is empty - which is because the rule in meta/Makefile.am that generates guile-config is missing $(srcdir), and so doesn't find guile-config.in. * meta/Makefile.am (guile-config): Look for guile-config.in in $(srcdir). 2009-09-25 Michael Gran Missing free in nl-langinfo This is a regression. * libguile/i18n.c (scm_nl_langinfo): free c_result 2009-09-25 Michael Gran Fix encoding of strings returned by nl-langinfo Strings returned by nl-langinfo were always being encoded using the global setlocale and not the scm_t_locale passed to the function. * libguile/i18n.c (scm_nl_langinfo): fix encoding of strings 2009-09-24 Michael Gran Language-specific case-conversion doesn't honor locale Libunistring uses a function uc_locale_language to extract the current language from the locale information. It does this by calling setlocale. This makes incompatible with Guile functions that use the locale_t thread-specific locale API, because the values returned by the call to setlocale ignore the locale set by uselocale. As a workaround, this patch extracts the language from the locale_t structure's __names field. A more complete solution is needed. Perhaps that solution would test that the __names field exists in the configure step and revert to !USE_GNU_LOCALE_API in that case. * libguile/i18n.c (locale_language): new function that performs the same job as uc_locale_language but is compatible with uselocale (u32_locale_casecoll, u32_locale_tocase): replace uc_locale_language with locale_language 2009-09-24 Michael Gran Tests for locale-specific case conversion * test-suite/tests/i18n.test: add tests for case conversion of Turkish letters 'i' to verify that the language is being honored. Try to adjust i18n for strict aliasing * libguile/i18n.c (u32_locale_tocase, scm_char_locale_downcase) (scm_char_locale_upcase, scm_string_locale_downcase) (scm_string_locale_upcase): use the scm_t_uint32 type for buffers that are used primarily for libunistring and not for Guile strings. 2009-09-24 Ludovic Courtès Move "-z relro" out of $LDFLAGS so it's not in `guile-2.0.pc'. * acinclude.m4 (GUILE_GNU_LD_RELRO): Substitute `GNU_LD_FLAGS'. * libguile/Makefile.am (libguile_la_LDFLAGS): Add $(GNU_LD_FLAGS). * srfi/Makefile.am (AM_LDFLAGS): New. 2009-09-24 Ludovic Courtès Have `guile-config' close over `pkg-config' and $(pkgconfigdir). * meta/Makefile.am (guile-config): New target. (EXTRA_DIST): Add `guile-config.in'. * meta/guile-config.in: New, formerly `guile-config'. Use the right installed `guile', with the right $PKG_CONFIG_PATH. Disable auto-compilation. (%pkg-config-program): New variable. (pkg-config): Use it. 2009-09-24 Ludovic Courtès Partially revert e5f5113c21f396705d7479a570c96690135c9d36. The intent is to maintain the readability of `pmatch' invocations. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't use wildcards in `pmatch' invocations, even when the matched elements are unused. * module/language/glil/decompile-assembly.scm (decompile-toplevel, decompile-load-program): Likewise. * module/system/xref.scm (program-callee-rev-vars): Likewise. * module/language/assembly.scm (byte-length): Likewise. * module/language/tree-il/compile-glil.scm (flatten): Likewise. 2009-09-24 Ludovic Courtès Reinstate backward-compatible `scm_array_p ()'. * libguile/generalized-arrays.c (scm_array_p_2): New, formerly `scm_array_p ()'. (scm_array_p): Add second argument, for compatibility with 1.8 and earlier and to match what the doc says and what `SCM_VALIDATE_ARRAY' expects. * libguile/generalized-arrays.h (scm_array_p_2): New. (scm_array_p): Adjust. 2009-09-23 Michael Gran Modify char and string locale upcase and downcase for Unicode * libguile/i18n.c (u32_locale_tocase): new helper function (scm_char_locale_downcase, scm_char_locale_upcase): add capability for UCS-4 characters. (scm_string_locale_downcase, scm_string_locale_upcase): modify for the new scheme strings. 2009-09-22 Neil Jerram Manual link from `Guile Initialization' to `Initialization' Thanks to Dale Smith for suggesting this. * doc/ref/libguile-linking.texi: Add ref to full doc of Guile initialisation functions. 2009-09-22 Neil Jerram Changes so that benchmark-guile runs successfully * benchmark-suite/benchmarks/bytevectors.bm: Add "coding: latin1" comment where Guile will find it. * benchmark-suite/benchmarks/chars.bm: Ditto. * benchmark-suite/benchmarks/srfi-13.bm: Ditto. * benchmark-suite/benchmarks/read.bm ("read"): Divide numbers of iterations by 10, so that the benchmarks complete within a few minutes. * benchmark-suite/lib.scm (benchmark): Use `run-benchmark' in macro definition, not `,run-benchmark'. * benchmark-suite/benchmarks/0-reference.bm, benchmark-suite/benchmarks/continuations.bm, benchmark-suite/benchmarks/if.bm, benchmark-suite/benchmarks/logand.bm: Add define-module. * benchmark-suite/results/neil-arudy: New file, containing benchmark results from my computer. 2009-09-22 Neil Jerram GDS usability: operation without a mouse Derek Peschel provided this patch and described it as follows. "Most of the time I use Terminal in OS X, rather than xterm. I also don't bother with the GUI versions of Emacs. So unfortunately I have no mouse support in Emacs. Also the system I'm testing Guile on thinks my terminal doesn't support color and I haven't fixed it yet. The attached patch makes GDS more usable for me. "With no mouse, the "[click here to show error stack]" design is very inconvenient. You added a C-M (return) binding at some point. I copied that, but I also changed the message to show it. And I made the return work when the cursor is after the right bracket." * emacs/gds-scheme.el (gds-display-results): Make "click here" message more helpful for people without mice. Also extend text properties so that a RET key press works at the end of that line. 2009-09-22 Neil Jerram Typo fixes Fix GDB in Emacs incantation 2009-09-21 Michael Gran Tests for record types * test-suite/tests/records.test: new tests 2009-09-21 Michael Gran More tests for strings * test-suite/tests/vectors.test: test make-vector and interactions between strings and vectors * test-suite/tests/strings.test: test string-null?, string? and backslash escapes * test-suite/tests/srfi-13.test: test null input strings in string-any and string-every 2009-09-21 Ludovic Courtès Remove unused variables in system/language. * module/language/assembly.scm (byte-length): Don't match unused record slots. * module/language/tree-il.scm (tree-il->scheme, post-order!, pre-order!): Likewise. * module/language/tree-il/analyze.scm (analyze-lexicals): Likewise. * module/language/tree-il/compile-glil.scm (flatten): Likewise. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't match unused list elements. * module/language/glil/decompile-assembly.scm (decompile-toplevel, decompile-load-program): Likewise. * module/system/xref.scm (program-callee-rev-vars): Likewise. * module/language/assembly/compile-bytecode.scm (write-bytecode)[write-sized-loader]: Remove. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Factorize `pad' variables. * module/language/ecmascript/base.scm (object->value/string, object->value/number)[v]: Remove. * module/language/ecmascript/tokenize.scm (read-slash)[c0]: Remove. * module/language/objcode/spec.scm (decompile-value)[nargs]: Remove. * module/system/repl/command.scm (time)[vms-start, vms-end]: Remove. * module/system/repl/repl.scm (prompting-meta-read): Use `prompt'. 2009-09-21 Ludovic Courtès Remove unused variables in ice-9/goops/srfi/scripts. * module/ice-9/boot-9.scm (scm-style-repl)[-abort]: Remove. * module/oop/goops.scm (class)[slot-defs]: Remove. (compute-slot-accessors)[name]: Remove. (compute-get-n-set)[env]: Remove. * module/oop/goops/active-slot.scm (compute-get-n-set)[env, name]: Remove. * module/oop/goops/dispatch.scm (cache-try-hash!)[max-misses]: Remove. * module/oop/goops/save.scm (make-mapper)[dims]: Remove. * module/scripts/autofrisk.scm (>>checks)[prog]: Remove. * module/srfi/srfi-19.scm (priv:read-directives)[ireaderf, eireader4]: Remove. 2009-09-20 Ludovic Courtès Honor and confine expansion-time side-effects to `current-reader'. * module/language/scheme/spec.scm (scheme)[#:reader]: Honor the compilation environment's `current-reader'. * module/system/base/compile.scm (*compilation-environment*): New fluid. (current-compilation-environment): New procedure. (make-compilation-module): Provide a fresh `current-reader' fluid. (read-and-compile): Set `*compilation-environment*' appropriately. (compile): Likewise. * test-suite/tests/compiler.test (read-and-compile): New. ("current-reader"): New test prefix. 2009-09-20 Ludovic Courtès Fix copyright in `(srfi srfi-4 gnu)'. 2009-09-20 Ludovic Courtès Compile in a fresh module by default. * module/system/base/compile.scm (make-compilation-module, language-default-environment): New procedures. (read-and-compile, compile): Have ENV default to `(language-default-environment from)'. (compile-and-load): Compile in `(current-module)'. * module/system/repl/common.scm (repl-compile): Explicitly compile in the current module so that macro definitions are visible. * libguile/load.c (kw_env): New variable. (do_try_autocompile): Call `compile-file' with `#:env (current-module)'. * test-suite/tests/compiler.test ("psyntax")["compile uses a fresh module by default", "compile-time definitions are isolated"]: New tests. ["compile in current module"]: Specify `#:env (current-module)'. ["redefinition"]: Adjust. * test-suite/tests/bytevectors.test (c&e): Explicitly compile in the current module so that its imports are visible. 2009-09-18 Andy Wingo fix bitvectors after the array handle refactoring * libguile/uniform.h (scm_array_handle_uniform_element_bit_size): New public accessor. * libguile/uniform.c (scm_array_handle_uniform_element_size): Better errors in non-byte-aligned arrays. (scm_uniform_vector_element_type, scm_uniform_vector_element_size) (scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x): (scm_uniform_vector_to_list): Don't require byte-aligned access. * libguile/bytevectors.c (scm_uniform_array_to_bytevector): * libguile/arrays.c (scm_from_contiguous_typed_array): Fix for uniform arrays whose element size is not a multiple of the byte size. 2009-09-18 Andy Wingo fix thinko in api-memory.texi 2009-09-18 Ludovic Courtès i18n: Remove non-local exists from `u32_locale_casecoll ()'. * libguile/i18n.c (u32_locale_casecoll): Add RESULT argument. Return zero or ERRNO. (compare_u32_strings_ci): Adjust accordingly. 2009-09-18 Ludovic Courtès i18n: Always use locale-dependent string collation. * libguile/i18n.c (compare_u32_strings, compare_u32_strings_ci): Always use locale-dependent string collation. * test-suite/tests/i18n.test: Recoded in UTF-8. (%french-utf8-locale-name): New. (under-locale-or-unresolved): New. Don't catch errors on GNU systems. (under-french-locale-or-unresolved): Use it. (under-french-utf8-locale-or-unresolved): New. ("text collation (French)")["string-locale-ci=? (2 args, wide strings)", "string-locale-ci=? (3 args, wide strings)", "string-locale-ci<>? (wide strings)", "string-locale-ci<>? (wide and narrow strings)", "char-locale-ci<>? (wide)"]: New tests. 2009-09-18 Ludovic Courtès i18n: Avoid needless heap allocation. * libguile/i18n.c (SCM_STRING_TO_U32_BUF): Allocate buffers on the stack rather on the heap. (SCM_U32_BUF_FREE): Remove. Callers updated. i18n: Simplify `RUN_IN_LOCALE_SECTION' (GNU version). * libguile/i18n.c (RUN_IN_LOCALE_SECTION)[USE_GNU_LOCALE_API]: Remove extraneous uselocale(3) call. 2009-09-18 Ludovic Courtès Add the `%host-type' global variable. * configure.ac: Define `HOST_TYPE'. * libguile/load.c (sys_host_type): New variable. * doc/ref/api-options.texi (Build Config): Document `%host-type'. 2009-09-17 Michael Gran Adapt i18n string and char comparison funcs for Unicode * libguile/i18n.c (RUN_IN_LOCALE_SECTION) [USE_GNU_LOCALE_API]: new macro for this define. Should work the same as the !USE_GNU_LOCAL_API version (SCM_STRING_TO_U32_BUF, SCM_U32_BUF_FREE): helper macros (compare_u32_strings, compare_u32_strings_ci): new functions that compare scheme strings in the presence of the locale (u32_locale_casecoll): new helper function for compare_u32_strings_ci (compare_strings, compare_strings_ci): removed and replaced by compare_u32_strings and compare_u32_strings_ci (scm_string_locale_lt, scm_string_locale_gt, scm_string_locale_ci_lt) (scm_string_locale_ci_gt, scm_string_locale_ci_eq): modified to use new compare_u32_strings and compare_u32_strings_ci comparison functions (scm_char_locale_lt, scm_char_locale_gt, scm_char_locale_ci_lt) (scm_char_locale_ci_gt, scm_char_locale_ci_eq): modified to use new compare_u32_strings and compare_u32_strings_ci comparison functions 2009-09-17 Neil Jerram Remove deprecation warnings from the build * module/srfi/srfi-35.scm: Remove explicit use of (ice-9 syncase). * test-suite/tests/r5rs_pitfall.test: Same again. * test-suite/tests/syncase.test: Remove "(ice-9 syncase) loads" test; syncase is always loaded now. 2009-09-17 Neil Jerram Convenience for running GDB on Guile in Emacs * meta/gdb-uninstalled-guile.in: Add (in a comment) an elisp form that can be evaluated to run GDB on Guile in Emacs. 2009-09-17 Neil Jerram Fix omission of VM frames from backtrace From the time when a # was a SMOB, really_make_boot_program in vm.c was still using SCM_SET_SMOB_FLAGS to set the SCM_F_PROGRAM_IS_BOOT flag - which meant that it was setting flag 1<<32 :-) which obviously was then missed by the SCM_PROGRAM_IS_BOOT calls in stacks.c. * libguile/programs.h (SCM_F_PROGRAM_IS_BOOT): Use a less significant bit for this flag, now that programs use a tc7 type. * libguile/vm.c (really_make_boot_program): Don't use SCM_SET_SMOB_FLAGS, now that programs aren't SMOBs. 2009-09-17 Neil Jerram Fix incorrect stack count warnings * libguile/stacks.c (stack_depth): Decrement depth count for a macro-expansion frame. (Missing this decrement will cause a "stack count incorrect" warning but is actually benign, as it only means that scm_make_stack allocates a bit more space for the stack than it really needs.) (read_frames): Increment count of remaining unused frames, when cutting out a macro transformer application frame. (Missing this increment could cause the "stack count incorrect" warning, and could make read_frames think it's filled up all the available stack frames when there's actually still one frame unused; this wasn't benign, because it could cause information to be missing from a stack trace.) 2009-09-17 Neil Jerram Remove unhittable else branch for nonexistent type of debug frame * libguile/stacks.c (stack_depth): Remove unhittable else branch apparently catering to a kind of frame that isn't an eval, apply or void frame - in fact there are no other kinds of frames. 2009-09-16 Andy Wingo add the libdir to the ltdl lib search path * libguile/Makefile.am (libpath.h): Fix pkgdatadir, pkglibdir, and pkgincludedir entries. Add a new define, SCM_LIB_DIR. * libguile/dynl.c (sysdep_dynl_init): Add the libdir to the libltdl search path. Should fix http://thread.gmane.org/gmane.lisp.guile.bugs/4289/focus=4296 -- that is, it should allow guile to be invoked from whereever it is installed, without munging LTDL_LIBRARY_PATH or the like variables. There is a trick though -- during the build, we don't want to be looking in the $libdir for loadable modules. So as with GUILE_SYSTEM_PATH, we have GUILE_SYSTEM_LTDL_PATH. * meta/uninstalled-env.in: Set GUILE_SYSTEM_LTDL_PATH to "" when building. 2009-09-15 Ludovic Courtès Bump version number for 1.9.3. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2009-09-15 Ludovic Courtès Use fixnums for int32 when the native word size of greater than 4 bytes. This should also fix "condition is always true" warnings. * libguile/vm-i-scheme.c (bv_u32_native_ref, bv_s32_native_ref, bv_u32_native_set, bv_s32_native_set): Conditionalize use of `BV_FIXABLE_INT_REF' vs. `BV_INT_REF' based on `SIZEOF_VOID_P'. 2009-09-15 Ludovic Courtès Keep the weak pair API internal. * libguile/weaks.h (scm_weak_car_pair, scm_weak_cdr_pair, scm_doubly_weak_pair): Make them internal. 2009-09-15 Ludovic Courtès Fix bug #27450 ("Fat mutexes not GC'd until their owner dies"). * libguile/threads.c (do_thread_exit): Deal with `t->mutexes' being a weak list. (fat_mutex_lock): Use weak-car pairs when building up `t->mutexes'. * test-suite/tests/threads.test ("mutex-ownership")["mutex with owner not retained (bug #27450)"]: New test. 2009-09-15 Ludovic Courtès Fix the (currently unused) weak pair accessors. * libguile/weaks.h (SCM_WEAK_PAIR_WORD): Fixed; changed to return `SCM_UNDEFINED' when the word has been nullified. 2009-09-15 Ludovic Courtès "Document" the `set-module-eval-closure!' weak hash table glitch. * module/ice-9/boot-9.scm (set-module-eval-closure!): Add link to an explanation. * test-suite/tests/gc.test ("gc")["Unused modules are removed"]: Increase the `cleanup' loop. 2009-09-15 Ludovic Courtès Nitpick in `srfi-14.c'. * libguile/srfi-14.c (scm_i_ucs_range_to_char_set): Fix warning about the position of BASE_CS. Make the precise stack mark procedure more robust. * libguile/vm.c (vm_stack_mark): Return if VM is NULL. Use GC-robust queues/lists in `threads.c'. * libguile/threads.c (remqueue, dequeue, on_thread_exit): Initialize the "next" link of the item returned/removed. Remove explicit thread/condvar/mutex finalization. * libguile/threads.c (fat_mutex_free): Remove explicit `scm_gc_free ()' call. (fat_cond_free, thread_free): Remove. (scm_threads_prehistory): Adjust accordingly. 2009-09-14 Ludovic Courtès Update `NEWS'. 2009-09-14 Ludovic Courtès Merge `libguile-i18n' into `libguile'. * GUILE-VERSION (LIBGUILE_I18N_MAJOR, LIBGUILE_I18N_INTERFACE_CURRENT, LIBGUILE_I18N_INTERFACE_REVISION, LIBGUILE_I18N_INTERFACE_AGE, LIBGUILE_I18N_INTERFACE): Remove. * doc/ref/api-i18n.texi (i18n Introduction): Don't mention `libguile-i18n'. * libguile.h: Include "libguile/i18n.h". * libguile/Makefile.am (lib_LTLIBRARIES): Remove `libguile-i18n-v*'. (libguile_la_SOURCES): Add `i18n.c'. (libguile_i18n_v_*_SOURCES, libguile_i18n_v_*_CFLAGS, libguile_i18n_v_*_LIBADD, libguile_i18n_v_*_LDFLAGS): Remove. * libguile/i18n.c (scm_bootstrap_i18n): New function. * libguile/i18n.h (scm_nl_langinfo, scm_init_i18n): Made internal. (scm_bootstrap_i18n): New declaration. * libguile/init.c (scm_i_init_guile): Invoke `scm_bootstrap_i18n ()'. * module/ice-9/i18n.scm: Load from `libguile' instead of `libguile-i18n-v-0'. 2009-09-14 Ludovic Courtès Switch the `encoding*.test' files to LGPLv3+. * test-suite/tests/encoding-escapes.test, test-suite/tests/encoding-iso88591.test, test-suite/tests/encoding-iso88597.test, test-suite/tests/encoding-utf8.test: Switch to LGPLv3+ for the sake of consistency. Update `scm_without_guile ()' documentation. * doc/ref/api-scheduling.texi (Blocking): Mention that `scm_without_guile ()' & co. aren't needed any longer. 2009-09-14 Ludovic Courtès Rename "boehm-gc.h" to "bdw-gc.h"; add to the distribution. * libguile/Makefile.am (modinclude_HEADERS): Add `bdw-gc.h'. * libguile/bdw-gc.h: Rename from "boehm-gc.h"; users updated. Update to LGPLv3+. 2009-09-14 Ludovic Courtès Remove unused IA64 macro. * libguile/threads.c (SCM_MARK_BACKING_STORE): Remove. 2009-09-11 Michael Gran More setlocale robustness in regexp tests * test-suite/tests/regexp.test (mysetlocale, set-latin-1): new functions (with-latin1-locale): removed (regexp-quote tests): try to print test names in locale but run tests in ISO-8859-1. 2009-09-11 Ludovic Courtès Remove `scm_enter_guile ()' and `scm_leave_guile ()'. * libguile/threads.c (scm_t_guile_ticket): Remove type. (resume, scm_enter_guile, suspend, scm_leave_guile): Remove. (scm_i_init_thread_for_guile): Set `t->top' to NULL, which has the same effect as calling `scm_enter_guile ()'. (scm_leave_guile_cleanup, scm_i_with_guile_and_parent): Remove `scm_leave_guile ()' call. 2009-09-11 Ludovic Courtès Add `λ' macro as an alternative to `lambda'. * module/ice-9/boot-9.scm (λ): New macro. * NEWS: Update. 2009-09-11 Ludovic Courtès Report missing libunistring at `configure'-time. * configure.ac: Reinstate libunistring check from 1ee2c72eafaae5f91f4c899bc4b4853af5c16f28. 2009-09-10 Ludovic Courtès Remove unnecessary uses of `scm_{leave,enter}_guile ()'. * libguile/threads.c (scm_pthread_cond_wait, scm_pthread_cond_timedwait): Remove `scm_{leave,enter}_guile ()' calls. 2009-09-10 Ludovic Courtès Link with `-z relro' when available. * acinclude.m4 (GUILE_GNU_LD_RELRO): New macro. * configure.in: Use `GUILE_GNU_LD_RELRO'. 2009-09-09 Ludovic Courtès Update `NEWS'. Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/gc_os_dep.c Avoid unneeded `scm_dynwind_free ()'. * libguile/array-map.c (indices_gc_hint): New variable. (scm_ramapc, scm_array_index_map_x): Avoid `scm_dynwind_free ()' using `scm_gc_malloc_pointerless ()'. 2009-09-09 Ludovic Courtès Update doc of `scm_gc_protect_object ()' and SMOB mark/free. * doc/ref/api-memory.texi (Garbage Collection Functions)[scm_gc_protect_object]: Explain that it's equivalent to storing in a global variable. * doc/ref/api-smobs.texi (Smobs)[scm_set_smob_free]: Expand on the relationship with `scm_gc_malloc ()'. [scm_set_smob_mark]: Explain that it's usually not needed. 2009-09-09 Michael Gran Avoid prematurely ending regexp test when ISO-8859-1 locale not found * test-suite/tests/regexp.test (with-latin1-locale): new function Call tests in context of with-latin1-locale 2009-09-09 Michael Gran Make scm_i_from_stringn into API for use with libguilereadline * libguile/strings.c (scm_i_from_stringn): renamed to scm_from_stringn. All callers changed. * libguile/strings.h: change declaration of scm_i_from_stringn to scm_from_stringn * libguile/strports.c (scm_strport_to_string): scm_i_from_stringn -> scm_from_stringn * guile-readline/readline.c (internal_readline): scm_i_from_stringn -> scm_from_stringn 2009-09-09 Ludovic Courtès Update documentation of `scm_gc_malloc ()' & co. * doc/ref/api-memory.texi (Memory Blocks): Update description of `scm_gc_malloc ()' & co. Add `scm_gc_malloc_pointerless ()'. Update `README'. 2009-09-08 Ludovic Courtès Fix misleading comments in `gc-benchmarks/run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (pretty-print-result): Fix comments. Improve `gc-benchmarks/run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (pretty-print-result)[ref-heap, ref-time]: New variable. [distance, score, score-string]: New procedures. [print-line]: Use `score-string'. (print-raw-result): New procedure. (%options)["raw", "load-results"]: New options. (%default-options): Add `printer' pair. (show-help): Update. (main): Add support for `--raw' and `--load-results'. 2009-09-08 Michael Gran 8-bit locale needed for 8-bit regexp tests Since the regex library expects 8-bit clean characters and an 8-bit locale, tests of 8-bit characters need to occur within the context of an 8-bit locale. * test-suite/tests/regexp.test (regexp-quote tests): wrap them in an ISO-8859-1 locale 2009-09-08 Michael Gran Fix broken interaction between readline and Unicode This requires separate small fixes. Readline has internal logic to deal with multi-byte characters, so it wants bytes, not characters. scm_c_read gets called by the vm when readline is activated, and it was truncating multi-byte characters because soft ports didn't have the UCS-4 capability. Soft ports need the capability to read UCS-4 characters. Since soft ports may have a single byte buffer, full characters need to be stored into the pushback buffer. This broke the optimizations in scm_c_read for using an alternate buffer for single-byte-buffered ports, because the opimization wasn't expecting anything in the pushback buffer. * libguile/vports.c (sf_fill_input): store complete chars, not single bytes * libguile/ports.c (scm_c_read): don't use optimized path for non Latin-1. Add debug prints. * libguile/string.h: make scm_i_from_stringn and scm_i_string_ref public so that readline can use them * guile-readline/readline.c: read bytes, not complete chars, from the input port. Convert output to the output port's locale 2009-09-06 Andy Wingo fix compile-time bug compiling (+ "foo" " bar") * module/language/tree-il/primitives.scm (+, -): Avoid calling exact? on non-numeric args. 2009-09-06 Andy Wingo update news; ready for 1.9.3 * doc/ref/api-control.texi: * doc/ref/goops.texi: Fix some typos. * NEWS: Update. 2009-09-06 Andy Wingo update NEWS * NEWS: Minor text revisions, and fold new NEWS entries into the main body too. 2009-09-05 Michael Gran Avoid string buffer overrun in scm_scan_for_encoding * libguile/read.c (scm_scan_for_encoding): possible overrun if coding declaration is at end of file 2009-09-05 Michael Gran Doc updates for character encoding of source code files * NEWS * doc/ref/scheme-scripts.texi: doc updates for character encoding of source code * doc/ref/api-evaluation.texi: doc updates for character encoding of source code 2009-09-04 Michael Gran Doc updates for Unicode string escapes and port encodings * NEWS: string and port changes * doc/ref/api-data.texi: string escapes and string-ci * doc/ref/api-io.texi: port encoding functions 2009-09-04 Michael Gran Remove locale u8vector functions Locale u8vector functions deemed harmful. * libguile/strports.c (scm_strport_to_locale_u8vector) (scm_call_with_output_locale_u8vector, scm_open_input_locale_u8vector) (scm_get_output_locale_u8vector): removed * libguile/strports.h: removed declarations for scm_strport_to_locale_u8vector, scm_call_with_output_u8vector, scm_input_locale_u8vector, scm_get_output_locale_u8vector * test-suite/tests/encoding-iso88591.test: display tests removed * test-suite/tests/encoding-iso88597.test: display tests removed 2009-09-04 Michael Gran Initialize string ports with UTF-8 encoding String ports should be able to accept any string characters, regardless of the current locale. Setting it to UTF-8 achieves that. * libguile/strports.c (scm_i_mkstrport): set port's locale to UTF-8 (scm_mkstrport): convert input string to UTF-8 2009-09-04 Michael Gran write-char should handle UCS-4 characters * libguile/print.c (scm_write_char): call UCS-4 printing routine, instead of 8-bit primitive 2009-09-03 Ken Raeburn Make test-case compilation with -DSCM_DEBUG=1 work. * gc.h (scm_i_expensive_validation_check): Declare SCM_API. 2009-09-03 Michael Gran Doc updates for srfi-14 character sets * NEWS: updates for srfi-14 character sets * doc/ref/api-data.texi: update char-set section and some spellchecking 2009-09-03 Michael Gran Update docs and docstrings for Unicode characters * doc/ref/api-data.texi: more info about characters and codepoints * libguile/chars.c: replace 'code point' with 'Unicode code point' in docstrings 2009-09-03 Michael Gran Add char-set debugging function * libguile/srfi-14.c (scm_sys_char_set_dump): new function * libguile/srfi-14.h: declaration of scm_sys_char_set_dump 2009-09-03 Michael Gran Distinguish between all codepoints and designated codepoints in char-sets * libguile/unidata_to_charset.pl (designated): renamed from full * libguile/srfi-14.c (scm_char_set_designated): new char-set * libguile/srfi-14.i.c (cs_designated): renamed from cs_full 2009-09-03 Michael Gran Modify read and print of combining characters Since combining characters, such as accents, modify the appearance of the previous letter, it looks awkward in its character literal form (#\name) since it modified the backslash. This instead prints the combining character on a small circle. * libguile/chars.h (SCM_CODEPOINT_DOTTED_CIRCLE): new #define * libguile/print.c (iprint1): print combining characters on dotted circles * libguile/read.c (scm_read_character): parse the combination of combining characters and dotted circles 2009-09-03 Ludovic Courtès Fix invalid syntax in `dynamic-input-large.sch' (gc-benchmarks). * gc-benchmarks/larceny/dynamic-input-large.sch: Remove invalid "\;" escape. 2009-09-03 Ludovic Courtès Add test case for `scm_take_u8vector ()'. This is a followup to commit d7e7a02a6251c8ed4f76933d9d30baeee3f599c0 ("Fix leaky behavior of `scm_take_TAGvector ()'.") and a reminder that the uniform vector implementation can't do away with the cell->buffer indirection. * test-suite/standalone/Makefile.am (test_scm_take_u8vector_SOURCES, test_scm_take_u8vector_CFLAGS, test_scm_take_u8vector_LDADD): New. (check_PROGRAMS, TESTS): Add `test-scm-take-u8vector'. * test-suite/standalone/test-scm-take-u8vector.c: New file. 2009-09-02 Michael Gran Remove always-true range checks in scm_i_ucs_range_to_char_set * libguile/srfi-14.c (scm_i_ucs_range_to_char_set): limits are always non-negative due to the type of the variable More srfi-14 char-set tests * test-suite/tests/srfi-14.test: many new tests Unreachable code in charset set operator * libguile/srfi-14.c (scm_i_charset_set): remove unreachable code in scm_i_charset_set Optimize charset union operator * libguile/srfi-14.c (charsets_union): call scm_i_charset_set_range instead of setting characters one-by-one. The charset complement operator should not include surrogates * libguile/srfi-14.c (charsets_complement): skip over surrogates when making a charset complement char-set-filter! does not properly iterate over the charset * libguile/srfi-14.c (scm_char_set_filter_x): iterate over codepoints ucs-range->char-set should not store surrogates and has off-by-one error * libguile/srfi-14.c (scm_i_ucs_range_to_char_set): new function that contains the functionality of ucs_range_to_char_set, fixes off-by-one, and doesn't store surroges (scm_ucs_range_to_char_set, scm_ucs_range_to_char_set_x): call scm_i_ucs_range_to_char_set (scm_i_charset_set_range): new helper function char-set-any improperly unpacks charset data * libguile/srfi-14.c (scm_char_set_any): unpack the charset correctly 2009-09-02 Michael Gran char-set-xor! should modify the input parameter char-set-xor! was not modifying its input parameter. It isn't technically required to do so by the spec, but, the other similar functions do it. * libguile/srfi-14.c (scm_char_set_xor_x): modify the input parameter 2009-09-02 Ludovic Courtès Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc Conflicts: acinclude.m4 libguile/strings.c 2009-09-01 Ludovic Courtès Fix leaky behavior of `scm_take_TAGvector ()'. * libguile/srfi-4.c (free_user_data): New function. * libguile/srfi-4.i.c (scm_take_TAGvector): Register `free_user_data ()' as a finalizer for DATA. * libguile/objcodes.c (scm_objcode_to_bytecode): Allocate with `scm_malloc ()' since the memory taken by `scm_take_u8vector ()' will eventually be free(3)d. * libguile/vm.c (really_make_boot_program): Likewise. 2009-09-01 Andy Wingo fix nontail loops within loops * module/language/tree-il/compile-glil.scm (flatten): Fix compilation of loops within loops in non-tail positions. Will add a test case soon, but one way to reproduce it was with the following function: (define (test) (let lp () (pk 'zero) (let ((fk (lambda () (let ((fk2 (lambda () (pk 'two)))) (let ((fk3 (lambda () (if #t (pk 'three) (fk2))))) (if #t (fk3) (fk2))))))) (pk 'one) (fk)) (lp))) One would expect to see a sequence of "zero one three", but in fact zero only showed once. This should fix simplex as well. 2009-09-01 Ludovic Courtès Remove the distinction between inline/outline storage for stringbufs. * libguile/strings.c (STRINGBUF_HEADER_SIZE, STRINGBUF_HEADER_BYTES): New macros. (STRINGBUF_F_INLINE, STRINGBUF_INLINE, STRINGBUF_OUTLINE_CHARS, STRINGBUF_OUTLINE_LENGTH, STRINGBUF_INLINE_CHARS, STRINGBUF_INLINE_LENGTH, STRINGBUF_MAX_INLINE_LEN): Remove. (STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Adjust to return a fixed location. (STRINGBUF_LENGTH): Get the length from word 1. (make_stringbuf, make_wide_stringbuf): Adjust to use a contiguous memory region. (wide_stringbuf): Renamed from `widen_stringbuf'. Adjust similarly. Return the new stringbuf. Callers updated. (narrow_stringbuf): Likewise. (scm_sys_string_dump, scm_sys_symbol_dump): Remove `stringbuf-inline' pair. * test-suite/tests/strings.test ("string internals")["null strings are inlined", "short Latin-1 encoded strings are inlined", "long Latin-1 encoded strings are not inlined", "short UCS-4 encoded strings are not inlined", "long UCS-4 encoded strings are not inlined"]: Remove. * test-suite/tests/symbols.test ("symbol internals")["null symbols are inlined", "short Latin-1 encoded symbols are inlined", "long Latin-1 encoded symbols are not inlined", "short UCS-4 encoded symbols are not inlined", "long UCS-4 encoded symbols are not inlined"]: Remove. 2009-09-01 Ludovic Courtès Fix leaky handling of `scm_take_locale_{symbol,string} ()'. * libguile/strings.c (scm_i_take_stringbufn, scm_i_c_take_symbol): Remove. (scm_take_locale_stringn): Rewrite in terms of `scm_from_locale_stringn ()'. * libguile/strings.h (scm_i_c_take_symbol, scm_i_take_stringbufn): Remove declarations. 2009-08-31 Michael Gran Update docs for Unicode characters * NEWS: add note about Unicode characters * doc/ref/api-data.texi: update Characters subsection * libguile/chars.c: update docstrings to match manual 2009-08-31 Michael Gran Tests for display and writing of characters * test-suite/tests/encoding-iso88591.test: tests for writing and display of characters * test-suite/tests/encoding-iso88597.test: tests for writing and display of characters * test-suite/tests/encoding-utf8.test: tests for writing and display of characters 2009-08-31 Michael Gran Fix escape sequence normalization for wide strings * libguile/strings.c (scm_to_stringn): convert unistring escapes to guile escapes for both wide and narrow strings 2009-08-31 Michael Gran Fix encoding errors with strings returned by string ports String ports, being 8-bit, store strings using the character encoding of the port. This fixes a bug where the default character encoding, and not the port's encoding, was being used to convert the string port data back to a string. * libguile/strports.c: extra comments (scm_strport_to_string): use port's encoding when converting port data to a string * libguile/strings.c (scm_i_from_stringn): renamed from scm_from_stringn and made internal. All callers changed. (scm_from_stringn): renamed to scm_i_from_stringn. * libguile/strings.h: declaration for scm_i_from_stringn 2009-08-31 Ludovic Courtès Fix `benchmark-guile'. * benchmark-guile.in (guile): Use `meta/guile', not `pre-inst-guile'. 2009-08-31 Ludovic Courtès Remove the distinction between inline/outline storage for bytevectors. * libguile/bytevectors.c (SCM_BYTEVECTOR_INLINE_THRESHOLD, SCM_BYTEVECTOR_INLINEABLE_SIZE_P, SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_INLINE): Remove. (SCM_BYTEVECTOR_HEADER_BYTES): New macro. (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust to new flag layout. (make_bytevector): Remove content inlining machinery; use `scm_gc_malloc_pointerless ()' in all cases; special-case zero-sized vu8 buffers. (make_bytevector_from_buffer): Simplified. (scm_c_shrink_bytevector): New, formerly `scm_i_shrink_bytevector ()'. Remove buffer inlining machinery. (scm_bootstrap_bytevectors): Use `make_bytevector ()' for SCM_NULL_BYTEVECTOR. * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): New macro. (SCM_BYTEVECTOR_CONTENTS): Adjust to new layout. (SCM_SET_BYTEVECTOR_FLAGS): Properly cast F. (SCM_F_BYTEVECTOR_INLINE, SCM_BYTEVECTOR_INLINE_P): Remove. (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust. (scm_c_shrink_bytevector): Remove macro, make a C function declaration. 2009-08-30 Ludovic Courtès Use a TC7 tag instead of a SMOB for bytevectors. * libguile/bytevectors.c (scm_tc16_bytevector): Remove. (SCM_BYTEVECTOR_SET_LENGTH, SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_INLINE, SCM_BYTEVECTOR_SET_ELEMENT_TYPE, make_bytevector_from_buffer, scm_is_bytevector, scm_bootstrap_bytevectors): Adjust to the SMOB->tc7 change. (scm_i_print_bytevector): New, formerly `print_bytevector ()'. (bytevector_equal_p): Remove. * libguile/bytevectors.h (SCM_BYTEVECTOR_LENGTH, SCM_BYTEVECTOR_CONTENTS, SCM_BYTEVECTOR_P): Adjust to SMOB->tc7 change. (SCM_BYTEVECTOR_FLAGS, SCM_SET_BYTEVECTOR_FLAGS): New macros. (scm_tc16_bytevector): Remove declaration. (scm_i_print_bytevector): New declaration. * libguile/eq.c (scm_equal_p): Handle `scm_tc7_bytevector'. * libguile/evalext.c (scm_self_evaluating_p): Likewise. * libguile/print.c (iprin1): Likewise. * libguile/tags.h (scm_tc7_bytevector): New. (scm_tc7_unused_8): Remove. * libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): Adjust. * test-suite/tests/bytevectors.test ("Datum Syntax")["self-evaluating?"]: New test. 2009-08-30 Neil Jerram Export readline history functions * guile-readline/ice-9/readline.scm: Export history functions. 2009-08-29 Michael Gran Range check octal-escaped characters * libguile/read.c (scm_read_character): range check octal escapes 2009-08-29 Michael Gran More tests for chars.test Testing out-of-range octals, bad charnames, and write format * test-suite/tests/chars.test 2009-08-29 Michael Gran More tests for chars.test * test-suite/tests/chars.test: more tests 2009-08-29 Michael Gran Surrogate characters shouldn't be in charsets * libguile/srfi-14.c (charsets_complement): use surrogate #defines instead of hardcoded numbers * libguile/srfi-14.i.c (cs_full_ranges): remove surrogates from full charset * libguile/unidata_to_charset.pl (full): test for surrogates 2009-08-29 Michael Gran Better range check for codepoints * libguile/chars.h (SCM_IS_UNICODE_CHAR): check for negative codepoints 2009-08-29 Michael Gran Cast the input to isalpha et al to integer * libguile/gc_os_dep.c (GC_linux_stack_base) [LINUX_STACKBOTTOM]: cast input of ctype functions to int * libguile/inet_aton.c (inet_aton): cast input of ctype functions to int * libguile/read.c (scm_scan_for_encoding): cast input of isalnum to int * libguile/win32-socket.c (scm_i_socket_uncomment): cast input of isspace to int 2009-08-28 Ludovic Courtès Add `BDW_GC_CFLAGS' to the `.pc' files. This is needed because is included in public headers (via . * meta/guile-2.0-uninstalled.pc.in (Cflags): Add `@BDW_GC_CFLAGS'. * meta/guile-2.0.pc.in (Cflags): Likewise. 2009-08-28 Ludovic Courtès Remove deprecated variables/macros from the GC headers. * libguile/deprecated.c (scm_mtrigger, scm_mallocated, scm_max_segment_size): New global variables, from gc.c. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New stubs. * libguile/deprecated.h (scm_mallocated, scm_mtrigger, scm_max_segment_size): New declarations. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New declarations. * libguile/gc-malloc.c (scm_i_minyield_malloc): Remove. (scm_gc_init_malloc): Remove references to `scm_i_minyield_malloc' and `scm_mtrigger'. * libguile/gc.c (scm_mtrigger, scm_mallocated): Remove. (scm_init_storage): Remove reference to `SCM_HEAP_SEG_SIZE'. * libguile/gc.h (scm_max_segment_size, SCM_SET_FREELIST_LOC, SCM_FREELIST_LOC, scm_i_master_freelist, scm_i_master_freelist2, scm_mallocated, scm_mtrigger): Remove. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[SCM_ENABLE_DEPRECATED && GUILE_DEBUG_FREELIST]: Remove. * libguile/private-gc.h (SCM_DEFAULT_INIT_HEAP_SIZE_1, SCM_DEFAULT_MIN_YIELD_1, SCM_DEFAULT_MIN_YIELD_2, DEFAULT_SWEEP_AMOUNT, SCM_DEFAULT_MAX_SEGMENT_SIZE, SCM_MIN_HEAP_SEG_SIZE, SCM_HEAP_SEG_SIZE, SCM_GC_CARD_BVEC_SIZE_IN_LONGS, SCM_GC_IN_CARD_HEADERP): Remove. (scm_getenv_int): Made internal. (scm_i_marking, scm_mark_all, scm_i_deprecated_memory_return, scm_i_find_heap_calls, scm_gc_init_malloc, scm_gc_init_freelist, scm_gc_init_segments, scm_gc_init_mark): Remove declarations. * libguile/gc-segment-table.c: Remove, finally. 2009-08-28 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/bytevectors.c libguile/gc-card.c libguile/gc-mark.c libguile/programs.c libguile/srcprop.c libguile/srfi-14.c libguile/symbols.c libguile/threads.c libguile/unif.c libguile/vm.c 2009-08-28 Andy Wingo fix case in which compiled path had stale .go, but fallback had fresh .go * libguile/load.c (scm_primitive_load_path): If the compiled path was out of date, but the fallback path was current, we correctly detected that case, but loaded the wrong file. So here fix the typo. 2009-08-28 Michael Gran Don't presume existence or success of setlocale in test-suite * test-suite/lib.scm (with-locale, with-locale*): new test functions * test-suite/tests/encoding-escapes: don't fail if en_US.utf8 doesn't exist * test-suite/tests/encoding-iso88591.test: set and restore locale, if possible * test-suite/tests/encoding-iso88597.test: set and restore locale, if possible * test-suite/tests/encoding-utf8.test: set and restore locale, if possible * test-suite/tests/srfi-14.test: don't need to setlocale to Latin-1 to test Latin-1 since string conversion is handled at read/compile time. Set and restore locale, if possible. 2009-08-28 Michael Gran scm_getc improperly handles Latin-1 characters Upper-plane Latin-1 characters should be converted to codepoints. * libguile/ports.c (scm_getc): improper conversion of char to scm_t_wchar 2009-08-28 Michael Gran Fix FUNC_NAME definitions and #endif in srfi-14.[ch] * libguile/srfi-14.c: whitespace and FUNC_NAME fixes * libguile/srfi-14.h: #endif comment 2009-08-28 Michael Gran Script to generate srfi-14 charsets from UnicodeData.txt This script was used to generate srfi-14.i.c from the UnicodeData.txt file supplied by ftp://www.unicode.org/Public/UNIDATA/ * libguile/unidata_to_charset.pl 2009-08-28 Neil Jerram Fix GDS utility client startup * emacs/gds-scheme.el (gds-start-utility-guile): Use buffer-local variable gds-client instead of client, as client is actually unbound when the process-filter lambda runs. (i.e. This isn't Scheme code!) 2009-08-28 Ludovic Courtès Add missing `FUNC_NAME' definition. * libguile/load.c (scm_sys_warn_autocompilation_enabled): Define `FUNC_NAME'. 2009-08-27 Neil Jerram Merge branch 'ossau-gds-dev' Conflicts: THANKS 2009-08-27 Neil Jerram Fix doc of let*-values Thanks to Judy Hawkins for reporting this. * doc/ref/api-modules.texi (Included Guile Modules): Change `let-values*' to `let*-values'. 2009-08-27 Neil Jerram Make GDS resilient to autocompilation comments * emacs/gds-scheme.el (gds-start-utility-guile): Make the extraction of client number more robust; in particular when the client emits comments (about auto compilation) before the number. 2009-08-27 Neil Jerram Incorporate ice-9-debugger-extensions properly i.e. put the extensions where they need to be, and delete ice-9-debugger-extensions.scm. * doc/ref/api-debug.texi (Single Stepping through a Procedure's Code): Change mentions of (ice-9 debugging ice-9-debugger-extensions) module to whatever is appropriate now (or just remove them). * module/Makefile.am (NOCOMP_SOURCES): Remove ice-9-debugger-extensions.scm. * module/ice-9/debugger.scm (debug-trap): Move here from ice-9-debugger-extensions.scm. * module/ice-9/debugger/command-loop.scm ("continue", "finish", "step", "next"): Move here from ice-9-debugger-extensions.scm. * module/ice-9/debugger/commands.scm (assert-continuable, continue, finish, step, next): Move here from ice-9-debugger-extensions.scm. * module/ice-9/debugging/breakpoints.scm: Don't use ice-9-debugger-extensions module. * module/ice-9/debugging/ice-9-debugger-extensions.scm: Removed. * module/ice-9/debugging/trace.scm, module/ice-9/debugging/traps.scm: Remove more old version code. * module/ice-9/debugging/traps.scm (guile-trap-features): Hardcoded as '(tweaking). 2009-08-27 Neil Jerram Remove superfluous ice-9-debugger-extensions code for old Guile versions * module/ice-9/debugging/ice-9-debugger-extensions.scm: Remove all code checking for version < 1.7, and move code for versions >= 1.7 up to top level. Comment out dummy mutex definitions for now, as I'm not sure how to rewrite them correctly for psyntax. 2009-08-27 Daniel Kraft Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp Support circular structures in elisp reader. * module/language/elisp/lexer.scm: Recognize circular markers. * module/language/elisp/parser.scm: Handle them correctly. * test-suite/tests/elisp-reader.test: Check circular structure parsing. 2009-08-27 Michael Gran Default srfi-14 character set information * libguile/srfi-14.i.c: structures containing the default srfi-14 sets 2009-08-27 Daniel Kraft Replaced generated elisp parser with hand-written one to fix source properties. * module/language/elisp/parser.scm: Hand-written parser. * test-suite/tests/elisp-reader.test: Test for source properties. 2009-08-27 Michael Gran Always cast input to toupper as int * libguile/read.c (scm_scan_for_encoding): add cast to int Segfault when writing non-Latin-1 characters under Latin-1 locale * libguile/print.c (iprin1): handle write of non-Latin-1 characters under the Latin-1 locale 2009-08-27 Michael Gran Unicode-capable srfi-14 charsets * libguile/Makefile.am: distribute new files srfi-14.i.c and unidata_to_charset.pl * chars.c (scm_c_upcase, scm_c_downcase): use unicode-enable toupper and tolower * libguile/srfi-14.h (scm_t_char_range, scm_t_char_set): new structures to describe char-sets (scm_t_char_set_cursor): new structure to describe char-set-cursors (SCM_BITS_PER_LONG): removed (SCM_CHARSET_GET): calls function New declarations for scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset, and scm_debug_char_set. * test-suite/tests/srfi-14.test: new tests * libguile/srfi-14.c (SCM_CHARSET_DATA): new macro (SCM_CHARSET_SET, SCM_CHARSET_UNSET): call function (BYTES_PER_CHARSET, LONGS_PER_CHARSET): removed (scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset) (charsets_equal, charsets_leq, charsets_union) (charsets_intersection, charsets_complement, charsets_xor): new functions that are low-level charset operators (charset_print, charset_free): modified for new charset struct (charset_cursor_print, charset_cursor_free): new function (make_char_set, scm_char_set_p, scm_char_set_eq, scm_car_set_leq) (scm_char_set_hash, scm_char_set_cursor, scm_char_set_ref) (scm_char_set_cursor_next, scm_end_of_char_set_p, scm_char_set_fold) (scm_char_set_unfold, scm_char_set_unfold_x, scm_char_set_for_each) (scm_char_set_map, scm_char_set_copy, scm_char_set, scm_list_to_char_set) (scm_list_to_char_set_x, scm_string_to_char_set, scm_string_to_char_set_x) (scm_char_set_filter, scm_char_set_filter_x, scm_ucs_range_to_char_set) (scm_ucs_range_to_char_set_x, scm_to_char_set, scm_char_set_size) (scm_char_set_count, scm_char_set_to_list, scm_char_set_to_string) (scm_char_set_contains_p, scm_char_set_every, scm_char_set_any) (scm_char_set_adjoin, scm_char_set_delete, scm_char_set_adjoin_x) (scm_char_set_delete_x, scm_char_set_complement, scm_char_set_union) (scm_char_set_intersection, scm_char_set_difference, scm_char_set_xor) (scm_char_set_diff_plus_intersection, scm_char_set_complement_x) (scm_char_set_union_x, scm_char_set_intersection_x, scm_char_set_difference_x) (scm_char_set_xor_x, scm_char_set_diff_plus_intersection_x): modified to use new charset and charset-cursor data structures (CSET_BLANK_PRED, CSET_SYMBOL_PRED, CSET_PUNCT_PRED, CSET_LOWER_PRED) (CSET_UPPER_PRED, CSET_LETTER_PRED, CSET_DIGIT_PRED, CSET_WHITESPACE_PRED) (CSET_CONTROL_PRED, CSET_HEX_DIGIT_PRED, CSET_ASCII_PRED, CSET_LETTER_PRED) (CSET_LETTER_AND_DIGIT_PRED, CSET_PRINTING_PRED, CSET_TRUE_PRED) (CSET_FALSE_PRED): removed (scm_srfi_14_compute_char_sets): removed - too slow to iterate over all of unicode at startup (scm_debug_char_set) [SCM_CHARSET_DEBUG]: new function 2009-08-27 Daniel Kraft Don't accept backquote/unquote/unquote-splicing any longer in elisp. The real names \`, \, and \,@ should be used instead and are returned now by the real reader. * module/language/elisp/compile-tree-il.scm: Only accept correct names. 2009-08-27 Andy Wingo Revert "eval is actually compile" This reverts commit afe5e6baa76796b1467890fd55416a7f304bed5c. 2009-08-27 Ken Raeburn Don't leave and reenter guile mode if mutex is available On Aug 5, 2009, at 10:06, Ken Raeburn wrote: > (1) In scm_pthread_mutex_lock, we leave and re-enter guile mode so > that we don't block the thread while in guile mode. But we could > use pthread_mutex_trylock first, and avoid the costs scm_leave_guile > seems to incur on the Mac. If we can't acquire the lock, it should > return immediately, and then we can do the expensive, blocking > version. A quick, hack version of this changed my run time for > A(3,8) from 17.5s to 14.5s, saving about 17%; sigaltstack and > sigprocmask are still in the picture, because they're called from > scm_catch_with_pre_unwind_handler. I'll work up a nicer patch > later. Ah, we already had scm_i_pthread_mutex_trylock lying around; that made things easy. A second timing test with A(3,9) and this version of the patch (based on 1.9.1) shows the same improvement. * libguile/threads.c (scm_pthread_mutex_lock): Try the mutex before leaving and reentering guile mode. 2009-08-27 Ken Raeburn Pick up in tree headers rather than installed ones From Ken Raeburn: The Mac build off of "master" fails for me currently in srfi-13.c, with the comparison-always-false warning Greg discussed. I hacked around that, but then guile-readline doesn't build: Making all in guile-readline ../libguile/guile-snarf -o readline.x ../../guile-readline/readline.c - DHAVE_CONFIG_H -I. -I.. -I../../guile-readline/.. -I../../guile- readline/lib -I./lib -g -O2 In file included from ../../guile-readline/readline.c:29: ../../guile-readline/../libguile.h:25:17: error: gmp.h: No such file or directory In file included from ../../guile-readline/../libguile.h:95, from ../../guile-readline/readline.c:29: ../../guile-readline/../libguile/strings.h:26:21: error: uniconv.h: No such file or directory Neither the path specified for libgmp nor the path specified for libunistring at configure time is included here. I don't think any of this is Mac-specific; I'm surprised that it works on GNU/Linux systems. Perhaps I'm building it in ways that are unusual for the other developers (build dir != src dir, libgmp and guile-1.8 installed in the same place, libgmp and libunistring installed in different nonstandard directories)? If I use CPPFLAGS=... and LDFLAGS=... instead of --with-libfoo-prefix configure options to specify paths to find libgmp and libunistring, the tests still pick old, installed Guile headers (which this time I've poisoned to highlight the problem) from those locations instead of the in-tree versions: Making all in test-suite Making all in standalone ../../libguile/guile-snarf -o test-asmobs-lib.x ../../../test-suite/ standalone/test-asmobs-lib.c -DHAVE_CONFIG_H -I. -I../../../test-suite/ standalone -I../.. -I/opt/local/include -I/Users/raeburn/dev/guile/ libunistring-0.9.1/I/include -g -O2 -I../../.. -I../../../lib -I../../ lib -I../.. In file included from /opt/local/include/libguile.h:30, from ../../../test-suite/standalone/test-asmobs- lib.c:23: /opt/local/include/libguile/__scm.h:3:2: error: #error Poison! I might be building Guile as part of a larger package (*cough*Emacs*cough*) that wants to include stuff from the same system directories (e.g., for MacPorts, pkgsrc, whatever) where an old version of Guile is installed, and thus Guile gets passed CPPFLAGS/ LDFLAGS settings that add that old version to the search paths. So I think the CPPFLAGS/LDFLAGS version needs to be made to work, as well as the --with-libfoo-prefix version. With the attached patch, I can get guile to build with CPPFLAGS= and LDFLAGS= ... someone more familiar than I am with automake will have to fix the guile-readline stuff. 2009-08-26 Daniel Kraft Error in lexer when 'empty' symbol would have been read. Parser for elisp and use it as reader. * module/language/elisp/parser.scm: New parser file. * module/language/elisp/lexer.scm: Fix lexer/1 and add unquote-splicing support. * module/language/elisp/spec.scm: Use new elisp-reader. * module/language/elisp/README: Document we've got a reader now. * test-suite/tests/elisp-reader.test: Test the parser. get-lexer/1 for elisp that finishes after the first full expression is read. * module/language/elisp/lexer.scm: Add get-lexer/1. * test-suite/tests/elisp-reader.test: Test lexer/1. Character and string literal support for the elisp lexer. * module/language/elisp/lexer.scm: Handle character and string literals. * test-suite/tests/elisp-reader.test: Test it. A first, rough lexer for elisp still missing some stuff. * module/language/elisp/lexer.scm: New lexer file. * test-suite/Makefile.am: Register elisp-reader.test as new test. * test-suite/tests/elisp-reader.test: New test-case. 2009-08-26 Andy Wingo fix uninitialized variable in scm_read_character * libguile/read.c (scm_read_character): Fix uninitialized variable. actually install guile-tools * meta/Makefile.am (bin_SCRIPTS): Re-add guile-tools here (removed in 54b38caf19deb0e5a6e8146c65b3e176e7fffa60). Otherwise guile-tools doesn't get installed. I think that 1.9.2 had this bug. fix guile-readline linker bug * acinclude.m4 (GUILE_READLINE): Fix typo that caused readline not to be linked to termcap. 2009-08-25 Ludovic Courtès Remove the `scm_tc_free_cell' SMOB type. * libguile/deprecated.h (SCM_FREEP, SCM_NFREEP): Changed to constants. * libguile/gc.c (scm_i_tag_name): Remove reference to `scm_tc_free_cell'. * libguile/gc.h (SCM_FREE_CELL_CDR, SCM_SET_FREE_CELL_CDR): Remove. * libguile/smob.c (free_print): Remove. (scm_smob_prehistory): Don't create the "free" SMOB type. * libguile/struct.c (struct_finalizer_trampoline): Use a bare `scm_tc3_struct' tag for finalized structs instead of `scm_tc_free_cell'. * libguile/tags.h (scm_tc_free_cell): Remove. 2009-08-25 Andy Wingo Merge commit 'origin/master' Conflicts: libguile/unif.c Merge wip-array refactor, up to cd43fdc5b7a7c Conflicts: NEWS libguile/print.c 2009-08-25 Michael Gran Add full Unicode capability to ports and the default reader Ports are given two additional properties: a character encoding and a conversion failure strategy. These properties have getters and setters. The new properties are used to convert any locale text to/from the internal representation of strings. If unspecified, ports use a default value. The default value of these properties is held in a fluid. The default character encoding can be modified by calling setlocale. ISO-8859-1 is treated specially. Since it is a native encoding of strings, it can be processed more quickly. Source code is assumed to be ISO-8859-1 unless otherwise specified. The encoding of a source code file can be given as 'coding: XXXXX' in a magic comment at the top of a file. The C functions that deal with encoding often use a null pointer as shorthand for the native Latin-1 encoding, for efficiency's sake. * test-suite/tests/encoding-iso88591.test: new tests * test-suite/tests/encoding-iso88597.test: new tests * test-suite/tests/encoding-utf8.test: new tests * test-suite/tests/encoding-escapes.test: new tests * test-suite/tests/numbers.test: declare 'binary' encoding * test-suite/tests/ports.test: declare 'binary' encoding * test-suite/tests/r6rs-ports.test: declare 'binary' encoding * module/system/base/compile.scm (compile-file): use source-code file's self-declared encoding when compiling files * libguile/strports.c: store string ports in locale encoding (scm_strport_to_locale_u8vector, scm_call_with_output_locale_u8vector) (scm_open_input_locale_u8vector, scm_get_output_locale_u8vector): new functions * libguile/strings.h: new declaration for scm_i_string_contains_char * libguile/strings.c (scm_i_string_contains_char): new function (scm_from_stringn, scm_to_stringn): use NULL for Latin-1 (scm_from_locale_stringn, scm_to_locale_stringn): respect character encoding of input and output ports * libguile/read.h: declaration for scm_scan_for_encoding * libguile/read.c: (read_token): now takes scheme string instead of C string/length (read_complete_token): new function (scm_read_sexp, scm_read_number, scm_read_mixed_case_symbol) (scm_read_number_and_radix, scm_read_quote, scm_read_semicolon_comment) (scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bit_vector) (scm_read_scsh_block_comment, scm_read_commented_expression) (scm_read_extended_symbol, scm_read_sharp_extension, scm_read_shart) (scm_read_expression): use scm_t_wchar for char type, use read_complete_token (scm_scan_for_encoding): new function to find a file's character encoding (scm_file_encoding): new function to find a port's character encoding * libguile/rdelim.c: don't unpack strings * libguile/print.h: declaration for modified function scm_i_charprint * libguile/print.c: use locale when printing characters and strings (scm_i_charprint): input parameter is now scm_t_wchar (scm_simple_format): don't unpack strings * libguile/posix.h: new declaration for scm_setbinary. * libguile/posix.c (scm_setlocale): set default and stdio port encodings based on the locale's character encoding (scm_setbinary): new function * libguile/ports.h (scm_t_port): add encoding and failed conversion handler to port type. Declarations for new or modified functions scm_getc, scm_unget_byte, scm_ungetc, scm_i_get_port_encoding, scm_i_set_port_encoding_x, scm_port_encoding, scm_set_port_encoding_x, scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x, scm_port_conversion_strategy, scm_set_port_conversion_strategy_x. * libguile/ports.c: assign the current ports to zero on startup so we can see if they've been set. (scm_current_input_port, scm_current_output_port, scm_current_error_port): return #f if the port is not yet initialized (scm_new_port_table_entry): set up a new port's encoding and illegal sequence handler based on the thread's current defaults (scm_i_remove_port): free port encoding name when port is removed (scm_i_mode_bits_n): now takes a scheme string instead of a c string and length. All callers changed. (SCM_MBCHAR_BUF_SIZE): new const (scm_getc): new function, since the scm_getc in inline.h is now scm_get_byte_or_eof. This pulls one codepoint from a port. (scm_lfwrite_substr, scm_lfwrite_str): now uses port's encoding (scm_unget_byte): new function, incorportaing the low-level functionality of scm_ungetc (scm_ungetc): uses scm_unget_byte * libguile/numbers.h (scm_t_wchar): compilation order problem with scm_t_wchar being use in functions in multiple headers. Forward declare scm_t_wchar. * libguile/load.c (scm_primitive_load): scan for file encoding at top of file and use it to set the load port's encoding * libguile/inline.h (scm_get_byte_or_eof): new function incorporating most of the functionality of scm_getc. * libguile/fports.c (fport_fill_input): now returns scm_t_wchar * libguile/chars.h (scm_t_wchar): avoid compilation order problem with declaration of scm_t_wchar 2009-08-23 Michael Gran Avoid unpacking symbols in GOOPS * libguile/goops.c (scm_make_extended_class_from_symbol): new function (scm_class_of): don't unpack symbol chars (wrap_init): don't unpack symbol chars (make_class_from_symbol): new function (make_struct_class): don't unpack symbol chars 2009-08-23 Michael Gran Modify socket and time functions for wide strings * libguile/socket.c (scm_recv): receive the message without holding the stringbuf writing lock (scm_send): try to narrow a string before using it * libguile/stime.c (strftime): convert string to UTF-8 so that it can be safely passed to strftime (strptime): convert input string to UTF-8 so that it can be safely passed through strptime * libguile/strings.c (narrow_stringbuf): new function (scm_i_try_narrow_string): new function * libguile/strings.h: new declaration for scm_i_try_narrow_string 2009-08-23 Michael Gran Use string and symbol accessors in struct, throw, and array funcs * libguile/struct.c (scm_make_struct_layout, scm_struct_init) (scm_struct_vtable_p, scm_struct_ref, scm_struct_set_x): use string and symbol accessors and avoid unpacking strings and symbols * libguile/throw.c (scm_ithrow): allow wide symbols in the error message * libguile/unif.c (scm_enclose_array, scm_istr2bve): use string accessors and avoid unpacking strings 2009-08-23 Michael Gran Avoid type-punning warning in scm_gentemp Int and size_t may not have the same storage size * libguile/deprecated.c (scm_gentemp): use size_t for string length 2009-08-21 Neil Jerram Update NEWS 2009-08-22 Neil Jerram Avoid clash with system setjmp/longjmp on IA64 Problem was that if an application includes both libguile.h and the system's setjmp.h, and is compiled on IA64, it gets compile errors because of jmp_buf, setjmp and longjmp being multiply defined. * libguile/__scm.h (__ia64__): Define scm_i_jmp_buf, SCM_I_SETJMP and SCM_I_LONGJMP instead of jmp_buf, setjmp and longjmp. (all other platforms): Map scm_i_jmp_buf, SCM_I_SETJMP and SCM_I_LONGJMP to jmp_buf, setjmp and longjmp. * libguile/continuations.c (scm_make_continuation): Use `SCM_I_SETJMP' instead of `setjmp'. (copy_stack_and_call): Use `SCM_I_LONJMP' instead of `longjmp'. (scm_ia64_longjmp): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/continuations.h (scm_t_contregs): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/threads.c (suspend): Use `SCM_I_SETJMP' instead of `setjmp'. * libguile/threads.h (scm_i_thread): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/throw.c (JBJMPBUF, make_jmpbuf, jmp_buf_and_retval): Use type `scm_i_jmp_buf' instead of `jmp_buf'. (scm_c_catch): Use `SCM_I_SETJMP' instead of `setjmp'. (scm_ithrow): Use `SCM_I_LONGJMP' instead of `longjmp'. 2009-08-22 Neil Jerram Remove trailing whitespace Fix set-source-properties so that the special source properties work * libguile/srcprop.c (scm_set_source_properties_x): Look for the special source properties, save them off, and then construct a srcprops object using them. 2009-08-22 Neil Jerram In srcprop.c change all occurrences of "plist" to "alist" As with the previous commit, this is to avoid any suggestion that the source properties API uses the property list format, i.e. (key1 value1 key2 value2 ...). Also remove scm_srcprops_to_plist () from the API. It doesn't have any external usefulness and has never documented. 2009-08-22 Neil Jerram Minor improvements to doc on source properties In particular avoid any suggestion that the API uses the property list format, i.e. (key1 value1 key2 value2 ...), as opposed to the alist format that it actually does use. 2009-08-21 Neil Jerram Merge branch 'wip-manual' of ssh://ossau@git.sv.gnu.org/srv/git/guile Conflicts: doc/ref/autoconf.texi doc/ref/vm.texi 2009-08-21 Michael Gran Use uc_tolower in number conversion * libguile/numbers.c (XDIGIT2UINT): use uc_tolower 2009-08-21 Michael Gran Use string accessors for string->number conversion * libguile/numbers.c (scm_i_print_fraction): use string accessors (XDIGIT2UINT): use libunistring function (mem2uinteger, mem2integer, mem2decimal_from_point, mem2ureal) (mem2complex): take scheme string instead of c string; use accessors (scm_i_string_to_number): new function (scm_c_locale_string_to_number): use scm_i_string_to_number * libguile/numbers.h: declaration for scm_i_string_to_number * libguile/strings.c (scm_i_string_strcmp): new function * libguile/strings.h: declaration for scm_i_string_strcmp 2009-08-21 Michael Gran Add initial support for wide symbols * libguile/hash.c (scm_i_string_hash): new function (scm_hasher): don't unpack string: use scm_i_string_hash * libguile/hash.h: new declaration for scm_i_string_hash * libguile/print.c (quote_keywordish_symbol): use symbol accessors (scm_i_print_symbol_name): new function (scm_print_symbol_name): call scm_i_print_symbol_name (iprin1): use scm_i_print_symbol_name to print symbols * libguile/print.h: new declaration for scm_i_print_symbol_name * libguile/symbols.c (lookup_interned_symbol): now takes scheme string instead of c string; callers changed (lookup_interned_symbol): add wide symbol support (scm_i_c_mem2symbol): removed (scm_i_mem2symbol): removed and replaced with scm_i_str2symbol (scm_i_str2symbol): new function (scm_i_mem2uninterned_symbol): removed and replaced with scm_i_str2uninterned_symbol (scm_i_str2uninterned_symbol): new function (scm_make_symbol, scm_string_to_symbol, scm_from_locale_symbol) (scm_from_locale_symboln): use scm_i_str2symbol * test-suite/tests/symbols.test: new tests 2009-08-21 Michael Gran Use symbol accessors in scm_gc_mark_dependencies * libguile/gc-mark.c (scm_gc_mark_dependencies): don't unpack symbols. Use symbol accessors. Use string accessors in scm_basename and scm_dirname * libguile/filesys.c (basename, dirname): don't unpack strings. Use string accessor functions. Avoid type-limits warning in SCM_TO_TYPE_PROTO * libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): avoid a comparison that is always true due to the limited range of the data type Type-limits error in GC environment initialization * libguile/gc-malloc.c (scm_gc_init_malloc): GUILE_INIT_MALLOC_LIMIT is cast to unsigned then tested as if it were still signed 2009-08-21 Michael Gran Avoid accessing symbol internals in call_dsubr_1 and DEVAL The symbol's characters are only accessed in case they are needed for an error message. This can be avoided by passing the symbol all the way to a error message function. * libguile/__scm.h (SCM_WTA_DISPATCH_1_SUBR): new macro * libguile/error.c (scm_i_wrong_type_arg_symbol): new error function * libguile/error.h: declaration of scm_i_wrong_type_arg_symbol * libguile/eval.c (call_dsubr_1): use new macro SCM_WTA_DISPATCH_1_SUBR to avoid having to unpack the symbol's chars * libguile/eval.i.c: use new macro SCM_WTA_DISPATCH_1_SUBR 2009-08-21 Michael Gran Use string and symbol accessors with obarrays and keyword-dash-symbols * libguile/deprecated.c (intern_obarray_soft): new function (scm_intern_obarray_soft, scm_string_to_obarray_symbol): use intern_obarray_soft (scm_gentemp): don't unpack string chars, use intern_obarray_soft * libguile/discouraged.c (scm_make_keyword_from_dash_symbol): use symbol accessor 2009-08-21 Ludovic Courtès Aggregate `guile-readline' makefiles. * configure.ac: Don't produce `guile-readline/ice-9/Makefile'. * guile-readline/Makefile.am (SUBDIRS): Remove. (ice9dir, nobase_ice9_DATA): New, formerly under `ice-9'. (ETAGS_ARGS, EXTRA_DIST): Augment. (DEFS): Move outside of `if'. (MKDEP): Remove. * guile-readline/ice-9/Makefile.am: Remove. 2009-08-21 Ludovic Courtès Don't use a sub-`configure' for `guile-readline'. * acinclude.m4 (GUILE_READLINE): New macro, based on the former `guile-readline/configure.ac'. * configure.ac: Remove `AC_CONFIG_SUBDIRS' invocation. Add `GUILE_READLINE' invocation. Produce files under `guile-readline'. * guile-readline/Makefile.am: Conditionalize the meat under `HAVE_READLINE'. (INCLUDES): Rename to... (AM_CPPFLAGS): this. Users updates. (AM_CFLAGS): New variable. (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): Add $(READLINE_LIBS). * guile-readline/readline.c: Include . * guile-readline/configure.ac, guile-readline/autogen.sh: Remove. 2009-08-20 Andy Wingo eval is actually compile * module/ice-9/boot-9.scm (eval): Here at the tail of boot-9, replace the root definition of `eval' with a procedure that will call `compile'. * test-suite/tests/syntax.test ("top-level define"): ("internal define"): Run unmemoization tests in the interpreter, using primitive-eval. 2009-08-20 Andy Wingo programs have their own tc7 now * libguile/tags.h (scm_tc7_program): * libguile/programs.h: Programs now have their own tc7 code. Fix up the macros appropriately. * libguile/programs.c: Remove smobby bits, leaving marking, printing, and application for other parts of Guile. * libguile/debug.c (scm_procedure_source): * libguile/eval.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): Add cases for tc7_program. * libguile/eval.i.c (CEVAL, SCM_APPLY): * libguile/evalext.c (scm_self_evaluating_p): * libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name): * libguile/gc-mark.c (1): * libguile/print.c (iprin1): * libguile/procs.c (scm_procedure_p, scm_thunk_p) * libguile/vm-i-system.c (make-closure): Adapt to new procedure representation. * libguile/procprop.c (scm_i_procedure_arity): Do the right thing for programs. * test-suite/tests/procprop.test ("procedure-arity"): Arity test now succeeds. * libguile/goops.c (scm_class_of): Programs now belong to the class , not a smob class. * libguile/vm.h (struct vm, struct vm_cont): * libguile/vm-engine.c (vm_engine): * libguile/frames.h (SCM_FRAME_BYTE_CAST, struct vm_frame): * libguile/frames.c (scm_c_make_vm_frame): Fix usages of scm_byte_t, changing them to scm_t_uint8. 2009-08-20 Andy Wingo eval-elisp uses primitive-eval * lang/elisp/interface.scm (eval-elisp): Use primitive-eval, as we will be switching the evaluator soon. 2009-08-20 Andy Wingo define @bind using syntax-case * module/ice-9/boot-9.scm (@bind): Define a VM-compatible syntax definition for this old evaluator primitive. * test-suite/tests/dynamic-scope.test: Change the expected error messages. 2009-08-20 Andy Wingo use primitive-eval in run-vm-tests.scm * testsuite/run-vm-tests.scm (run-vm-tests): Use primitive-eval, as we'll be changing eval soon. better VM error messages * libguile/vm-engine.c: Attempt to make error messages more friendly and uniform with historical expectation. update docs for calling convention change * doc/ref/vm.texi: Update. 2009-08-20 Andy Wingo push new frame on stack before procedure & args * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump * libguile/vm-engine.c (vm_engine): Push a frame corresponding to the mv-call. * libguile/vm-i-system.c: Renumber ops. (new-frame): New op, pushes a frame. (call, mv-call): No need to shuffle args, though we do need to pop the frame in the non-vm call case. (goto/args): Inconsequential tweaks. (call/cc): Push a frame if needed. * module/language/tree-il/compile-glil.scm (flatten): Emit `new-frame' as appropriate. * test-suite/tests/tree-il.test: Fix to expect new-frame. 2009-08-20 Andy Wingo reorder frame layout * libguile/frames.h: Reorder the frame layout so the return address comes below the arguments.working (SCM_FRAME_SET_RETURN_ADDRESS, SCM_FRAME_SET_MV_RETURN_ADDRESS): New macros. * libguile/frames.c (scm_vm_frame_arguments): Use the macros to access the arguments. * libguile/vm-engine.c (vm_engine): Fix for new calling convention. * libguile/vm-engine.h (INIT_FRAME): New macro. Does part of what NEW_FRAME used to do. * libguile/vm-i-system.c (call, mv-call): Shuffle args up to make room for the stack, and adapt to new calling convention. (goto/args): Shuffling down is easier now. (return, return/args): Adapt to new frame layout. * libguile/vm.c (vm_mark_stack): Adapt to new frame layout, and the possibility of there being crap on the stack. (really_make_boot_program): Remove extraneous comment. 2009-08-20 Andy Wingo remove dead weight from vm-i-system.c * libguile/vm-i-system.c: Remove mark, list-mark, cons-mark, vector-mark, and list-break, as they are no longer used. (call, goto/args, mv-call): Remove bits about trampolines, which was slower, and VM continuations, which are not used (we use Guile's continuations as the applicable objects). Renumber ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. 2009-08-20 Andy Wingo disable autocompilation in the test suite * check-guile.in: Disable autocompilation while working in the test suite, for now at least. We'll enable it again later. 2009-08-20 Andy Wingo autocompiled files before installation go to a cache dir in the builddir * libguile/load.c (scm_init_load_path): Append a slash after XDG_CACHE_HOME. * meta/gdb-uninstalled-guile.in: * meta/guile.in (XDG_CACHE_HOME): Export this var so we write to a cache within the build directory. Probably we should have a GUILE_CACHE_DIR to be more specific, though. * Makefile.am (clean-local): Clear the cache when making clean. 2009-08-20 Michael Gran type limits error in string-tabulate * libguile/srfi-13.c (scm_string_tabulate): test range of signed integer before casting it to unsigned size_t 2009-08-20 Ludovic Courtès Relax assumptions made in the precise VM stack marking procedure. * libguile/vm.c (vm_stack_mark): Change assertions into checks to determine whether VM points to a sane (initialized) object. The assumption previously was that free-list elements would be zeroed, as implied by the comment in , but this doesn't appear to be the case. 2009-08-20 Michael Gran Update srfi-13 functions for Unicode * libguile/srfi-13.c (MY_SUBF_VALIDATE_SUBSTRING_SPEC): new macro (MY_VALIDATE_SUBSTRING_SPEC_COPY): now unused, removed (MY_VALIDATE_SUBSTRING_SPEC_UCOPY): now unused, removed (REF_IN_CHARSET): new macro (race_error)[0]: unused, removed (scm_string_any, scm_string_every, scm_string_tabulate) (scm_substring_to_list, scm_reverse_string_to_list) (scm_reverse_list_to_string, scm_string_join) (s_scm_srfi13_substring_copy, scm_string_copy, scm_string_copy_x) (scm_string_pad, scm_string_pad_right, scm_string_trim) (scm_string_trim_right, scm_string_trim_both, scm_substring_fill_x): (scm_string_compare, scm_string_compare_ci): modified for both wide and narrow strings (compare_string): new function (scm_string_eq, scm_string_neq, scm_string_lt, scm_string_gt) (scm_string_le, scm_string_ge, scm_string_ci_eq, scm_string_ci_neq) (scm_string_ci_lt, scm-string_ci_gt, scm_string_ci_le, scm_string_ci_gt) (scm_substring_hash, scm_string_prefix_length, scm_string_suffix_length) (scm_string_prefix_length_ci, scm_string_suffix_length_ci) (scm_string_prefix_p, scm_string_prefix_ci_p, scm_string_suffix_p) (scm_string_suffix_ci_p, scm_string_index, scm_string_index_right) (scm_string_skip, scm_string_skip_right, scm_string_count) (scm_string_contains, scm_string_contains_ci, string_upcase_x) (scm_substring_upcase_x, scm_substring_upcase, string_downcase_x) (scm_string_downcase_x, scm_string_downcase, scm_string_titlecase_x) (scm_string_titlecase, scm_string_capitalize, scm_string_reverse) (scm_string_reverse_x, scm_string_map, scm_string_map_x) (scm_string_fold, scm_string_fold_right, scm_string_unfold) (scm_string_unfold_right, scm_xsubstring, scm_string_xcopy_x) (scm_string_replace, scm_string_tokenize, scm_string_split) (scm_string_filter, scm_string_delete): modified for both wide and narrow strings Some srfi-13 test with wide strings * test-suite/tests/srfi-13.test: more tests 2009-08-20 Michael Gran Updates to benchmarks for srfi-13 Test more of the positive paths. Add test for string-prefix-ci? string-suffix-ci? and string-hash-ci. Update the counts per test to give approximately the same bench/interp time for each test for 1.8.7. * benchmark-suite/benchmarks/srfi-13.bm: update benchmarks 2009-08-20 Michael Gran Avoid possible mutex hang on error message output Avoid possible mutex hang when scm_lfwrite_substr is used in error message output and when an error has caused the stringbuf write mutex to not be unlocked. scm_lfwrite_substr makes a substring: making a substring requires that mutex. Hopefully, all cases of non-local jumps when the stringbuf write lock is held have been eliminated anyway, making this O.B.E. * libguile/ports.c (scm_lfwrite_str): include functionality in this function instead of making this a special case of scm_lfwrite_substr 2009-08-20 Michael Gran Add VM exception in strings.test * test-suite/tests/strings.test (exception:wrong-type-arg): change regex Try to optimize scm_string for speed * libguile/strings.c (scm_string): optimize for speed 2009-08-20 Michael Gran Rename string-width to string-bytes-per-char * libguile/strings.h: rename scm_string_width to scm_string_bytes_per_char * libguile/strings.c (scm_string_width): renamed to scm_string_bytes_per_char (scm_string_bytes_per_char): renamed from scm_string_width * module/language/assembly/compile-bytecode.scm (write-bytecode): string-width -> string-bytes-per-char * module/language/glil/compile-assembly.scm (dump-object): string-width -> string-bytes-per-char 2009-08-20 Michael Gran Misleading error message text in scm_i_string_writable_wide_chars * libguile/strings.c (scm_i_string_writable_wide_chars): change error text 2009-08-20 Ludovic Courtès Implement precise marking of the VM stack. Suggested by Andy Wingo. * libguile/vm.c (VM_ENABLE_PRECISE_STACK_GC_SCAN): New macro. (vm_stack_gc_kind): New variable. (make_vm)[VM_ENABLE_PRECISE_STACK_GC_SCAN]: Use `GC_generic_malloc ()' to allocate the stack. (vm_stack_mark): New function. (scm_bootstrap_vm)[VM_ENABLE_PRECISE_STACK_GC_SCAN]: Initialize `vm_stack_gc_kind'. 2009-08-20 Ludovic Courtès Fix bogus computation of `vm->stack_limit'. * libguile/vm.c (make_vm): Remove bogus "- 3" when computing `stack_size'. * libguile/vm-engine.h (CHECK_OVERFLOW): Change accordingly. 2009-08-20 Ludovic Courtès Simplify the creation of the SMOB GC "kind". * libguile/smob.c (smob_freelist): Remove. (scm_smob_prehistory): Adjust accordingly. Include "scmconfig.h" in . * libguile/boehm-gc.h: Use "scmconfig.h". Check for `SCM_USE_PTHREAD_THREADS', not `SCM_I_GSC_USE_PTHREAD_THREADS'. 2009-08-19 Andy Wingo procedure-documentation works on vm procedures * libguile/procs.c (scm_procedure_documentation): Add a hack so that this function works for compiled procedures too. 2009-08-19 Michael Gran Display wide strings using escapes * libguile/print.c (iprin1): for now, display wide strings as escaped strings 2009-08-19 Michael Gran Avoid double-casts of stringbuf Conversion from char to scm_t_wchar require an intermediate cast to unsigned char. By changing the return type of SCM_STRINGBUF_INLINE_CHARS to unsigned char *, doublecasts in the code can be avoided. Also, some clarification of return types. * libguile/strings.c (STRINGBUF_OUTLINE_CHARS) (STRINGBUF_INLINE_CHARS): now returns unsigned char *; all callers changed. 2009-08-19 Michael Gran Avoid compilation warnings in SCM_MAKE_CHAR * libguile/chars.h (SCM_MAKE_CHAR): change inequality 2009-08-19 Michael Gran Benchmarks for common character and string procedures * benchmark-suite/benchmarks/chars.bm: new benchmarks * benchmark-suite/benchmarks/srfi-13.bm: new benchmarks 2009-08-19 Ludovic Courtès Remove unneeded `scm_without_guile ()' call. * libguile/scmsigs.c (read_without_guile_data, do_read_without_guile, read_without_guile): Remove. (signal_delivery_thread): Use read(2) instead of `read_without_guile ()'. Reinstate missing IA64 helper functions. * libguile/threads.c (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New, formerly in `gc.c', which was removed in the BDW-GC branch. 2009-08-18 Ludovic Courtès Use `scm_gc_malloc_pointerless ()' for bytevectors. * libguile/bytevectors.c (make_bytevector): Use `scm_gc_malloc_pointerless ()' for the buffer itself. * libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_all, bop_buffer_grow): Likewise. 2009-08-18 Andy Wingo remove (ice-9 lineio)'s dependency on (ice-9 readline) * module/ice-9/lineio.scm: Use (ice-9 rdelim) instead of (ice-9 readline) to remove readline dependency. 2009-08-18 Andy Wingo `load' autocompiles * libguile/load.h: * libguile/load.c (scm_sys_warn_autocompilation_enabled): New primitive, not exported. Since `load' autocompiles now, it should warn in the same way that the bits hardcoded into C warn. (scm_try_autocompile): Use scm_sys_warn_autocompilation_enabled. * module/ice-9/boot-9.scm (autocompiled-file-name): New helper. (load): Try autocompiling the argument, if appropriate. Will autocompile files passed on Guile's command line. `primitive-load' is unaffected. 2009-08-18 Ludovic Courtès Remove unneeded SMOB mark/free procedures. * libguile/bytevectors.c (free_bytevector): Remove. (scm_bootstrap_bytevectors): Update accordingly. * libguile/r6rs-ports.c (bip_mark, cbp_mark, bop_free, bop_proc_mark): Remove. (initialize_bytevector_input_ports, initialize_custom_binary_input_ports, initialize_bytevector_output_ports, initialize_custom_binary_output_ports): Update accordingly. 2009-08-18 Ludovic Courtès Fix malloc/scm_c_take_bytevector mismatch. * libguile/bytevectors.c (STRING_TO_UTF): Use `make_bytevector ()' instead of `scm_c_take_bytevector (). (scm_string_to_utf8): Likewise. Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am libguile/Makefile.am libguile/frames.c libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc_os_dep.c libguile/load.c libguile/macros.c libguile/objcodes.c libguile/programs.c libguile/strings.c libguile/vm.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/inline.m4 2009-08-17 Ludovic Courtès Thanks, Mike. Update `NEWS' for commit d8dd381fa781c236ae777ca1ac55b73d3ca91c2a. 2009-08-15 Ludovic Courtès Bump version number for 1.9.2. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Turn off auto-compilation to stand-alone tests. * test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Add "GUILE_AUTO_COMPILE=0". 2009-08-15 Ludovic Courtès Update the manual and `NEWS' regarding `guile-2.0.pc'. * NEWS: Mention `guile-2.0.pc'. * doc/ref/autoconf.texi (Autoconf Macros): Update to `guile-2.0'. 2009-08-15 Ludovic Courtès Add proper `--help' and `--version' for `guile-tools compile'. * configure.ac: Produce `meta/guile-tools'. * meta/Makefile.am (EXTRA_DIST): Add `guile-tools.in'. (bin_SCRIPTS): Remove `guile-tools'. * meta/uninstalled-env.in (PATH): Add "${top_builddir}/meta". * module/scripts/compile.scm (%options): Add `--version'. (parse-args): Show the offending option name upon error. (show-version): New. (compile): Use `%guile-bug-report-address'. 2009-08-15 Andy Wingo update NEWS for 1.9.2 * NEWS: Update. 2009-08-15 Ludovic Courtès Update `.gitignore' for GNU Global. 2009-08-15 Ludovic Courtès Switch from `guile-1.8.pc' to `guile-2.0.pc'. * configure.ac: Produce guile-2.0*.pc. * meta/Makefile.am (EXTRA_DIST): Rename guile-1.8*.pc.in to guile-2.0*.pc.in. (pkgconfig_DATA): Update accordingly. * meta/guile-config (guile-module): Likewise. 2009-08-13 Ludovic Courtès Uncomment run-time objcode alignment check. This should now work thanks to the changes in 28b119ee3da0f4b14cb87e638794d22843778cda ("make sure all programs are 8-byte aligned"). This commit is a follow-up to ec99fe8ecb412e49e8e981246eb62ca46b32754b ("Add FIXMEs about misaligned objcode-metas."). * libguile/objcodes.c (scm_c_make_objcode_slice): Uncomment assertion that checks for proper alignment of PTR. * module/language/assembly/compile-bytecode.scm (write-bytecode): Update comment about META's alignment. 2009-08-13 Ludovic Courtès Remove deprecated semi-public memoizers. * libguile/eval.c (scm_m_expand_body, scm_macroexp, scm_unmemocar): Remove. (scm_m_undefine): Make `static'. * libguile/eval.h (scm_m_undefine, scm_m_expand_body, scm_unmemocar, scm_macroexp): Remove declarations. 2009-08-13 Ludovic Courtès Make the evaluator's memoizers private. * libguile/eval.c (macroexp): Move upwards. (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_and, scm_m_or, scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_quasiquote, scm_m_delay, scm_m_generalized_set_x, scm_m_define, scm_m_letrec, scm_m_let, scm_m_at, scm_m_atat, scm_m_apply, scm_m_cont, scm_m_nil_cond, scm_m_atfop, scm_m_atbind, scm_m_atslot_ref, scm_m_atslot_set_x, scm_m_at_call_with_values, scm_m_eval_when): New static declarations; definitions made static. (s_atslot_ref, s_atslot_set_x): New, from `goops.c'. * libguile/eval.h (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_vref, scm_m_vset, scm_m_and, scm_m_or, scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_quasiquote, scm_m_delay, scm_m_generalized_set_x, scm_m_future, scm_m_define, scm_m_letrec, scm_m_let, scm_m_at, scm_m_atat, scm_m_apply, scm_m_cont, scm_m_nil_cond, scm_m_atfop, scm_m_atbind, scm_m_atslot_ref, scm_m_atslot_set_x, scm_m_atdispatch, scm_m_at_call_with_values, scm_m_eval_when): Remove public declarations. * libguile/goops.c (s_atslot_ref, s_atslot_set_x): Remove. 2009-08-13 Ludovic Courtès compiler.test: Enforce evaluation order. * test-suite/tests/compiler.test ("psyntax")["redefinition", "compile in current module", "compile in fresh module"]: Use `begin' to enforce evaluation order. Thanks Andy! 2009-08-13 Ludovic Courtès Allow fresh modules to be passed to `compile'. * module/ice-9/boot-9.scm (module-name): When making MOD non-anonymous, bind it in the `(%app modules)' name space. * test-suite/tests/compiler.test ("psyntax")["compile in current module", "compile in fresh module"]: New tests. * test-suite/tests/modules.test ("foundations")["modules don't remain anonymous"]: New test. 2009-08-13 Ludovic Courtès Allow redefinitions in compiled code as in `(define round round)'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (chi-top)[define-form]: If a same-named imported variable exists, take its value instead of `#f'. * test-suite/tests/compiler.test ("psyntax")["redefinition"]: New tests. 2009-08-12 Andy Wingo update docs for recent vm/compiler work * doc/ref/compiler.texi: * doc/ref/vm.texi: Update for recent changes. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't print nops, they are distracting. 2009-08-12 Andy Wingo "fix" -bound lambda expressions too * module/language/tree-il/compile-glil.scm (compile-glil): Compute warnings before optimizing, as unreferenced variables will be optimized out. * libguile/_scm.h: Fix C99 comment. * module/language/tree-il/fix-letrec.scm (partition-vars): Also analyze let-bound vars. (fix-letrec!): Fix a bug whereby a set! to an unreffed var would be called for value, not effect. Also "fix" -bound lambda expressions -- really speeds up pmatch. * test-suite/tests/tree-il.test ("lexical sets", "the or hack"): Update to take into account the new optimizations. 2009-08-12 Michael Gran Don't include libunistring headers in Guile public headers This requres the creation of a new type scm_t_string_failed_conversion_handler to replace libunistring's enum iconveh_ilseq_handler. * libguile/strings.h: don't include (scm_t_string_failed_conversion_handler): new enum type (SCM_FAILED_CONVERSION_ERROR, SCM_FAILED_CONVERSION_QUESTION_MARK): (SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE): new enum type values * libguile/strings.c (scm_to_stringn): now takes type scm_t_string_failed_conversion_handler. All callers changed. * libguile/print.c: include * libguile/ports.c (scm_lfwrite_substr): use scm_t_string_conversion_handler's constants * libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR): (SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store iconveh_ilseq_hander constants as #define's 2009-08-12 Michael Gran Regression, scm_string fails to test for circular lists * libguile/string.c (scm_string): Restores the functionality where scm_string tests for circular lists * test-suite/tests/strings.test: add test for circular lists 2009-08-12 Michael Gran Some signed/unsigned comparison and conversions * libguile/ports.c (scm_lfwrite_str, scm_lfwrite_substr): signed/unsigned conversion and comparison * libguile/strings.c (scm_string_append): signed/unsigned comparison 2009-08-12 Andy Wingo rework the vm support for wide strings * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-engine.c (vm_error_bad_wide_string_length): New error case. * libguile/vm-i-loader.c (load-unsigned-integer, load-integer) (load-keyword): Remove these instructions. The former two are obsoleted by make-int64/make-uint64, the latter via make-keyword. (load-string): Only handle narrow strings. (load-symbol): Only handle narrow symbols. The wide case is handled via make-symbol. (load-wide-string): New instruction, for wide strings. * libguile/vm-i-system.c (define): Move here from loaders.c, as now it just takes a sym on the stack. (make-keyword, make-symbol): New instructions. * module/language/assembly.scm: Remove removed instructions. No more width byte in load-string etc. * module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt to change in instruction set. * module/language/glil/compile-assembly.scm (glil->assembly): Compile define by pushing the sym then emitting (define). (dump-object): Dump narrow and wide strings differently. Use make-keyword and make-symbol as appropriate. * module/language/tree-il/compile-glil.scm (flatten): When compiling a ref to a primitive (not a call), first see if the primitive is actually bound in the root module. (That's not the case with e.g. bytevector-u8-ref). * module/system/xref.scm (program-callee-rev-vars): Don't parse out "nexts". * test-suite/tests/asm-to-bytecode.test ("compiler"): Adapt to bytecode format change. 2009-08-12 Michael Gran Fix disassembly of strings and symbols * module/language/assembly/decompile-bytecode.scm (decode-bytecode): fix disassembly of strings, symbols, keywords, and defines 2009-08-12 Michael Gran Quiet signed/unsigned comparison warnings in chars.[ch] * libguile/chars.h (SCM_MAKE_CHAR): quiet signed/unsigned comparison warnings * libguile/chars.c (scm_i_charname): (scm_i_charname_to_char): quiet signed/unsigned comparison warnings 2009-08-12 Michael Gran Avoid unitialized and unused warnings in scm_string_append * libguile/strings.c (scm_string_append): avoid warnings 2009-08-12 Michael Gran Revert to locale-dependent toupper and tolower To avoid leaving Guile in a broken state, the conversion from locale-dependent case modification to Unicode case modification should be an atomic commit * libguile/chars.c (scm_c_upcase): revert to locale-dependent toupper and tolower 2009-08-12 Michael Gran Only pass ints to tolower and toupper * libguile/strings.c (unistring_escapes_to_guile_escapes): cast tolower's parameter to int * libguile/read.c (CHAR_DOWNCASE): cast tolower's parameter to int 2009-08-12 Andy Wingo debitrot the ecmascript compiler * module/Makefile.am (ECMASCRIPT_LANG_SOURCES): * module/language/ecmascript/compile-ghil.scm: * module/language/ecmascript/compile-tree-il.scm: SOURCES): Replace the GHIL compiler with a ->tree-il compiler. Not fully functional, but the basics work. * module/language/ecmascript/spec.scm: Only include the tree-il compiler. * module/language/ecmascript/tokenize.scm (read-punctuation): Avoid mutating a constant. 2009-08-11 Andy Wingo make the fallback path look less like line noise * libguile/_scm.h: * libguile/load.c: Rework to only include the relevant pieces in the fallback path. 2009-08-11 Andy Wingo include objcode cookie in the fallback path * libguile/_scm.h (SCM_OBJCODE_COOKIE): Move the objcode cookie define here, so that load.c can use it. This is a private header. * libguile/load.c (FALLBACK_DIR): Include the objcode cookie in the fallback path. Should fix problems when objcode changes incompatibly during the 1.9 series. * libguile/objcodes.c: Adapt to SCM_OBJCODE_COOKIE move. This should fix http://article.gmane.org/gmane.lisp.guile.devel/9059. 2009-08-11 Michael Gran More string and symbol tests * test-suite/tests/strings.test: more tests * test-suite/tests/symbols.test: more tests 2009-08-11 Michael Gran Fix %string-dump and %symbol-dump fields * libguile/strings.c (scm_sys_string_dump): don't print stringbuf. Print read-only status. (scm_sys_symbol_dump): don't print stringbuf. Print interned status. 2009-08-10 Ludovic Courtès Change `defined?' to accept a module as its second argument. Reported by Daniel Kraft . * doc/ref/api-binding.texi (Binding Reflection): Update documentation of `defined?'. * libguile/evalext.c (scm_defined_p): Expect a module as the second argument, not a lexical environment. 2009-08-10 Michael Gran Make scm_charprint and scm_i_string_wide_chars SCM_INTERNAL. Also, scm_charprint is renamed to scm_i_charprint. * libguile/strings.h: make scm_i_string_wide_chars internal. * libguile/print.h: rename scm_charprint to scm_i_charprint. Make internal. * libguile/print.c (scm_i_charprint): renamed from scm_charprint (scm_charprint): renamed to scm_i_charprint. All callers changed. 2009-08-10 Michael Gran Improve %string-dump and %symbol-dump %string-dump and %symbol-dump are modified to return assocation lists of string and symbol attributes instead of printing to stderr. They are no longer conditional on SCM_DEBUG. * libguile/strings.c (scm_sys_string_dump) (scm_sys_symbol_dump): now returns alist of properties. No longer require that SCM_DEBUG be defined. (scm_sys_stringbuf_hist): now conditional on SCM_STRING_LENGTH_HISTOGRAM * libguile/strings.h: scm_sys_string_dump and scm_sys_symbol dump are now declared as API 2009-08-10 Michael Gran More comments for string functions * libguile/strings.c: comments Missing parentheses in SCM_MAKE_CHAR macro * libguile/chars.h (SCM_MAKE_CHAR): missing parentheses 2009-08-10 Michael Gran Port position macros shouldn't require enclosing braces The port position macros incorrectly required enclosing braces when used within if statements. * libguile/ports.h (SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL) (SCM_DECCOL, SCM_TABCOL): enclose macro in do/while * libguile/ports.c (update_port_lf): remove extra braces 2009-08-09 Ludovic Courtès Use a linker version script for libguile. * libguile/Makefile.am (libguile_la_LDFLAGS)[HAVE_LD_VERSION_SCRIPT]: Use `libguile.map'. (EXTRA_DIST): Add `libguile.map'. * libguile/libguile.map: New file. 2009-08-09 Ludovic Courtès Use Gnulib's `lib-symbol-versions' module. * m4/gnulib-cache.m4: Add `lib-symbol-versions'. Remove bogus `configure' test for GNU libunistring. * configure.ac: Remove explicit test for libunistring, which conflicted with Gnulib's own test. This fixes commit f4863880f5ef539cb545999c19b6b5c0eec9382d. 2009-08-09 Neil Jerram Misc GOOPS chapter updates * doc/ref/goops-tutorial.texi: Update intro text. Fix `an' typo. * doc/ref/goops.texi: Update quick start intro text. Simplify example that uses `format'. 2009-08-09 Neil Jerram Use #:keyword syntax in preference to :keyword because that is Guile's default. 2009-08-09 Neil Jerram In general, use @lisp in preference to @smalllisp because it looks better in the DVI output. Exceptions are - wide examples, which would cause overfull hboxes if they used the bigger @lisp font - very large examples, which may look too big at the @lisp size. 2009-08-09 Neil Jerram Use @result{} instead of --> * doc/ref/goops.texi: Use @result{} instead of -->. Update GOOPS Getting Started section * doc/ref/goops.texi (Getting Started): Renamed `Quick Start', to fit better with following Tutorial. Also add a bit more text to the Methods subsection. 2009-08-08 Neil Jerram Minor textual improvements to slot sections Move tutorial sections on slots before inheritance * doc/ref/goops-tutorial.texi (Instance creation and slot access, Slot description): Move to before Inheritance. Change to in GOOPS tutorial * doc/ref/goops-tutorial.texi (Class Definition): Minor text improvements. Change the class being defined to , to reduce the confusion with the built in class. 2009-08-08 Neil Jerram Start updating/merging GOOPS getting started / tutorial text * doc/ref/goops-tutorial.texi (Introduction): Merge this subsection's non-duplicate text into the introductory text of the whole section, then remove this subsection. (Tutorial): Textual updates to introductory text. (Class definition and instantiation): Rename `Class definition', since that's all it covers. Remove unnecessary footnote about loading (oop goops) module. (All @nodes): Remove explicit up, next and prev nodes. (They make the document harder to change.) * doc/ref/goops.texi (Tutorial): Move from the end of the GOOPS chapter to the beginning of it. (Running GOOPS): Removed; useful text merged into containing section. 2009-08-08 Neil Jerram Remove page break after heading of Chapter 6 (Modules) This brings this chapter into line with the others, which do not have page breaks before the first section. Use GOOPS Introduction as intorudctory text for the whole GOOPS chapter 2009-08-08 Michael Gran Merge commit 'origin/master' 2009-08-08 Michael Gran Add Unicode strings and symbols This adds full Unicode strings as a datatype, and it adds some minimal functionality. The terminal and port encoding is assumed to be ISO-8859-1. Non-ISO-8859-1 characters are written or input as string character escapes. The string character escapes now have 3 forms: \xXX \uXXXX and \UXXXXXX, for unprintable characters that have 2, 4 or 6 hex digits. The process for writing to strings has been modified. There is now a function scm_i_string_start_writing that does the copy-on-write conversion if necessary. To compile strings that may be wide, the VM storage of strings and string-likes has changed. Most string-using functions have not yet been updated and may break when used with wide strings. * module/language/assembly/compile-bytecode.scm (write-bytecode): use variable width string bytecode format * module/language/assembly.scm (byte-length): use variable width bytecode format * libguile/vm-i-loader.c (load-string, load-symbol): (load-keyword, define): use variable-width bytecode format * libguile/vm-engine.h (FETCH_WIDTH): new macro * libguile/strings.h: new declarations * libguile/strings.c (make_wide_stringbuf): new function (widen_stringbuf): new function (scm_i_make_wide_string): new function (scm_i_is_narrow_string): new function (scm_i_string_wide_chars): new function (scm_i_string_start_writing): new function (scm_i_string_ref): new function (scm_i_string_set_x): new function (scm_i_is_narrow_symbol): new function (scm_i_symbol_wide_chars, scm_i_symbol_ref): new function (scm_string_width): new function (unistring_escapes_to_guile_escapes): new function (scm_to_stringn): new function (scm_i_stringbuf_free): modify for wide strings (scm_i_substring_copy): modify for wide strings (scm_i_string_chars, scm_string_append): modify for wide strings (scm_i_make_symbol, scm_to_locale_stringn): modify for wide strings (scm_string_dump, scm_symbol_dump, scm_to_locale_stringbuf): (scm_string, scm_i_deprecated_string_chars): modify for wide strings (scm_from_locale_string, scm_from_locale_stringn): add null test * libguile/srfi-13.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing (scm_string_for_each): modify for wide strings * libguile/socket.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/rw.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/read.c (scm_read_string): allow reading of wide strings * libguile/print.h: add declaration for scm_charprint * libguile/print.c (iprin1): print wide strings and add new string escapes (scm_charprint): new function * libguile/ports.h: new declarations for scm_lfwrite_substr and scm_lfwrite_str * libguile/ports.c (update_port_lf): new function (scm_lfwrite): use update_port_lf (scm_lfwrite_substr): new function (scm_lfwrite_str): new function * test-suite/tests/asm-to-bytecode.test ("compiler"): add string width byte to sting-like asm tests 2009-08-07 Andy Wingo lambda, the ultimate goto * module/language/tree-il/analyze.scm (analyze-lexicals): Rework to actually determine when a fixed-point procedure may be allocated as a label. * module/language/tree-il/compile-glil.scm (emit-bindings): Always emit a . Otherwise it's too hard to pair with unbindings. (flatten-lambda): Consequently, here we only `bind' if there are any vars to bind. This doesn't make any difference, given that lambdas don't have trailing unbind instructions, but it does keep the GLIL output the same for thunks -- no extraneous (bind) instructions. Keeps tree-il.test happy. (flatten): Some bugfixes. Yaaay, it works!!! implement compilation of label-allocated lambda expressions * module/language/tree-il/compile-glil.scm (flatten-lambda, flatten): Implement compilation of label-allocated lambda expressions. Quite tricky, we'll see if this works when the new analyzer lands. 2009-08-07 Andy Wingo add label alist to lambda allocations in tree-il->glil compiler * module/language/tree-il/analyze.scm: Add some more comments about something that will land in a future commit: compiling fixpoint lambdas as labels. (analyze-lexicals): Reorder a bit, and add a label alist to procedure allocations. Empty for now. * module/language/tree-il/compile-glil.scm (flatten): Adapt to the free variables being in the cddr of the allocation, not the cdr. 2009-08-06 Andy Wingo loop detection in the house * libguile/vm-i-scheme.c (vector-ref, vector-set): Sync registers if we call out to C. * module/language/tree-il/compile-glil.scm (flatten-lambda): Add an extra argument, the self-label, which should be the gensym under which the procedure is bound in a expression. (flatten): If we see a call to a lexical ref to the self-label in a tail position, rename and goto instead of goto/args, which will tear down the frame -- or will, in the future. It's a primitive form of loop detection. * module/language/tree-il/primitives.scm (zero?): Expand to (= x 0). 2009-08-06 Andy Wingo actually implement "fixing letrec" * module/Makefile.am (SOURCES): Reorganize so GHIL is compiled last, along with ecmascript. * module/language/scheme/spec.scm: Remove references to GHIL, as it's bitrotten and obsolete.. * module/language/tree-il.scm (make-tree-il-folder): Rework so that we only have down and up procs, and call down and up on each element. * module/language/tree-il/analyze.scm (analyze-lexicals): Fix a thinko handling let-values. * module/language/tree-il/fix-letrec.scm: Actually implement fixing letrec. The resulting code will perform better, but violations of the letrec restriction are not detected. This behavior is allowed by the spec, but it is undesirable. Perhaps that will be fixed later. * module/language/tree-il/inline.scm (inline!): Fix a case in which ((lambda args foo)) would be erroneously inlined to foo. Remove empty let, letrec, and fix statements. * module/language/tree-il/primitives.scm (effect-free-primitive?): New public predicate. 2009-08-06 Andy Wingo actually inline call-with-values to tree-il's * module/srfi/srfi-11.scm (let-values): In the one-clause case, avoid going through temporary variables. * module/language/tree-il/inline.scm (inline!): Add another case: (call-with-values (lambda () ...) (lambda ... ...) -> let-values. * module/language/tree-il/compile-glil.scm (flatten): Fix a bug compiling applications in "vals" context. * module/language/tree-il/analyze.scm (analyze-lexicals): Fix a couple bugs with let-values and rest arguments. 2009-08-06 Neil Jerram Include GOOPS pictures in the distribution 2009-08-05 Andy Wingo let-values in terms of syntax-case, add make-tree-il-folder * module/language/tree-il.scm (tree-il-fold): Fix for let-values case. (make-tree-il-folder): New public macro, makes a multi-valued folder specific to the number of seeds that the user wants. * module/language/tree-il/optimize.scm (optimize!): Reverse the order of inline! and fix-letrec!, as the latter might expose opportunities for the former. * module/srfi/srfi-11.scm (let-values): Reimplement in terms of syntax-case, so that its expressions may reference hygienically bound variables. See the NEWS for the rationale. (let*-values): An empty let*-values still introduces a local `let' binding contour. * module/system/base/syntax.scm (record-case): Yukkkk. Reimplement in terms of syntax-case. Ug-ly, but see the NEWS again: "Lexical bindings introduced by hygienic macros may not be referenced by nonhygienic macros." 2009-08-05 Andy Wingo add tree-il construct, and compile it * libguile/vm-i-system.c (fix-closure): New instruction, for wiring together fixpoint procedures. * module/Makefile.am (TREE_IL_LANG_SOURCES): Add fix-letrec.scm. * module/language/glil/compile-assembly.scm (glil->assembly): Reindent the case, and handle 'fix for locally-bound vars. * module/language/tree-il.scm (): Add the tree-il type and accessors, for fixed-point bindings. This IL construct is taken from the Waddell paper. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold) (pre-order!, post-order!): Update for . * module/language/tree-il/analyze.scm (analyze-lexicals): Update for . The difference here is that the bindings may not be assigned, and are not marked as such. They are not boxed. (report-unused-variables): Update for . * module/language/tree-il/compile-glil.scm (flatten): Compile to GLIL. * module/language/tree-il/fix-letrec.scm: A stub implementation of fixing letrec -- will flesh out in a separate commit. * module/language/tree-il/inline.scm: Fix license, it was mistakenly added with LGPL v2.1+. * module/language/tree-il/optimize.scm (optimize!): Run the fix-letrec! pass. 2009-08-05 Andy Wingo add a brain-dead inliner * module/Makefile.am (TREE_IL_LANG_SOURCES): * module/language/tree-il/inline.scm: Add a brain-dead inliner, to inline ((lambda () x)) => x. * module/language/tree-il/optimize.scm (optimize!): Invoke the inliner. 2009-08-05 Andy Wingo add1 and sub1 instructions * libguile/vm-i-scheme.c: Add add1 and sub1 instructions. * module/language/tree-il/compile-glil.scm: Compile 1+ and 1- to add1 and sub1. * module/language/tree-il/primitives.scm (define-primitive-expander): Add support for `if' statements in the consequent. (+, -): Compile (- x 1), (+ x 1), and (+ 1 x) to 1- or 1+ as appropriate. (1-): Remove this one. Seems we forgot 1+ before, but we weren't compiling it nicely anyway. * test-suite/tests/tree-il.test ("void"): Fix expected compilation of (+ (void) 1) to allow for add1. 2009-08-04 Andy Wingo perform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGS * configure.ac: Rework gmp and unistring checks to use AC_LIB_HAVE_LINKFLAGS, so that the compilation checks run with the right -L/-l flags. * libguile/Makefile.am (libguile_la_LIBADD): Adapt to need to add $(LIBGMP) and $(LIBUNISTRING) here. Hopefully this solves http://article.gmane.org/gmane.lisp.guile.bugs/4288. 2009-08-04 Andy Wingo rename configure.in to configure.ac * configure.ac: * guile-readline/configure.ac: Rename from configure.in, as recommended by the autoconf manual. 2009-08-04 Andy Wingo fix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+ * libguile/numbers.c (mem2decimal_from_point, mem2ureal, mem2complex): Fix a number of cases where, for invalid numbers, we could read past the end of the buffer. This happened in e.g. "1.0+", "1/" and "1.0f". But I couldn't figure out how to test for these, given that the behavior depended on the contents of uninitialized memory in the reader buffer. We'll just have to be happy with this. Thanks to Kjetil S. Matheussen for the report. 2009-08-04 Neil Jerram Git-Ignore effective-version.texi Fix overfull hboxes Typos Add an effective version variable for the manual Add copyright statements to goops.texi and goops-tutorial.texi 2009-08-04 Daniel Kraft Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp Abstracted dynamic binding a little off the fluids. * module/language/elisp/compile-tree-il.scm: Move dynamic binding to one place and changed names that refer to `fluids' for dynamic binding. * module/language/elisp/bindings.scm: Changed names referring to `fluids'. 2009-08-04 Neil Jerram Move GOOPS documentation into the main manual Nothing editorial here, just the minimum to move the GOOPS documentation into the main manual, and then still have everything build properly. 2009-08-03 Daniel Kraft Implement catch and unwind-protect as macros. * module/language/elisp/compile-tree-il.scm: Remove catch and unwind-protect. * module/language/elisp/runtime/macro-slot.scm: Re-implement them here. 2009-08-03 Neil Jerram Move `Continuation Barriers' to the section that covers continuations Since continuation barriers protect against non-local exits, it makes better sense to document them in the same section as continuations and exceptions. Review/update sections on arbiters and asyncs Miscellaneous small updates - Typos - Minor changes to texinfo markup - Minor wording changes Remove the idea of a separate manual edition number I don't believe this has ever been useful, and I doubt that we've consistently incremented it in the past. The reality is that the manual evolves with the rest of Guile, so Guile's version number should apply to the manual too. It is conceivable that we might one day revise the manual for an existing Guile release, so we keep a REVISION number to cover that. 2009-08-01 Michael Gran Don't doubly define scm_t_wchar * libguile/chars.h: don't define scm_t_wchar * libguile/numbers.h: define scm_t_wchar here 2009-08-01 Michael Gran Fix coding style compliance for recent 32-bit char changes * libguile/print.c (iprin1): extra braces * libguile/chars.h (SCM_IS_UNICODE_CHAR): coding style 2009-08-01 Michael Gran Don't use GNU extensions for SCM_MAKE_CHAR macro Since the contents of SCM_MAKE_CHAR are evaluated more than once, don't use it in situations where this could cause side-effects. * libguile/vm-i-system.c (make-char8): avoid side-effects with SCM_MAKE_CHAR call * libguile/chars.h (SCM_MAKE_CHAR): modified 2009-08-01 Michael Gran Make charname declarations module-level and GCS Charname array declarations are corrected for style and are made module-level. Array list length variables are replaced with macros. * libguile/chars.c: variable declaration fixes 2009-08-01 Michael Gran Update NEWS for charname changes * NEWS: updated 2009-08-01 Daniel Kraft Allow lexical binding of lambda arguments. * module/language/elisp/compile-tree-il.scm: Rework lambda compiler to allow opional lexical binding of (some) lambda arguments. * test-suite/tests/elisp-compiler.test: Check this. 2009-07-31 Daniel Kraft Compiler option to always bind certain symbols lexically. Affects so far let-bound symbols, lambda arguments to come in the future. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Add :always-lexical option. * test-suite/tests/elisp-compiler.test: Test it. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-31 Ludovic Courtès Add unused variable analysis in the tree-il->glil compiler. * module/language/tree-il/analyze.scm (): New record type. (report-unused-variables): New procedure. * module/language/tree-il/compile-glil.scm (%warning-passes): New variable. (compile-glil): Honor `#:warnings' from OPTS. * test-suite/tests/tree-il.test (call-with-warnings): New procedure. (%opts-w-unused): New variable. ("warnings"): New test prefix. 2009-07-31 Ludovic Courtès Add `(system base message)', a simple warning framework. * module/Makefile.am (SOURCES): Add `system/base/message.scm'. * module/scripts/compile.scm (%options): Add `--warn'. (parse-args): Update default value for `warnings'. (show-warning-help): New procedure. (compile)[compile-opts]: Add `#:warnings'. Update help message. * module/system/base/compile.scm (compile): Sanity-check the requested warnings. * module/system/base/message.scm: New file. 2009-07-31 Ludovic Courtès Add `tree-il-fold', a purely functional iterator on `tree-il'. * module/language/tree-il.scm (tree-il-fold): New procedure. * test-suite/tests/tree-il.test ("tree-il-fold"): New test prefix. 2009-07-30 Daniel Kraft Use explicit guile-primitive forms in the macro expansion of dotimes and dolist. Implement some elisp constructs in macros instead of hard-coded compiler code. * module/language/elisp/compile-tree-il.scm: Remove implementation of prog1, and, or, cond, dolist. * module/language/elisp/runtime/macro-slot.scm: Implement them here instead. Switch use of guile-primitive to now available funcall in test. without-void-checks as new extension for fine-control * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Handle without-void-checks. * test-suite/tests/elisp-compiler.test: Test it. 2009-07-29 Daniel Kraft funcall, apply and eval built-ins. * module/language/elisp/README: Document new features. * module/language/elisp/runtime/function-slot.scm: Implement funcall, apply and eval by using the existing compiler code. * test-suite/tests/elisp-compiler.test: Test those. 2009-07-29 Michael Gran Add 32-bit characters This adds the 32-bit standalone characters. Strings are still 8-bit. Characters larger than 8-bit can only be entered or displayed in octal format at this point. At this point, the terminal's display encoding is expected to be Latin-1. * module/language/assembly/compile-bytecode.scm (write-bytecode): add 32-bit char * module/language/assembly.scm (object->assembly): add 32-bit char (assembly->object): add 32-bit char * libguile/vm-i-system.c (make-char32): new op * libguile/print.c (iprin1): print 32-bit char * libguile/numbers.h: add type scm_t_wchar * libguile/numbers.c: add type scm_t_wchar * libguile/chars.h: new type scm_t_wchar (SCM_CODEPOINT_MAX): new (SCM_IS_UNICODE_CHAR): new (SCM_MAKE_CHAR): operate on 32-bit char * libguile/chars.c: comparison operators now use Unicode codepoints (scm_c_upcase): now receives and returns scm_t_wchar (scm_c_downcase): now receives and returns scm_t_wchar 2009-07-29 Daniel Kraft Added guile-primitive construct for references to primitives from Elisp. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement guile-primitive. * test-suite/tests/elisp-compiler.test: Switched a usage of guile-ref to the now available guile-primitive. Added length built-in. * module/language/elisp/runtime/function-slot.scm: Add length built-in. * test-suite/tests/elisp-compiler.test: Test length. Implemented lexical-let and lexical-let* for elisp. * module/language/elisp/README: Document it. * module/language/elisp/bindings.scm: New fields in bindings data structure to keep track of lexical bindings for symbols. * module/language/elisp/compile-tree-il.scm: Implement lexical-let(*). * test-suite/tests/elisp-compiler.test: Test lexical scoping with lexical-let. 2009-07-28 Michael Gran Replace global charnames variables with accessors The global variables scm_charnames and scm_charnums are replaced with the accessor functions scm_i_charname and scm_i_charname_to_num. Also, the incomplete and broken EBCDIC support is removed. * libguile/print.c (iprin1): use new func scm_i_charname * libguile/read.c (scm_read_character): use new func scm_i_charname_to_num * libguile/chars.c (scm_i_charname): new function (scm_i_charname_to_char): new function (scm_charnames, scm_charnums): removed * libguile/chars.h: new declarations 2009-07-27 Daniel Kraft In elisp-compiler.test, check that let* works without values given, too. 2009-07-26 Andy Wingo increase range of relative jumps by aligning blocks to 8-byte boundaries * libguile/objcodes.c (OBJCODE_COOKIE): Bump again, as our jump offsets are now multiplied by 8. * libguile/vm-i-system.c (BR): Interpret the 16-bit offset as a relative jump to the nearest 8-byte-aligned block -- increasing relative jump range from +/-32K to +/-240K. (mvra): Do the same for the mvra jump. * libguile/vm.c (really_make_boot_program): Align the mvra. * module/language/assembly.scm (align-block): New export, for aligning blocks. * module/language/assembly/compile-bytecode.scm (write-bytecode): Emit jumps to the nearest 8-byte-aligned block. Effectively our range is 18 bits in either direction. I would like to do this differently -- have long-br and long-br-if, and all the other br instructions go to 8 bits only. But the assembler doesn't have an appropriate representation to allow me to do this yet, so for now this is what we have. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decode the 19-bit jumps. 2009-07-26 Andy Wingo make sure all programs are 8-byte aligned * libguile/objcodes.c (OBJCODE_COOKIE): Bump objcode cookie, as we added to struct scm_objcode. * libguile/objcodes.h (struct scm_objcode): Add a uint32 after metalen and before base, so that if the structure has 8-byte alignment, base will have 8-byte alignment too. (Before, base was 12 bytes from the start of the structure, now it's 16 bytes.) * libguile/vm-engine.h (ASSERT_ALIGNED_PROCEDURE): Add a check that can be turned on with VM_ENABLE_PARANOID_ASSERTIONS. (CACHE_PROGRAM): Call ASSERT_ALIGNED_PROCEDURE. * libguile/vm-i-system.c (long-local-ref): Add a missing semicolon. * libguile/vm.c (really_make_boot_program): Rework to operate directly on a malloc'd buffer, so that the program will be 8-byte aligned. * module/language/assembly.scm (*program-header-len*): Add another 4 for the padding. (object->assembly): Fix case in which we would return (make-int8 0) instead of (make-int8:0). This would throw off compile-assembly.scm's use of addr+. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out the padding int. * module/language/assembly/decompile-bytecode.scm (decode-load-program): And pop off the padding int too. * module/language/glil/compile-assembly.scm (glil->assembly): Don't pack the assembly, assume that assembly.scm has done it for us. If a program has a meta, pad out the program so that meta will be aligned. * test-suite/tests/asm-to-bytecode.test: Adapt to expect programs to have the extra 4-byte padding int. 2009-07-26 Andy Wingo fix alignment of subprograms of subprograms * module/language/glil/compile-assembly.scm (glil->assembly) (dump-object): Fix an exciting bug! Subprograms of subprograms were not being aligned correctly, because the code was generated too early. So instead delay dumping the object table until the proper time. fix unused SCM_FRAME_SET_DYNAMIC_LINK macro * libguile/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): Fix for new stack layout, though this macro is not used. fix vmstack gdb macro for new stack frame layout * gdbinit (vmstack): No more external link. 2009-07-24 Andy Wingo check that jumps are within the range of a signed 16-bit int * module/language/assembly/compile-bytecode.scm (write-bytecode): Check that the offset is within the range of a signed int16 value. fix gensym creation in psyntax * module/ice-9/psyntax.scm (build-lexical-var): Make our gensyms really unique. Before, there was a chance that different lexicals could result in the same gensym. * module/ice-9/psyntax-pp.scm: Regenerate. increase default stack size to 64 kilowords * libguile/vm.c (VM_DEFAULT_STACK_SIZE): Increase to 64 kilowords. Really, we should simply add overflow handlers, but in the meantime, this will do. 2009-07-24 Daniel Kraft Compiler option to disable void-checks in elisp. * module/language/elisp/README: Document the change. * module/language/elisp/compile-tree-il.scm: Add disable-void-check option. * test-suite/tests/elisp-compiler.test: Test it. 2009-07-24 Andy Wingo compiler support for nlocs >= 256 * libguile/vm-i-system.c (long-local-ref, long-local-set) (make-variable): New intructions, for handling nlocs >= 256. * module/language/glil/compile-assembly.scm (glil->assembly): Compile with support for nlocs >= 256. 2009-07-24 Daniel Kraft Don't pass the bindings-data all around in compile-tree-il, but use fluids for this dynamic binding. * module/language/elisp/compile-tree-il.scm: Use fluid for bindings-data. 2009-07-24 Andy Wingo nlocs is now 16 bits wide * libguile/objcodes.h (struct scm_objcode): Remove the "unused" field -- the old "nexts" -- and expand nlocs to 16 bits. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write the nlocs as a uint16. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decompile 16-bit nlocs. It seems this decompilation is little-endian :-/ * test-suite/tests/asm-to-bytecode.test: Fix up to understand nlocs as a little-endian value. The test does the right thing regarding endianness. 2009-07-24 Daniel Kraft Implemented the flet and flet* extensions. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement flet and flet*. * test-suite/tests/elisp-compiler.test: Test flet and flet*. 2009-07-23 Andy Wingo remove all mentions of "external" from the compiler and related code With this, GHIL is effectively bitrotten. I need to port the ECMAScript compiler to tree-il, then I'll remove it. * module/language/assembly.scm (byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): (disassemble-free-vars, code-annotation): * module/language/glil.scm (, ) (, parse-glil, unparse-glil): * module/language/glil/compile-assembly.scm (make-meta): (compile-assembly, glil->assembly): * module/language/glil/decompile-assembly.scm (decompile-toplevel): (decompile-load-program): * module/language/objcode/spec.scm (decompile-value): * module/language/tree-il/compile-glil.scm (flatten-lambda): * module/system/vm/frame.scm (frame-binding-ref): (frame-binding-set!): * module/system/vm/program.scm (binding:boxed?): * module/system/vm/trace.scm (trace-next): * test-suite/tests/asm-to-bytecode.test ("compiler"): * test-suite/tests/tree-il.test: Remove all mentions of "external", and of . Docs updates will come soon. 2009-07-23 Andy Wingo rename "closure-ref" to "free-ref"; s/vars/variables/ in some names * libguile/programs.h: * libguile/programs.c: (SCM_PROGRAM_FREE_VARIABLES): Rename from SCM_PROGRAM_FREE_VARS. Callers changed. * libguile/programs.c (scm_make_program): Rename arg to "free_variables". (scm_program_free_variables): Rename from program-free-vars. * libguile/vm-engine.h: * libguile/vm-engine.c (VM_CHECK_FREE_VARIABLES): Rename from VM_CHECK_CLOSURE. (vm_engine, CACHE_PROGRAM): Rename closure and closure_count to free_vars and free_vars_vount. * libguile/vm-i-system.c (FREE_VARIABLE_REF): Rename from CLOSURE_REF. (free-ref, free-boxed-ref, free-boxed-set): Rename from closure-ref, closure-boxed-ref, closure-boxed-set. (make-closure): Renamed from make-closure2. * module/language/glil/compile-assembly.scm (glil->assembly): Hack to never write out the the old "make-closure" instruction. Will fix better later. Change to emit free-ref etc instead of closure-ref. * module/language/tree-il/compile-glil.scm (flatten): Emit make-closure instead of make-closure2, now that the old make-closure is gone. * module/system/vm/program.scm (system): Rename program-free-vars to program-free-variables. * test-suite/tests/tree-il.test ("lambda"): Update for make-closure. 2009-07-23 Andy Wingo remove "externals" from the vm * libguile/frames.c (scm_frame_external_link): Removed. * libguile/frames.h: No need to have the "external link" in the stack frame -- update macros to take the new situation into account. * libguile/objcodes.h (struct scm_objcode): Rename the nexts field to "unused". In the future we can use it for nlocs, I think. (SCM_OBJCODE_NEXTS): removed. * libguile/programs.h: * libguile/programs.c (scm_make_program): Expect the third argument to be a vector of free variables, not a list of free variables. SCM_BOOL_F indicates no free variables, not SCM_EOL. (program_mark): Adapt. (scm_program_arity): No more nexts. (scm_program_free_vars): Replaces scm_program_externals. * libguile/vm-engine.c (VM_CHECK_EXTERNAL) (vm_engine): No need for the "external" var. * libguile/vm-engine.h (CACHE_PROGRAM): Update for SCM_PROGRAM_FREE_VARS instead of SCM_PROGRAM_EXTERNALS. (NEW_FRAME): Update for new frame size, and no need to cons up externals. Yay :) * libguile/vm-i-loader.c (load-program): Update for scm_make_program. * libguile/vm-i-system.c (external-ref, external-set): No more. (make-closure): No more. (goto/args): No need to re-cons externals here. Update for new stack frame size. (mv-call, return, return/values): Update for new frame size. No need to reinstate externals on return. * libguile/vm.c (really_make_boot_program, scm_load_compiled_with_vm): Update for scm_make_program. * module/language/objcode/spec.scm (objcode-env-externals): Treat '() as #f, for the externals. Need to clean this up later... * module/system/vm/program.scm (arity:nexts): Remove. Rename program-external to program-free-vars. 2009-07-23 Andy Wingo compile lexical variable access and closure creation to the new ops * module/language/glil.scm (): New GLIL type, , which will subsume other lexical types. * module/language/glil/compile-assembly.scm: Compile . (make-open-binding): Change the interpretation of the second argument -- instead of indicating an "external" var, it now indicates a boxed var. (open-binding): Adapt to new glil-bind format. * module/language/tree-il/analyze.scm: Add a lot more docs. (analyze-lexicals): Change the allocation algorithm and output format to allow the tree-il->glil compiler to capture free variables appropriately and to reference bound variables in boxes if necessary. Amply documented. * module/language/tree-il/compile-glil.scm (compile-glil): Compile lexical variable access to . Emit variable capture and closure creation code here, instead of leaving that task to the GLIL->assembly compiler. * test-suite/tests/tree-il.test: Update expected code emission. 2009-07-23 Daniel Kraft Implemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...) * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function. * module/language/elisp/runtime.scm: Runtime functions to support dynamic value access. * module/language/elisp/runtime/function-slot.scm: Defined the built-ins. * test-suite/tests/elisp-compiler.test: Test them. 2009-07-22 Daniel Kraft Added guile-ref extension construct, change throw implementation to easier one using a built-in function and implement unwind-protect. * module/language/elisp/README: Document the changes. * module/language/elisp/compile-tree-il.scm: Implement unwind-protect. * module/language/elisp/runtime/function-slot.scm: throw as built-in. * test-suite/tests/elisp-compiler.test: Test unwind-protect. Implemented catch and throw in elisp. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement catch and throw. * test-suite/tests/elisp-compiler.test: Test catch/throw. 2009-07-22 Andy Wingo vm support for display closures * libguile/vm-i-system.c (box, empty-box): Boxing values and storing them in local variables. (local-boxed-ref, local-boxed-set): A combination of local-ref then variable-ref/set. (make-closure2, closure-ref, closure-boxed-ref, closure-boxed-set): New ops. The idea is to migrate Guile over to using flat dispay closures. See the paper "Three Implementation Models for Scheme" by Kent Dybvig for more details; this is the "stack-based" model. * libguile/vm-engine.c: * libguile/vm-engine.h: Add the necessary infrastructure to keep track of a "closure" variable, like our "externals" in semantics, but minimal, flat, and O(1) in implementation. 2009-07-21 Andy Wingo renumber vm ops (objcode cookie bumped) * libguile/objcodes.c (OBJCODE_COOKIE): Bump. * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Renumber instructions, so I can have a bit more space to work. 2009-07-21 Daniel Kraft Don't ensure fluids all over the place but scan for variables needed and ensure just before the compiled code all those. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement it here, pass bindings all around the compilation. * module/language/elisp/bindings.scm: New module with symbol-tracking abilities needed for this. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-20 Daniel Kraft Implemented prog1, prog2, dotimes, dolist control structures. * module/language/elisp/README: Document it and some further ideas written down. * module/language/elisp/compile-tree-il.scm: Implement prog1, dolist. * module/language/elisp/runtime/macro-slot.scm: prog2 and dotimes. * test-suite/tests/elisp-compiler.test: Test prog1, prog2, dotimes, dolist. 2009-07-19 Andy Wingo fix (bytevector-ieee-single-native-set! x 0 0) * libguile/bytevectors.c (VALIDATE_REAL): SCM_VALIDATE_REAL is not what we need for checking values for bytevector-ieee-single-native-set! et al, so define our own validator. (IEEE754_SET, IEEE754_NATIVE_SET): Use it. 2009-07-19 Andy Wingo bytevectors have "element type" field, e.g. for generalized-vector-ref Bytevectors have a very close relationship to other forms of uniform vectors. Often you want to view a u64vector as a series of bytes, for writing over a socket; or to process an incoming stream using the convenient and less error-prone s16vector-ref API rather than bytevector-s16-native-ref. The essential needs of the representation of a bytevector and an s64vector are the same, so we take advantage of that and extend the bytevector implementation to have a "native type" field, which defaults to VU8. This commit doesn't actually expose any user-noticeable changes, however. * libguile/bytevectors.h (SCM_BYTEVECTOR_ELEMENT_TYPE): New internal defines. (scm_i_make_typed_bytevector, scm_c_take_typed_bytevector): New internal functions. * libguile/bytevectors.c (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): (SCM_BYTEVECTOR_TYPE_SIZE): (SCM_BYTEVECTOR_TYPED_LENGTH): New internal macros. (make_bytevector, make_bytevector_from_buffer): Take an extra argument, the element type. The length argument is interpreted as being the number of elements, which corresponds to the number of bytes in the default VU8 case. Doing it this way eliminates a class of bugs -- e.g. a u32vector of length 3 bytes doesn't make sense. We do have to check for another class of bugs: overflow. The length stored on the bytevector itself is still the byte length, though. (scm_i_make_typed_bytevector): (scm_c_take_typed_bytevector): New internal functions. (scm_i_shrink_bytevector): Make sure the new size is valid for the bytevector's type. (scm_i_bytevector_generalized_set_x): Remove this function, the array-handle infrastructure takes care of this for us. (print_bytevector): Print the bytevector according to its type. (scm_make_bytevector, scm_bytevector_copy) (scm_uniform_array_to_bytevector) (scm_u8_list_to_bytevector, scm_bytevector_to_uint_list): Adapt to make_bytevector extra arg. (bv_handle_ref, bv_handle_set_x): Adapt to ref and set based on the type of the bytevector, e.g. f64 or u8. (bytevector_get_handle): Set the typed length of the vector, not the byte length. Conflicts: libguile/bytevectors.c 2009-07-19 Andy Wingo bytevector inlinedness indicated by flag, not length * libguile/bytevectors.h (SCM_BYTEVECTOR_INLINE_P): Change to check a flag instead of checking the length of the bytevector. * libguile/bytevectors.c (make_bytevector_from_buffer): Handle the len <= inline threshold case as well. Set the inline flag as appropriate. (make_bytevector): Updat the inline flag as appropriate. (scm_c_take_bytevector): Just dispatch to make_bytevector_from_buffer. (scm_i_shrink_bytevector): Update the inline flag as appropriate. Update the length when shrinking an already-inlined vector. (STRING_TO_UTF): Fix some indentation. 2009-07-19 Andy Wingo any->u8vector and family now implemented in Scheme * module/Makefile.am: * module/srfi/srfi-4/gnu.scm: New module, for extensions to srfi-4. Currently defines the any->FOOvector family. * libguile/srfi-4.c: * libguile/srfi-4.i.c: Dispatch scm_any_to_FOOvector calls to the scheme-implemented functions in (srfi srfi-4 gnu). 2009-07-19 Andy Wingo make-typed-array builds backing vector via make-generalized-vector * libguile/arrays.c: Rework to use scm_make_generalized_vector instead of our own type table. * libguile/bitvectors.c: Fix some includes. 2009-07-19 Andy Wingo add registry of vector constructors, make-generalized-vector * libguile/generalized-vectors.h: * libguile/generalized-vectors.c: Add a registry of vector constructors. (scm_make_generalized_vector): New public function, constructs a vector of a given type. * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/srfi-4.c: * libguile/strings.c: * libguile/vectors.c: Register vector constructors. * libguile/extensions.c (scm_init_extensions): No need to NULL the list of registered extensions here, the static init does it for us. Allows scm_c_register_extension to be called before scm_init_extensions. * libguile/init.c (scm_i_init_guile): Move array initialization earlier, so e.g. scm_init_strings has access to a valid list of array element types when registering its vector constructor. 2009-07-19 Andy Wingo uniform vector functions to their own file * libguile/uniform.c: * libguile/uniform.h: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/Makefile.am: Move uniform vector funcs out of srfi-4 to their own file. * libguile.h: * libguile/arrays.c: * libguile/bytevectors.c: Update includers. 2009-07-19 Andy Wingo generic vector ops to own file * libguile/Makefile.am: * libguile/vectors.c: * libguile/vectors.h: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: Move generic vector ops off into their own file too. The implementation is now based on the generic array-handle infrastructure. * libguile.h: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/random.c: * libguile/srfi-4.c: Update includers. 2009-07-19 Andy Wingo move generic array foo out to its own file * libguile/arrays.h: * libguile/arrays.c: * libguile/generalized-arrays.h: * libguile/generalized-arrays.c: Move some generic functionality out of arrays.c to a new file. * libguile/array-map.c: * libguile/deprecated.c: * libguile/init.c: Update includers. 2009-07-19 Andy Wingo remove enclosed arrays * libguile/arrays.h: * libguile/array-map.c: * libguile/arrays.c: * libguile/deprecated.c: Remove "enclosed arrays". The only user-facing procedures that this affects are scm_enclose_array / enclose-array. If enclosed arrays are added back, it should be through the generic array interface; but really, it sounds like something that would be better implemented in Scheme. 2009-07-19 Andy Wingo add generic array implementation facility * libguile/array-handle.c (scm_i_register_array_implementation): (scm_i_array_implementation_for_obj): Add generic array facility, which will (in a few commits) detangle the array code. (scm_array_get_handle): Use the generic array facility. Note that scm_t_array_handle no longer has ref and set function pointers; instead it has a pointer to the array implementation. It is unlikely that code out there used these functions, however, as the supported way was through scm_array_handle_ref/set_x. (scm_array_handle_pos): Move this function here from arrays.c. (scm_array_handle_element_type): New function, returns a Scheme value representing the type of element stored in this array. * libguile/array-handle.h (scm_t_array_element_type): New enum, for generically determining the type of an array. (scm_array_handle_rank): (scm_array_handle_dims): These are now just #defines. * libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/srfi-4.c: * libguile/strings.c: * libguile/vectors.c: Register array implementations for all of these. * libguile/inline.h: Update for array_handle_ref/set change. * libguile/deprecated.h: Need to include arrays.h now. 2009-07-19 Andy Wingo rename unif.[ch] to arrays.[ch] * libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/arrays.c: * libguile/arrays.h: Rename unif.[ch] to arrays.[ch]. * libguile.h: * libguile/array-handle.c: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/eq.c: * libguile/gc-card.c: * libguile/gc-malloc.c: * libguile/gc-mark.c: * libguile/gc.c: * libguile/init.c: * libguile/inline.h: * libguile/print.c: * libguile/random.c: * libguile/read.c: * libguile/socket.c: * libguile/sort.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/strports.c: * libguile/vectors.c: * libguile/vectors.h: Update includers. 2009-07-19 Andy Wingo bitvector exodus from unif.[ch] * libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/bitvectors.c: * libguile/bitvectors.h: Move bitvector functionality out of unif.[ch]. * libguile/array-handle.c: * libguile/array-map.c: * libguile/init.c: * libguile/read.c: * libguile/srfi-4.c: * libguile/vectors.c: Oh, what a tangled web we weave... 2009-07-19 Andy Wingo parts of unif.[ch] to array-handle.[ch] * libguile/array-handle.c: * libguile/array-handle.h: Move some parts of unif.c and unif.h to these new files. * libguile/unif.c: * libguile/unif.h: Update includers. Since unif.h depends on the array handle type, we include array-handle.h, which also means that there will be no difference for our callers. * libguile/init.c: Call scm_init_array_handle, though it does nothing as of yet. * libguile/Makefile.am: Adapt for new files. 2009-07-19 Andy Wingo rename ramap.[ch] to array-map.[ch] * libguile/array-map.c: * libguile/array-map.h: Rename from ramap.c and ramap.h. * libguile.h: * libguile/Makefile.am: * libguile/eq.c: * libguile/init.c: * libguile/sort.c: * libguile/unif.c: * libguile/vectors.c: All referrers changed. 2009-07-19 Andy Wingo rename scm_i_make_ra to scm_i_make_array * libguile/unif.c (scm_i_make_array): Rename from scm_i_make_ra. All callers changed. clean up libguile/Makefile.am * libguile/Makefile.am: Clean up some of the file lists, should make future diffs easier to parse. remove convert.{c,i.c,h} * libguile/convert.c: * libguile/convert.h: * libguile/convert.i.c: Remove these functions, which were undocumented, not in the libguile/ header, and thus unlikely to have been used. 2009-07-19 Andy Wingo remove deprecated functions from unif.c * libguile/unif.h: * libguile/unif.c: Remove deprecated functions. * module/ice-9/deprecated.scm: Remove array-related deprecated functions. * NEWS: Update. 2009-07-18 Daniel Kraft Implemented some important list built-ins. * module/language/elisp/runtime.scm: Updated/added convenience macros. * module/language/elisp/runtime/function-slot.scm: Implement list built-ins. * module/language/elisp/runtime/macro-slot.scm: Implement list built-ins. * test-suite/tests/elisp-compiler.test: Test the implemented built-ins. Implemented unless, when and dotimes using built-in macros. * module/language/elisp/README: Document that. * module/language/elisp/runtime.scm: Defined built-in-macro macro. * module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes. * test-suite/tests/elisp-compiler.test: Test for those constructs. Return correct value for setq form. * module/language/elisp/compile-tree-il.scm: Fix implementation of setq. * test-suite/tests/elisp-compiler.test: Check for value of setq form. Implemented real quotation (added support for backquotation). * module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Implement backquote. * test-suite/tests/elisp-compiler.test: Test quotation and backquotes. Implemented eq and equal built-in predicates. * module/language/elisp/runtime/function-slot.scm: Implement eq and equal. * test-suite/tests/elisp-compiler.test: Test them. 2009-07-16 Daniel Kraft Implemented macros in elisp compiler. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement defmacro and expansion. * module/language/elisp/runtime/macro-slot.scm: New module to keep definitions. * test-suite/Makefile.am: Add elisp-compiler.test to list of tests. * test-suite/tests/elisp-compiler.test: Basic macro tests. Extended test-suite to cover already implemented built-ins and fixed errors found. * module/language/elisp/runtime/function-slot.scm: Fixed errors in number preds. * test-suite/tests/elisp-compiler.test: Test built-ins already implemented. 2009-07-15 Ludovic Courtès Bump version number for 1.9.1. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Make the non-integrated VM test-suite less verbose. * testsuite/run-vm-tests.scm (run-vm-tests): Don't display the number of tests passed since it's always 1 or 0. 2009-07-15 Ludovic Courtès Add FIXMEs about misaligned objcode-metas. * libguile/objcodes.c (scm_c_make_objcode_slice): Add comment about misaligned `objcode-meta'. * module/language/assembly/compile-bytecode.scm (write-bytecode): Likewise. 2009-07-15 Ludovic Courtès Fix unaligned access in the VM code. * libguile/vm.c (struct t_32bit_aligned): New. (really_make_boot_program)[bytes]: Use it. This fixes possibly unaligned accesses, which cause a "bus error" on some platforms (e.g., sparc-*). 2009-07-15 Ludovic Courtès Const-qualify buffers passed to `scm_c_make_objcode_slice ()'. * libguile/objcodes.c (scm_c_make_objcode_slice): Add `const' qualifier for PTR and DATA. * libguile/objcodes.h: Update accordingly. 2009-07-15 Ludovic Courtès Switch remaining GPLv2+ Guile-VM headers to LGPLv3+. * module/system/base/compile.scm, module/system/base/syntax.scm, module/system/repl/common.scm, module/system/repl/describe.scm, module/system/vm/instruction.scm, module/system/vm/objcode.scm, module/system/vm/profile.scm, module/system/vm/program.scm, module/system/vm/trace.scm: Switch header from GPLv2+ to LGPLv3+. 2009-07-15 Daniel Kraft Test-suite for elisp compiler so far, excluding the built-ins. * test-suite/tests/elisp-compiler.test: Tests for compiler so far. Removed wrong not in zerop built-in. * module/language/elisp/runtime/function-slot.scm: Fix zerop. 2009-07-15 Ludovic Courtès Fix typo in the compile-type verification of `OBJCODE_COOKIE'. * libguile/objcodes.c: Fix `sizeof (OBJCODE_COOKIE)' assertion: the trailing 0 must not be taken into account, and multiple of 8 means the 3 LSBs are clear. Make sure at compile-time that `OBJCODE_COOKIE' has the right size. * libguile/objcodes.c: Use `verify' to assert that the size of `OBJCODE_COOKIE' is a multiple of 8. Explicitly use Gnulib's `verify' module. * m4/gnulib-cache.m4: Add `verify'. Augment `OBJCODE_COOKIE' to detect wrong endianness or word size. * libguile/objcodes.c (OBJCODE_ENDIANNESS, _OBJCODE_STRINGIFY, OBJCODE_STRINGIFY, OBJCODE_WORD_SIZE): New macros. (OBJCODE_COOKIE): Use them. The intent is that `.go' files compiled for a different endianness or word size are detected. Remove the `long_long' and `ulong_long' types. * libguile/gen-scmconfig.c (main): Don't emit typedefs for `long_long' and `ulong_long'. This was already deprecated in 1.8 and known to cause conflicts with other libraries such as HDF5, as reported by Mark Patterson (http://lists.gnu.org/archive/html/bug-guile/2009-02/msg00003.html). 2009-07-14 Andy Wingo update NEWS * NEWS: Update. NEWS has info on 1.9.N to 1.9.N+1 in addition to 1.8 to 2.0 * NEWS: Update to have an incremental section in addition to a comprehensive 1.8->2.0 section. fix race in which some instruction name symbols could go unmarked * libguile/instructions.c: In loops, replace scm_op_last with SCM_VM_NUM_INSTRUCTIONS. (fetch_instruction_table): Protect the instruction symbols from collection. Before they were only marked by the name->opcode hash table, leading to races in which they could be collected. (scm_lookup_instruction_by_name): Protect the hash table earlier, as it's not actually a stack variable, since it's static. fix bounds checks for the last element of bv-*-{ref,set} * libguile/vm-i-scheme.c (BV_FIXABLE_INT_REF, BV_INT_REF): (BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Fix the bounds check for the last element. 2009-07-14 Daniel Kraft Implemented defconst, defvar, defun special forms for elisp. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement defconst/defvar/defun. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-14 Ludovic Courtès Remove potential "uninitialized variable" GCC warnings. * libguile/vm-i-scheme.c (vector_ref, vector_set, BV_FIXABLE_INT_REF, BV_INT_REF, BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Explicitly initialize all locals, to make some versions of GCC happier. Patch by Dale P. Smith . Fix tests that assumed little endian. * test-suite/tests/asm-to-bytecode.test (u32->u8-list): New procedure. ("compiler")[(load-program 3 2 1 0 () 3 #f (make-int8 3) (return)), (load-program 3 2 1 0 () 3 (load-program 3 2 1 0 ...))]: Make these tests work on hosts whose endianness is not little endian. 2009-07-13 Daniel Kraft Some bug fixes on the way and mainly implemented some built-ins (arithmetic). * module/language/elisp/README: Document changes. * module/language/elisp/compile-tree-il.scm: Bug fixes to fluid-creation. * module/language/elisp/runtime.scm: Some helping definitions for built-ins. * module/language/elisp/runtime/function-slot.scm: Defined artihmetic built-ins. Automatically create fluids when necessary. * module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Create fluids when necessary. * module/language/elisp/runtime/function-slot.scm: Fix module name. Fixed lambda expressions and implemented function calls using the basic list notation. * module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Implement function calls. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp Lambda expressions in elisp, but not yet function calls. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement lambda expressions. 2009-07-07 Daniel Kraft Implemented let and let* in elisp. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement let and let*. Implemented while construct in elisp. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement while construct. 2009-07-05 Ludovic Courtès Use Gnulib's `vsnprintf' module. * m4/gnulib-cache.m4: Use `vsnprintf', needed by `deprecation.c'. Update `NEWS'. * NEWS: Update. Enclose `bit-operations.test' in its own module. * test-suite/tests/bit-operations.test: Use the `define-module' clause. Fix the `BUILD_PTHREAD_SUPPORT' Automake conditional when not using pthread. * configure.in: Set $build_pthread_support to "no" when thread support isn't built. This fixes the `BUILD_PTHREAD_SUPPORT' Automake conditional. 2009-07-04 Daniel Kraft Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-03 Daniel Kraft Implemented fluid-based variable references and setting using setq. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement variable references, setq * module/language/elisp/runtime.scm: New file for runtime definitions. * module/language/elisp/runtime/function-slot.scm: Ditto. * module/language/elisp/runtime/value-slot.scm: Ditto. 2009-07-02 Andy Wingo fix error message for bad objcode cookie * libguile/objcodes.c: Whoop-dee :) 2009-07-02 Daniel Kraft Implemented elisp's or form. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement or. For elisp's (cond ...) and (condition) forms without body, return the condition as value. * compile-tree-il.scm: Fix compilation of (cond ...) for bodyless conditions. 2009-07-01 Neil Jerram Read complex numbers where both parts are inexact decimals Thanks to Bill Schottstaedt for reporting this problem! * libguile/numbers.c (mem2ureal): Don't be misled by *p_exactness being INEXACT on entry (as is possible when reading a complex number): use local exactness variable x which starts as EXACT. Call mem2decimal_from_point () with &x instead of p_exactness. * test-suite/tests/numbers.test ("string->number"): Add complex number tests suggested by Bill. 2009-07-01 Neil Jerram Correction to doc on Accessing Arrays from C Thanks to Ludovic for the new wording! * doc/ref/api-compound.texi (Accessing Arrays from C): Correct text to reflect the current implementation of scm_array_get_handle and scm_array_handle_release - which don't actuall do any dynwind stuff. 2009-06-29 Daniel Kraft Added make-nil instruction to VM and use it for Emacs' nil in the compiler. * doc/ref/vm.texi: Document new instruction. * libguile/vm-i-system.c: Add it to the VM. * module/language/assembly.scm: Compile (const %nil) to (make-nil) assembly. * module/language/glil/decompile-assembly.scm: Handle (make-nil) * module/language/elisp/compile-tree-il.scm: Use (const %nil) for nil. 2009-06-28 Ludovic Courtès Remove seek/truncate shortcuts to file ports. Suggested by Neil. * libguile/fports.c (fport_seek_or_seek64): Rename to `fport_seek ()'. (fport_seek, scm_i_fport_seek, scm_i_fport_truncate): Remove. * libguile/fports.h (scm_i_fport_seek, scm_i_fport_truncate): Remove declarations. * libguile/ports.c (scm_seek): Remove shortcut that would call out to `scm_i_fport_seek ()'. (scm_truncate_file): Likewise. 2009-06-27 Daniel Kraft Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-06-26 Andy Wingo 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. 2009-06-26 Andy Wingo 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. 2009-06-26 Andy Wingo 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. 2009-06-26 Andy Wingo 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. 2009-06-26 Andy Wingo 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. 2009-06-26 Andy Wingo minor doc tweaks * doc/ref/api-compound.texi: Generalized vector doc fixups. * doc/ref/api-data.texi: Minor fixes to bytevector docs. 2009-06-26 Neil Jerram 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. 2009-06-25 Ludovic Courtès 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. 2009-06-25 Ludovic Courtès Fix `load-objcode' FD/mapping leak occurring upon failure. * libguile/objcodes.c (make_objcode_by_mmap): Close FD and unmap ADDR upon failure. 2009-06-24 Andy Wingo 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. 2009-06-24 Andy Wingo 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. 2009-06-24 Neil Jerram 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. 2009-06-22 Andy Wingo 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. 2009-06-22 Andy Wingo 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. 2009-06-22 Andy Wingo 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. 2009-06-22 Ludovic Courtès 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. 2009-06-22 Ludovic Courtès 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. 2009-06-22 Ludovic Courtès 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. 2009-06-22 Ludovic Courtès 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. 2009-06-22 Ludovic Courtès Fix documentation of `make-bytevector'. * doc/ref/api-data.texi (Bytevector Manipulation): Fix documentation of the FILL argument of `make-bytevector'. 2009-06-21 Andy Wingo 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 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. 2009-06-21 Andy Wingo 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+. link to brainfuck wikipedia page * doc/ref/compiler.texi: Point to more info on Brainfuck. Patch by Daniel Kraft. 2009-06-21 Daniel Kraft 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. 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. 2009-06-21 Andy Wingo 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. 2009-06-21 Andy Wingo update .gitignore * .gitignore: Update. 2009-06-21 Neil Jerram 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. 2009-06-21 Andy Wingo 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. 2009-06-20 Andy Wingo 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. 2009-06-20 Andy Wingo 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. 2009-06-20 Andy Wingo better error in make_objcode_by_mmap * libguile/objcodes.c (make_objcode_by_mmap): Better error when the object header is incorrect. 2009-06-20 Andy Wingo 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. 2009-06-19 Ludovic Courtès Make `cond-expand' compilable. * module/ice-9/boot-9.scm (cond-expand): Changed into a `define-macro' macro. Fix copyright year and authorship of `guile-tools'. Slightly improve `NEWS'. Fix "guile-tools disassemble". * module/scripts/disassemble.scm (disassemble): Accept a variable number of arguments. Invoke the right `disassemble' procedure. 2009-06-19 Andy Wingo don't autocompile at installcheck * examples/Makefile.am: Don't autocompile our tests at installcheck time. 2009-06-19 Andy Wingo 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. 2009-06-19 Andy Wingo gnulib-tool --import canonicalize-lgpl 2009-06-19 Andy Wingo 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. 2009-06-19 Andy Wingo 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. 2009-06-19 Andy Wingo another draft of NEWS * NEWS: Another draft. 2009-06-19 Ludovic Courtès 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. 2009-06-19 Ludovic Courtès Fix the REPL's `,compile' command. * module/system/repl/command.scm (compile): Use `guile:disassemble' instead of the former `disassemble-objcode'. 2009-06-19 Ludovic Courtès 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. 2009-06-19 Ludovic Courtès 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. 2009-06-18 Ludovic Courtès 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. 2009-06-18 Andy Wingo 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? 2009-06-17 Neil Jerram Change guile-readline license to GPLv3+ Complete changing license to LGPLv3+ (Still guile-readline to do, but that will all be GPLv3+.) Reinstate lines removed by mistake from chars.test 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/* ) 2009-06-14 Neil Jerram 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. Add Tex and texinfo output and auxiliary suffixes to .gitignore 2009-06-14 Neil Jerram 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. 2009-06-13 Neil Jerram Fix for make distcheck * examples/Makefile.am (AM_CFLAGS, AM_LIBS): Set PATH so that guile-config can find guile. Fix `make distcheck' * libguile/r6rs-ports.c (scm_init_r6rs_ports): Add libguile/ to included .x file name. 2009-06-12 Neil Jerram Note Andy as a contributor 2009-06-10 Andy Wingo 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. 2009-06-10 Andy Wingo 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! 2009-06-10 Andy Wingo 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. 2009-06-09 Andy Wingo 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. 2009-06-09 Daniel Kraft 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. 2009-06-08 Andy Wingo a start to changing VM scheme copyrights * module/language/tree-il/primitives.scm: Change copyright to LGPLv2.1. Others will follow. 2009-06-08 Andy Wingo 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. 2009-06-08 Andy Wingo don't autocompile snarfing m4 docs * doc/ref/Makefile.am (autoconf-macros.texi): Yet another place we shouldn't autocompile. 2009-06-08 Andy Wingo 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. 2009-06-08 Andy Wingo 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 , 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. 2009-06-07 Andy Wingo 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. 2009-06-07 Andy Wingo 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. 2009-06-07 Andy Wingo 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. 2009-06-06 Neil Jerram 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. 2009-06-06 Andy Wingo 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. 2009-06-05 Neil Jerram State and explain dependency on libtool 2.2 * HACKING: Updated to recommend libtool 2.2 and anti-recommend libtool 1.5.26. Fix `Mismatching FUNC_NAME' warning from guile-func-name-check * libguile/bytevectors.c (FUNC_NAME): Change to match function name. 2009-06-05 Andy Wingo 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 :) 2009-06-05 Andy Wingo 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. 2009-06-05 Andy Wingo disable autocompilation when running guile-tools compile * module/scripts/compile.scm (compile): Disable autocompilation when running guile-tools compile. 2009-06-05 Andy Wingo 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. 2009-06-05 Andy Wingo 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. 2009-06-05 Andy Wingo 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. 2009-06-05 Andy Wingo compile and install srfi-98. * module/Makefile.am (SRFI_SOURCES): Add SRFI-98. 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. 2009-06-05 Andy Wingo 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. 2009-06-05 Andy Wingo 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. 2009-06-04 Andy Wingo 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. 2009-06-04 Andy Wingo fix .go installation * am/guilec (nobase_ccache_DATA): Fix .go installation. turn off autocompilation when snarfing * libguile/Makefile.am (snarf2checkedtexi): Turn off autocompilation when snarfing. 2009-06-03 Andy Wingo 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 :-) 2009-06-03 Andy Wingo 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. 2009-06-03 Andy Wingo 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. 2009-06-03 Andy Wingo 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. 2009-06-03 Andy Wingo 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. 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. install .go files under $libdir, not $datadir * am/guilec: Install .go files to $(pkglibdir)/$GUILE_EFFECTIVE_VERSION/ccache. 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. 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. 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. 2009-06-03 Andy Wingo 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. 2009-06-02 Julian Graham Merge branch 'master' of git://git.savannah.gnu.org/guile 2009-05-31 Julian Graham 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. 2009-05-29 Andy Wingo Merge branch 'syncase-in-boot-9' Conflicts: module/Makefile.am 2009-05-28 Ludovic Courtès 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'. 2009-05-28 Ludovic Courtès 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'. 2009-05-28 Andy Wingo add tests for #' etc * test-suite/tests/reader.test ("#'"): Add tests for the hash-syntax reader macros. add reader tests for #; * test-suite/tests/reader.test ("#;"): Add reader tests for #;. 2009-05-28 Andy Wingo 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. 2009-05-27 Neil Jerram 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. 2009-05-27 Neil Jerram 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. 2009-05-26 Andy Wingo 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. 2009-05-26 Andy Wingo 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. 2009-05-26 Andy Wingo gnulib-tool --import environ; rely on gnulib for environ definitions * libguile/posix.c: * libguile/stime.c: Remove environ definition, gnulib provides it now. 2009-05-26 Andy Wingo 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. 2009-05-26 Andy Wingo gnulib-tool --import lib-symbol-visibility 2009-05-26 Andy Wingo 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. 2009-05-25 Andy Wingo 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. 2009-05-24 Andy Wingo 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 . 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 , 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-22 Ludovic Courtès 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! 2009-05-22 Andy Wingo 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. 2009-05-22 Andy Wingo 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. 2009-05-22 Andy Wingo 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. 2009-05-22 Andy Wingo 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 2009-05-22 Andy Wingo 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. 2009-05-22 Andy Wingo 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! 2009-05-22 Andy Wingo 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. 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. 2009-05-22 Andy Wingo 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! 2009-05-22 Andy Wingo 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. 2009-05-21 Andy Wingo 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. 2009-05-21 Andy Wingo 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. 2009-05-21 Andy Wingo 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. 2009-05-21 Andy Wingo 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. 2009-05-21 Andy Wingo 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... 2009-05-21 Andy Wingo fix srfi-17.test * test-suite/tests/srfi-17.test (exception:bad-quote): Change the expected exception for (set! (quote foo) ...) errors. 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. 2009-05-21 Andy Wingo 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 (( ...)) (define-method (foo (arg )) ...)). * module/oop/goops/compile.scm (next-method?, compile-make-procedure): Remove these, as `method' does it all now, hygienically. 2009-05-21 Ludovic Courtès Make use of Gnulib's `flock' module. * libguile/posix.c: Always use , which is provided by Gnulib. (flock)[__MINGW32__]: Remove. (scm_flock): Compile unconditionally. Always use Gnulib's flock(2). Make use of Gnulib's `putenv' module. * libguile/posix.c: Include since the putenv(3) declaration is there (POSIX and Gnulib). (scm_putenv): Rely on Gnulib's `putenv' module. 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). Update `NEWS'. 2009-05-21 Michael Gran 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. 2009-05-21 Ludovic Courtès Update `NEWS' wrt. `branch_release-1-8'. Fix compilation of `test-round.c' on BSD. * test-suite/standalone/test-round.c (HAVE_MACHINE_FPU_H): Include when available. This fixes compilation on NetBSD. Reported by Greg Toxel. Update `NEWS'. 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 ()'. 2009-05-21 Ludovic Courtès Use instead of when needed (e.g., Tru64 5.1b). * configure.in: Look for . * test-suite/standalone/test-round.c: Use if available. 2009-05-21 Ludovic Courtès 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. 2009-05-21 Ludovic Courtès 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. 2009-05-20 Ludovic Courtès 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. 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 . 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 . Update `NEWS' and `THANKS'. 2009-05-20 Neil Jerram 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. 2009-05-20 Neil Jerram Fix `explicitely' typos, should be `explicitly' 2009-05-20 Andy Wingo 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 :) 2009-05-20 Andy Wingo 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. 2009-05-20 Andy Wingo 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. 2009-05-20 Andy Wingo 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. 2009-05-20 Andy Wingo 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. 2009-05-20 Andy Wingo 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. 2009-05-20 Andy Wingo 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. 2009-05-20 Andy Wingo 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 . * test-suite/tests/tree-il.test ("lambda"): Fix nlocs counts. Add a closure test case. 2009-05-18 Andy Wingo 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. 2009-05-18 Andy Wingo 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. 2009-05-17 Andy Wingo 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. 2009-05-17 Andy Wingo 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. 2009-05-17 Andy Wingo 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 structures. Yaaaaay! 2009-05-17 Andy Wingo 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 , , and for the original variable names. * module/language/tree-il/compile-glil.scm (compile-glil): Adapt for new make-lambda arg. 2009-05-17 Andy Wingo 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. 2009-05-15 Andy Wingo 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 . Not used quite yet. * module/language/glil.scm: Remove , as it is the same as (minus an offset). * module/language/glil/compile-assembly.scm: * module/language/glil/decompile-assembly.scm: * module/language/ghil/compile-glil.scm: Adapt for * removal. * module/Makefile.am (TREE_IL_LANG_SOURCES): Reorder, and add analyze.scm. 2009-05-14 Andy Wingo 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. 2009-05-12 Andy Wingo 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. 2009-05-11 Andy Wingo 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. 2009-05-08 Andy Wingo 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. 2009-05-07 Andy Wingo go ahead and regenerate psyntax-pp.scm 2009-05-07 Andy Wingo 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. 2009-05-07 Andy Wingo 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. 2009-05-07 Andy Wingo 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. 2009-05-07 Andy Wingo 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. 2009-05-04 Andy Wingo when compiling, use make-lexical to residualize original var names * module/ice-9/psyntax.scm (build-lexical-reference): Change to be a function. Take an extra arg, the original name of the variable. If we are compiling, make a #, annotated with the original var name. All callers changed. (build-lexical-assignment): Also a function, taking also the original var name, using build-lexical-reference to build its output. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-05-04 Andy Wingo sc-expand in compile mode produces (ice-9 expand-support) structures * module/ice-9/psyntax.scm (*mode*): New moving part, a fluid. (sc-expand): Dynamically bind *mode* to the expansion mode. (build-global-reference): Change to be a procedure instead of local syntax. Import the logic about when to make a @ or @@ form to here, from boot-9.scm. If we are compiling, build output using (ice-9 expand-support)'s make-module-ref, otherwise just making the familiar s-expressions. (This will allow us to correctly expand in modules in which @ or @@ are not bound, at least when we are compiling.) (build-global-assignment): Use the result of build-global-reference. A bit hacky, but hey. (top-level-eval-hook, local-eval-hook): Strip expansion structures before evalling. * module/ice-9/boot-9.scm (make-module-ref): Remove, this logic is now back in psyntax.scm. * module/ice-9/compile-psyntax.scm (source): Since we expand in compile mode, we need to strip expansion structures. * module/ice-9/expand-support.scm (strip-expansion-structures): Remove the logic about whether and how to strip @/@@ from here, as it's part of psyntax now. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/compile-ghil.scm (compile-ghil): Strip expansion structures -- for now. In the future, we might translate directly from these structures into GHIL. 2009-05-04 Andy Wingo replace sc-expand with sc-expand3, removing binding for sc-expand3 * module/ice-9/boot-9.scm (sc-expand3): * module/ice-9/psyntax.scm (sc-expand3): Replace sc-expand with sc-expand3, as expand3 with one argument is the same as sc-expand. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/compile-psyntax.scm: * module/language/scheme/compile-ghil.scm: Change callers to sc-expand3 to use sc-expand. 2009-04-29 Andy Wingo remove (void) from boot-9 and psyntax * module/ice-9/psyntax.scm: Tweak comments. Remove references to `void'; just produce (if #f #f) instead of (void). * module/ice-9/psyntax-pp.scm: Regenerated, twice. * module/ice-9/boot-9.scm (void): Remove this binding. 2009-04-29 Andy Wingo more cleanups to boot-9/psyntax * module/ice-9/boot-9.scm: Comment some more things. * module/ice-9/psyntax.scm: Remove error-hook -- callers should just use syntax-violation. Change all callers. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-29 Andy Wingo remove andmap from public API (we still have and-map) * module/ice-9/boot-9.scm (and-map, or-map): Move these definitions up so psyntax can use them. (andmap): Remove, yay. * module/ice-9/psyntax.scm: Remove notes about andmap, and just use Guile's and-map -- except in cases that need the multiple list support, in which case we have a private and-map*. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-29 Andy Wingo cleanups to boot-9 * module/ice-9/boot-9.scm: Shuffle around some definitions. (module-add!): Removed stub definition, no longer used. (install-global-transformer): Removed, no longer used (yay!). * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Remove install-global-transformer. 2009-04-29 Andy Wingo first-class macro representation (no bits on variables) * libguile/macros.c (scm_macro_p): Update docs. * module/ice-9/boot-9.scm (module-define!, module-ref): Define pre-boot forms of these functions as well. I suspect module-add! can go soon. (module-lookup-keyword, module-define-keyword!) (module-undefine-keyword!) Remove these. * module/ice-9/psyntax-pp.scm: Regenerate. Notice the difference? * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook): Rework to expect first-class macros. Heh heh. (remove-global-definition-hook): Pleasantly, this hook can go away. (chi-install-global): Terrorism to generate the right kind of output -- will clean up. (chi-top): Unify definition handling for all kinds of values. 2009-04-29 Andy Wingo a different tack for syncase macro representation * libguile/macros.c (macro_print): Show syntax-case bindings, if present. (macro_mark): Mark the extra two words if they're there. (scm_make_syncase_macro, scm_make_extended_syncase_macro): OK! A new take at the "how do we represent syncase macros in Guile" problem. Whereas we need a disjoint type, but would like it to be compatible with old predicates (e.g. `macro?'), and need to be able to extend existing syntax definitions (e.g. `cond'), let's add a bit to macros to indicate whether they have syncase macro bindings or not, and a fourth macro type for native syncase macros. (scm_macro_type): Return 'syntax-case for native syntax-case macros. Note that other macro types may have syntax-case bindings. (scm_macro_name): Return #f if the transformer is not a procedure. (scm_syncase_macro_type, scm_syncase_macro_binding): New accessors for the syncase macro bindings. * libguile/macros.h: Add API for syncase macros. * module/ice-9/boot-9.scm (module-define-keyword!): Adapt to use syncase macros, though they are not yet used. Reorder other syncase API. * module/ice-9/psyntax.scm (chi-expr): Fix syntax-violation invocation. 2009-04-26 Andy Wingo syntax-dispatch -> $sc-dispatch * module/ice-9/boot-9.scm: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: Change syntax-dispatch to $sc-dispatch, as it is in current psyntax. The idea is that this isn't really a public variable, though it has to be, currently, so just obscure that fact with an obscure name. build ecmascript stuff last * module/Makefile.am: Wait to build ecmascript until the compiler has bootstrapped. 2009-04-26 Andy Wingo syntax-object->datum => syntax->datum, likewise datum->syntax * module/ice-9/boot-9.scm (datum->syntax, syntax->datum): Rename from datum->syntax-object and syntax-object->datum, following r6rs. Change all callers. Reorder some of the other exports from psyntax. * module/ice-9/psyntax.scm: Change datum->syntax and syntax->datum definitions and callers. * module/ice-9/psyntax-pp.scm: Regenerated. * module/oop/goops.scm (define-class-pre-definition): Update for changes. 2009-04-26 Andy Wingo replace psyntax's syntax-error with r6rs' syntax-violation * module/ice-9/boot-9.scm (syntax-violation): Well, as long as we have to have a function for indicating syntax errors, let's let it be a well-thought-out one -- syntax-violation from r6rs. No more syntax-error. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Replace instances of syntax-error with syntax-violation. Implement as a scm-error to 'syntax-error, with some nice arguments. 2009-04-26 Andy Wingo add module-{define-keyword!,undefine-keyword!,lookup-keyword} * libguile/modules.c (scm_module_local_variable): Allow this to be called before modules are booted with #f as the module. * module/ice-9/boot-9.scm (module-define-keyword!) (module-lookup-keyword, module-undefine-keyword!): Well, if syncase forces us to allow the keyword bindings to be partitioned from value bindings, let's go ahead and do that in boot-9 instead of in psyntax. A step on the way to removing `install-global-transformer'. (sc-chi): Remove. * module/ice-9/psyntax.scm (put-global-definition-hook): (remove-global-definition-hook, get-global-definition-hook): Use our new module-* functions. (sc-chi): Remove, no longer needed. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-26 Andy Wingo remove sc-macro definition * module/ice-9/boot-9.scm (sc-macro): Remove sc-macro definition, yay. 2009-04-26 Andy Wingo fix module-bound?, start compiling srfi-18.scm * module/Makefile.am (SRFI_SOURCES): Let's finally start compiling srfi-18.scm, what the hell. * module/ice-9/boot-9.scm (module-bound?): module-bound? was returning true if (not (variable-bound? (module-local-variable m v))), but (variable-bound? (module-variable m v)). Fix to cut out on the first variable it finds. This bug has been there for a while now. 2009-04-25 Andy Wingo Fix the elisp memoizer code for syncase-in-boot-9 * lang/elisp/interface.scm: * lang/elisp/internals/lambda.scm: * lang/elisp/primitives/syntax.scm: * lang/elisp/transform.scm: Use (lang elisp expand) as the transformer, because we really are intending this code for the memoizer and not the compiler. * lang/elisp/expand.scm: A null expander. * lang/elisp/interface.scm (use-elisp-file, use-elisp-library): * lang/elisp/transform.scm (scheme): Turn these defmacros into procedure->memoizing-macro calls, given that without syncase we have no defmacro either. * lang/elisp/primitives/fns.scm (macroexpand): Comment out, as Scheme's macro expander (temporarily on hiatus) won't work with elisp. 2009-04-25 Andy Wingo allow defmacros to have docstrings * module/ice-9/boot-9.scm (define-macro, defmacro): Add the ability to have a docstring. * module/ice-9/documentation.scm (object-documentation): Remove references to defmacro? and macro?. Since we store the transformation procedure as the binding, we can get docs from the procedure directly. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (put-global-definition-hook): Take the type and the value separately, so we can set the variable to the procedure, while keeping the *sc-expander* to be the "binding object". (global-extend): Pass type and val separately. 2009-04-25 Andy Wingo all of guile compiles now, expanded with syncase * libguile/eval.c (scm_m_eval_when): Whoops, eval-when has an implicit begin. Fix. * module/oop/goops.scm: Syncase doesn't like definitions in expression context, and grudgingly I have decided to go along with that. But that doesn't mean we can't keep the old semantics, via accessing the module system directly. So do so. I took the opportunity to rewrite some macros with syntax-rules and syntax-case -- the former is nicer than the latter, of course. * module/oop/goops/save.scm: Don't define within an expression. * module/oop/goops/simple.scm (define-class): Use define-syntax. * module/oop/goops/stklos.scm (define-class): Use define-syntax. 2009-04-25 Andy Wingo fix bad syntax in define-macro, (ice-9 match), and (oop goops) * module/ice-9/boot-9.scm (define-macro): Use syntax-case to destructure macro arguments, so we get good errors. * module/ice-9/match.scm (defstruct, define-const-structure): Don't unquote in the `defstruct' macro as a value in expansions. * module/oop/goops.scm (standard-define-class): Can't define a macro with `define', use `define-syntax' instead. (define-accessor): Use syntax-rules. Doesn't give us much in this case. (toplevel-define!): New helper, to let us keep GOOPS' behavior with the new expander. Some solution that works lexically and at the toplevel would be nice, though. (define-method): Reimplement with syntax-rules -- soooo much nicer. * module/oop/goops/dispatch.scm (lookup-create-cmethod): Don't define within an expression. 2009-04-24 Andy Wingo allow docstrings with internal definitions * module/Makefile.am (SCHEME_LANG_SOURCES): * module/language/scheme/expand.scm: Remove expand.scm, we don't need it any more. * module/ice-9/psyntax.scm (build-lambda, chi-lambda-clause): Support docstrings with internal definitions. What are Scheme people thinking these days? * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo make sure we compile boot code in (guile), not (guile-user) * libguile/eval.h: * libguile/eval.c (scm_m_eval_when): Define a cheap eval-when, used before syncase has booted. * module/Makefile.am: Reorder to put (system vm) and (system repl) modules after the compiler, as they are not needed at runtime. * module/ice-9/boot-9.scm: Move the eval-when earlier, to be the first thing -- so when we recompile Guile we do so all in the '(guile) module, not '(guile-user). * module/ice-9/compile-psyntax.scm: Rewrite to assume that psyntax.scm will eval-when to set its module, etc. Have everything in a let -- otherwise the `format' call is in (guile), but `target' was defined in (guile-user). Also, write in an eval-when to the expanded file. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/networking.scm: * module/ice-9/psyntax.scm: * module/ice-9/r4rs.scm: Sprinkles of eval-when, for flavor. 2009-04-24 Andy Wingo handle pre-module macro procedures correctly * module/ice-9/psyntax.scm (chi-macro): It's possible for a macro procedure to have no module, if the procedure was made before modules were booted. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo Merge branch 'master' into syncase-in-boot-9 2009-04-24 Andy Wingo merge ice-9, srfi, oop makfiles into module makefile * configure.in: No longer output the Makefile.ins. * module/Makefile.am: Include the contents of ice-9/, srfi/, and oop/. * module/ice-9/Makefile.am: * module/ice-9/debugger/Makefile.am: * module/ice-9/debugging/Makefile.am: * module/oop/Makefile.am: * module/oop/goops/Makefile.am: * module/srfi/Makefile.am: Removed. 2009-04-24 Andy Wingo finish transition to bare/hygiene/public/private * module/ice-9/boot-9.scm (make-module-ref): Remove the transition support. * module/ice-9/psyntax.scm (get-global-definition-hook): Remove transition support. Also remove support for guile-macro. (build-global-reference, build-global-assignment): Remove transition support. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo only bend hygiene in macro-introduced output, not for explicit @/@@ * module/ice-9/psyntax.scm * module/ice-9/psyntax-pp.scm * module/ice-9/boot-9.scm (make-module-ref): We were so almost there with what we had, sniff. The deal is that (begin (load "foo.scm") ((@@ (foo) bar))) would expand to (begin (load "foo.scm") (bar)) because bar was unbound at expansion time, and make-module-ref assumed it was like the else in a cond. But it shouldn't have, because we /explicitly/ asked for the @@ var -- so now if we see a @ or @@, we never drop it. @@ introduced by hygiene can be dropped if it doesn't reference a var, though. Practically speaking, this means tagging all modules in psyntax with their intent: public or private (corresponding to @ or @@), hygiene (introduced by a macro), or bare (when we don't have a module). I'm not sure when we'd see a bare. The implementation is complicated by the need to support the old format and the new format at the same time, so that psyntax-pp can be regenerated. 2009-04-24 Andy Wingo fix @ and syncase * module/ice-9/boot-9.scm (make-module-ref): equal?, not eq?, when matching on module name. (Module names don't have to come from an invocation of module-name in this process.) * module/ice-9/psyntax.scm (build-global-reference) (build-global-assignment, @): Rework the format of the module in syntax objects so that a car of #f indicates a public reference. Loading (foo %module-public-interface) didn't guarantee that (foo) was loaded and useful. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/compile-ghil.scm (lookup-transformer): primitive-macro? does not exist any more. 2009-04-24 Andy Wingo ice-9 syncase now deprecated, woo Remove #:use-module (ice-9 syncase) from lots of places, as it's no longer needed. 2009-04-24 Andy Wingo it is alive!!!!! + concision + fix to compile-ghil * module/ice-9/boot-9.scm: Remove lots of debugging prints. Remove some already-deprecated attempts to load modules from shared libraries. * module/ice-9/psyntax.scm: If we have to create a variable for a syntactic binding, initialize its contents to a gensym. I'd like something more meaningful, but at least this way we can tell different macros apart. Only warn about missing modules if modules are booted. Chi the value part of a (set! (@ ...) ) expression -- whoops! * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/glil.scm (parse-glil): Fix an unquoting error. * module/language/scheme/compile-ghil.scm: No need to import syncase, we gots it. Rework compiler to expand only once, with syncase, instead of incrementally. Fix define-scheme-transformer to work with syncase, by not referencing bare keywords. It works! 2009-04-24 Andy Wingo allow redefinition of global macros to variables * module/ice-9/psyntax.scm: Allow the redefinition of keywords to variables. Otherwise we can't do (define let #f), which is totally useful and stuff. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo fix load for syncase-in-boot-9; compile-psyntax works again * module/ice-9/r4rs.scm: * module/ice-9/boot-9.scm (%load-verbosely, assert-load-verbosity) (%load-announce, %load-hook, load): Move these from r4rs.scm to boot-9.scm. * module/ice-9/compile-psyntax.scm: Update to work with syncase-in-boot-9. * module/ice-9/psyntax-pp.scm: Recompiled with syncase-in-boot-9. 2009-04-24 Andy Wingo leap of faith: (ice-9 syncase) in psyntax-pp.scm -> (guile) * module/ice-9/psyntax-pp.scm: Manually switch psyntax-pp over to (guile) from (ice-9 syncase). Heh heh. 2009-04-24 Andy Wingo syncase early in boot-9, defmacros in terms of syntax-case -- halfway working * module/ice-9/boot-9.scm (eval-when): Remove, as syncase is going to handle this one for us. (sc-expand, sc-expand3, sc-chi, install-global-transformer) (syntax-dispatch, syntax-error, annotation?, bound-identifier=?) (datum->syntax-object, free-identifier=?, generate-temporaries) (identifier?, syntax-object->datum, void, andmap): Oh, ugly of uglies: add these exciting definitions to the main environment. Hopefully we can pull them back out soon. (make-module-ref, resolve-module): Stub these out, as a replacement for expand-support. (%pre-modules-transformer): Define to sc-expand, so that we are using syncase from the very start. (defmacro, define-macro): Define in terms of syntax-case. (macroexpand, macroexpand-1): Remove, there should be a different way to get at this -- though perhaps with the same name. (make-module): Make sc-expand the default module-transformer. (process-define-module): Issue a deprecation warning when using ice-9 syncase. (primitive-macro?): Remove, no meaning... (use-syntax): Deprecate. (define-private, define-public, defmacro-public): Rework in terms of syntax-rules. * module/ice-9/syncase.scm: Gut, as syncase is provided by core now. 2009-04-24 Andy Wingo module-name returns '(guile) during boot; psyntax tweak * module/ice-9/boot-9.scm (module-name): Return '(guile) before the module system is booted, for syncase's benefit. Defer redefinition until the module system is booted. * module/ice-9/psyntax.scm (put-global-definition-hook): Only set a variable if it's unbound. * module/ice-9/psyntax.scm: Regenerated. 2009-04-24 Andy Wingo more steps on the way to boot-time syncase * module/ice-9/boot-9.scm: Define a version of module-add! for psyntax, before modules are booted. * module/ice-9/psyntax.scm: Remove a warning, and rename a variable. Initialize a new variable to 'sc-macro, though it will have no effect. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-23 Andy Wingo I ain't broke, but brother I'm badly bent * module/ice-9/expand-support.scm (strip-expansion-structures): If, when producing @/@@ forms, we find that an @@ variable is not bound in its module, just serialize the symbol. This bends hygiene, in that it can introduce a global (but not lexical) reference in the expanded module, but it seems necessary to not produce (@@ (foo) else) in forms like ((@@ (foo) cond) ((test then) ((@@ (foo) else) bar))). 2009-04-22 Andy Wingo fix erroneous #:use-syntax clausen * module/system/repl/command.scm: * module/system/repl/common.scm: * module/system/repl/repl.scm: * module/system/vm/debug.scm: * module/system/vm/trace.scm: Change #:use-syntax to #:use-module, as that's really what we want to do. move pk, peek, and warn to the beginning of boot-9 * module/ice-9/boot-9.scm (peek, pk, warn): Move these helpers up to the top. I like them! (load-compiled): Don't define within an if, syncase doesn't like that. module-name before syncase is booted * module/ice-9/boot-9.scm (module-name): Give psyntax a module-name definition, even before psyntax is booted (in a future commit). 2009-04-21 Andy Wingo fix begin-deprecated * module/ice-9/boot-9.scm (begin-deprecated): Fix to output source code, doh. tweaks to boot-9 * module/ice-9/boot-9.scm: Move the r4rs init up to the top. (try-module-autoload): Don't use with-fluids before it's defined. allow eval to be called before modules are booted * libguile/eval.c (scm_eval): If the module system isn't booted, assert not on the module argument. commit some tweaks to expand.scm, likely obviated by syncase though * module/language/scheme/expand.scm (re-annotate, expand): A couple of speculative cases for dealing with syncase better -- but all of this code is likely to go. scm_[current_]module_transformer returns the %pre-modules-transformer, if set * libguile/modules.c (scm_module_transformer) (scm_current_module_transformer): So, if the module system hasn't yet booted, take the current transformer from a variable named %pre-modules-transformer from the %pre-modules-obarray. This is a prequel to booting syncase early in boot-9. 2009-04-21 Andy Wingo make syncase aware of (set! (@ (foo) bar) baz) * module/ice-9/psyntax.scm (set!): Handle (set! (@ (foo ..) bar) val) inside syncase. Heh heh heh. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-21 Andy Wingo syncase knows about @ / @@ * module/ice-9/psyntax.scm (syntax-type): Handle a new type, module-ref. Like external-macro, it also has a procedure as a binding. (chi-expr): module-ref forms -- that is to say, (@ (foo ...) bar) -- as expressions they are global references, but with respect to a specific module. (@, @@): Define module-ref syntax handlers. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/syncase.scm: Mark as primitive syntax so we don't clobber their definitions. The reason I'm doing things like this is so as to support (set! (@@ ...) ...) sensibly, which will be the next patch. 2009-04-21 Andy Wingo distcheck fixen * examples/Makefile.am: Fix the installed guile-config invocation to set PKG_CONFIG_PATH. * meta/Makefile.am (EXTRA_DIST): Dist the bin_SCRIPTS. * meta/guile-config (pkg-config): Better error messages if pkg-config invocation fails. * meta/uninstalled-env.in (PATH): Now that guile-config and guile-tools are not generated, make it the srcdir/meta instead of the builddir. (Guile itself will be picked up from libguile.) 2009-04-20 Andy Wingo Merge branch 'syncase' 2009-04-20 Andy Wingo fix guile.m4 for sitedir change * meta/guile.m4 2009-04-20 Andy Wingo scripts take rest args * meta/guile-tools: Instead of fixing scripts I should have been fixing the script runner. * module/scripts/compile.scm: * module/scripts/snarf-guile-m4-docs.scm: Fix to take rest args. 2009-04-20 Andy Wingo some more build fixes for bugs that I introduced * meta/guile-1.8.pc.in: Include a pkgdatadir, which will map down to `guile-config info pkgdatadir', used in existing guile.m4 files. * meta/guile-config: Fix guile-config info varname. Facepalm. * meta/guile.m4: Make GUILE_SITE_DIR use the sitedir variable instead. Really it should use pkg-config directly, though. 2009-04-20 Andy Wingo fix build errors on fresh checkout * meta/guile-tools: We can't use srfi-1, because on a fresh checkout the srfi-1 shlib isn't built yet. Bummer. * meta/uninstalled-env.in: Fix up the DYLD lines for BSDen. * module/scripts/snart-guile-m4-docs.scm: Fix expected arguments. 2009-04-20 Andy Wingo fix m4->texi snarfage after the guile-tools change * doc/ref/Makefile.am: Fix to work after a make clean with the recent guile-tools changes. 2009-04-17 Andy Wingo no positions when reading psyntax-pp, validation in @/@@, cleanups * module/ice-9/syncase.scm (old-debug): Re-disable position recording when reading psyntax-pp. * libguile/eval.c (scm_m_at, scm_m_atat): More input validation. * libguile/debug.c (scm_procedure_module): Use scm_env_module. Remove extraneous docstring. 2009-04-17 Andy Wingo fix hygiene + modules + local macros * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (syntax-type): Look up the type of the car of a form relative to its module, if it is a syntax object. Fixes hygiene wrt modules and private macros. * module/ice-9/syncase.scm (sc-macro): Add a comment. * module/system/base/pmatch.scm: The big test case: just export pmatch, not ppat too. 2009-04-17 Andy Wingo fix handling of pre-modules errors in the vm * libguile/vm-i-system.c (toplevel-ref, toplevel-set): Correct situation whereby we would not throw when toplevel vars were unbound, before modules had booted. 2009-04-17 Andy Wingo @ and @@ as primitive macros * libguile/eval.h: * libguile/eval.c (error_unbound_variable, error_defined_variable): Move these prototypes up earlier. (scm_m_at, scm_m_atat): New functions, provide the @ and @@ functionality. Moved here from defmacros because they are "special", inasmuch as syncase doesn't really understand them in interpreted code. * module/ice-9/boot-9.scm (@, @@): Don't define as defmacros, as defmacros have to actually return source now. 2009-04-17 Andy Wingo hygienic compilation * module/language/scheme/compile-ghil.scm (lookup-transformer): Recognize macros as initial (@ ...) or (@@ ...) forms, enabling hygienic compilation. 2009-04-17 Andy Wingo houston, we have hygiene * module/ice-9/expand-support.scm (strip-expansion-structures): Enable @/@@ substitution. * module/ice-9/psyntax-pp.scm: Recompile. * module/ice-9/psyntax.scm: Since syntax objects are quotable, make the module field the module name, not the module itself. Scope the operand of global calls appropriately. Thread modules through syntax-dispatch destructuring. Houston, we have hygiene. * module/ice-9/syncase.scm: Adapt to module / module-name changes. 2009-04-17 Andy Wingo more work on modules and hygiene, not finished yet, alas. * module/ice-9/compile-psyntax.scm: No more expansion-eval-closure. * module/ice-9/expand-support.scm (strip-expansion-structures): Only @@ names whose module is not the current module. Actually @@ serialization is disabled for this commit, just to get this one in and keep things working. * module/ice-9/psyntax-pp.scm: Recompiled. * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook): Instead of going through that stupid getprop/putprop interface, let's just inline Guile-specific code here. (build-global-reference, build-global-assignment): Fix a bug where the module and public? were switched, which happily allowed things to compile. (We reintroduce a similar bug above in expand-support.) (lookup): Add a module argument. (global-extend): Adapt for put-global-definition-hook invocation. (syntax-type): Lookup with mod. Return mod even for lexicals and define-form -- why not. (chi-top, fluid-let-syntax, syntax, set!): Lookup with mod. Wrap with mod. * module/ice-9/syncase.scm (expansion-eval-closure) (current-eval-closure, env->eval-closure): OK! So the idea is: module hygiene is syncase's business, not ours. So lose the eval-closure fluid. Also, eval closures are so 1990s. (sc-macro): But, we have to take the module from the env, sadly. In the future this will be different. Remove the rest of the eval-closure bits. Enable source reporting, while we're debugging. * module/language/scheme/compile-ghil.scm (lookup-transformer): Adapt for eval closure fluid changes. 2009-04-17 Andy Wingo eval-closure-module, here hopefully not for long * libguile/modules.h: * libguile/modules.c (scm_eval_closure_module): Define a new-yet-deprecated accessor, to ease a transition. 2009-04-17 Andy Wingo thread the module through syntax-case's expansion * libguile/debug.h: * libguile/debug.c (scm_procedure_module): New procedure, returns the module that was current when the given procedure was defined. Used by syncase to scope free identifiers. * module/ice-9/psyntax-pp.scm: Recompiled. * module/ice-9/psyntax.scm: Thread the module through the syntax expansion. This is harder than it would appear because in many places the different components of syntax objects are destructured. * module/ice-9/syncase.scm (guile-macro): Adapt to new signature for syntax transformer functions. 2009-04-17 Andy Wingo finish bootstrap to syntax-objects with modules * module/ice-9/psyntax.scm: Now that we have gone through the intermediate step (in which both representations of syntax-object had to coexist), change all callers to make-syntax-object to pass the third argument, and restore the define-structure definition of syntax objects. * module/ice-9/psyntax-pp.scm: Recompile. 2009-04-17 Andy Wingo add modules to syntax objects (part 1, intermediate step) * module/ice-9/psyntax.scm (make-syntax-object): As an intermediate step to adding modules to syntax objects, replace the definition of syntax-object as a structure with an expanded-out definition that has (1) a constructor that takes 2 or 3 arguments, and (2) a predicate that works with vectors of length 3 or 4. I couldn't just redefine make-syntax-object, for example, because these are internal definitions, and we can't have duplicate bindings in a letrec. 2009-04-17 Andy Wingo serialize module information into syncase's output -- getting ready for hygiene * module/ice-9/Makefile.am: Replace annotate.scm with expand-support.scm. * module/ice-9/annotate.scm: Removed; subsumed into expand-support.scm. * module/ice-9/compile-psyntax.scm: Strip out expansion structures before writing to disk. * module/ice-9/expand-support.scm: New file. Provides annotation support, and other compound data types for use by the expander. Currently the only one that is used is the toplevel reference, , but we will record lexicals this way soon. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (build-global-reference) (build-global-assignment): Instead of expanding out global references as symbols, expand them as structures, with space to record the module that they should be scoped against. This is in anticipation of us actually threading the module info through the syntax transformation, so that we can get hygiene with respect to modules. * module/ice-9/syncase.scm: Replace eval-when. Since sc-expand will give us something that isn't Scheme because we put the structures in it, strip that info whenever we actually do need scheme. * module/language/scheme/compile-ghil.scm (lookup-transformer): Strip expansion structures here too. * module/language/scheme/expand.scm (language): Swap annotate for expand-support. But this file will die soon, I think. 2009-04-17 Andy Wingo fix a tricky GC bug in scm_c_make_subr * libguile/procs.c (scm_c_make_subr): Fix a really tricky bug!!! If scm_double_cell caused GC, the symbolic name wouldn't be marked. But the symptom wouldn't appear until you accessed that symbol much later, for example during tab completion / apropos grovelling. Not sure why we didn't see this earlier. 2009-04-17 Andy Wingo guile-tools is a scheme script that loads scheme modules * meta/guile-tools: Changed to be a scheme script. Instead of looking for executables in a "scripts dir", we just look for modules in (scripts), and load the modules directly. * module/Makefile.am: * module/scripts/: Move the scripts into module/ so they can be compiled. Rename scripts from `foo' to `foo.scm'. * libguile/Makefile.am: Invoke the snarf->texi code via guile-tools. * configure.in: * .gitignore: Update for changes. 2009-04-17 Andy Wingo fix a couple gc-related continuations bugs Thanks to Juhani Rantanen for the report. * libguile/continuations.c (scm_make_continuation): Delay making the smob until the data is fully initialized. Fixes a bug whereby a GC in scm_vm_capture_continuations would catch the us with an undefined continuation->vm_conts, leading to marking badness. * libguile/vm.c (vm_cont_free): Report the correct size to scm_gc_free. 2009-04-16 Andy Wingo support expression-by-expression compilation * module/language/ghil.scm (unparse-ghil): Fix unparsing of quasiquoted expressions. * module/language/ghil/spec.scm (join): Define a joiner for GHIL. * module/language/scheme/compile-ghil.scm (cenv-ghil-env): Expand the definition of a CENV so it can have an actual ghil-env, if available. (compile-ghil): Return the actual ghil env in the cenv. * module/system/base/compile.scm (compile-file): Rewrite. `output-file' is now a keyword argument, along with the new kwargs `env' and `from'. We now allow exceptions to propagate up, and instead of printing the output file to the console, we return a string corresponding to its location. (compile-and-load): Use read-and-compile. (compile-fold): Thread around the cenv as well. Return all three values. (find-language-joint, read-and-compile): New exciting helpers. The idea is that compiling a file should be semantically equivalent to compiling each expression in it, one by one. Compilation can have side effects, e.g. affecting the current language or the current reader. So what we do is find a point in the compilation path at which different expressions of a given language can be joined into one. Expressions from the source language are compiled to the joint language, then joined and compiled to the target. (compile): Just return the first value from compile-fold. * module/system/base/language.scm (language-joiner): New optional field. * scripts/compile: Rework for changes to compile-file. 2009-04-16 Andy Wingo compilation passes return third value: the continuation environment * module/system/base/compile.scm: Expect compile passes to produce three values, not two. The third is the "continuation environment", the environment that can be used to compile a subsequent expression from the same source language. For example, expansion-time side effects can set the current module, which would be reflected appropriately in the continuation environment. * module/language/assembly/compile-bytecode.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/compile-ghil.scm: * module/language/ghil/compile-glil.scm: * module/language/glil/spec.scm: * module/language/objcode/spec.scm: * module/language/scheme/compile-ghil.scm: * module/system/base/compile.scm: Update compile passes to return a continuation environment. 2009-04-06 Andy Wingo guile-config rebased on top of pkg-config * configure.in: * meta/Makefile.am (EXTRA_DIST): Remove guile-config.in bits. * meta/guile-config: Reimplement to work on top of pkg-config. This lets guile-config not be substed by configure. * meta/uninstalled-env.in: Remove the path to guile-config, belatedly. Set the pkg-config path correctly. 2009-04-05 Ludovic Courtès Avoid uses of deprecated forms in the VM code. Reported by Daniel Kraft . * libguile/frames.c, libguile/vm.c: Include , use `size_t' instead of `scm_sizet'. * libguile/objcodes.c, libguile/programs.c, libguile/vm-engine.c, libguile/vm-i-loader.c, libguile/vm-i-system.c: Use `scm_list_X ()' instead of the deprecated `SCM_LISTX ()'. 2009-04-05 daniel Make `--disable-deprecated' work. * configure.in (enable_deprecated): Set SCM_WARN_DEPRECATED_DEFAULT even when --disable-deprecated is passed. * libguile/deprecation.h: Declare deprecation-issuing methods even if SCM_ENABLE_DEPRECATED is not set. * libguile/deprecation.c: Ditto. (scm_init_deprecation): Include full body even for unset SCM_ENABLE_DEPRECATED. 2009-04-04 Jose A. Ortega Ruiz Improved handling of callers cache in (system xref). * We cache callees in each module, and keep a list of modified ('tainted') modules, which is used to reconstruct the callers database incrementally. * `procedure-callers' now returns an a-list, keyed by module name. 2009-04-04 Andy Wingo fix nondeterminism in vm-i-system.c * libguile/vm-i-system.c (br-if-eq, br-if-not-eq): Fix some nondeterminism caught by GCC 4.4. 2009-04-03 Andy Wingo no hard-coded stack limitations if the user has getrlimit * libguile/debug.c (init_stack_limit): Instead of "1 MB or 80% of rlimit, whichever is lower", just use 80% of the rlimit, if set. 2009-03-31 Andy Wingo add test case for load-extension bug, fix gdb-uninstalled-guile * test-suite/standalone/test-extensions: * test-suite/standalone/test-extensions-lib.c: * test-suite/standalone/Makefile.am: Add a test case for the load-extension bug. * meta/gdb-uninstalled-guile.in: Fix the path to include meta/. 2009-03-29 Andy Wingo Merge branch 'wingo' fix duplicates in procedure-callers * module/system/xref.scm (ensure-callers-db): OK! Since we can see the same variable twice, e.g. in different modules, keep a unified hash of seen vars and modules. Prevents duplicates in procedure-callers. fix spurious duplicates in procedure-callees and callers * module/system/xref.scm (program-callee-rev-vars): It's possible to get duplicates when combining callees of inner procedures, so ignore dups. Quadratic, boo. 2009-03-28 Andy Wingo bugfix: don't dynamic link if we found a registered extension * libguile/extensions.c (load_extension): Don't do dynamic linking if we actually did find an extension in the list. 2009-03-28 Andy Wingo frame, program, objcode, etc inits use load-extension * libguile/extensions.h: Define a scm_t_extension_init_func. * libguile/frames.c: * libguile/instructions.c: * libguile/objcodes.c: * libguile/programs.c: * libguile/vm.c: Register extension init funcs. Should play nicer with a static Guile, in addition to working on Darwin with non-default installation prefixes without munging DYLD_LIBRARY_PATH. * module/system/vm/frame.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: Use load-extension. 2009-03-28 Andy Wingo fix distcheck hopefully, by cleaning the vm-i-*.i files * libguile/Makefile.am (CLEANFILES): Clean vm-i-*.i. fix "linking" of guile-config * meta/guile-config.in: Adjust "linking"; @bindir@ doesn't get fully expanded. So instead use a shell trampoline. fix check for guile-tools running uninstalled * meta/guile-tools.in (mydir): Fix check for running uninstalled. 2009-03-27 Andy Wingo rely on getrlimit to DTRT, don't make stack calibration file * libguile/measure-hwm.scm: Remove. * .gitignore: Update for removal. * test-suite/standalone/test-fast-slot-ref.in: * test-suite/standalone/test-use-srfi.in: * am/guilec: * check-guile.in: Revert back to normal guile invocation. * libguile/Makefile.am: Don't make a stack calibration file, as the getrlimit-based limit setting should work fine. 2009-03-27 Andy Wingo getrlimit-based stack limits * libguile/debug.c (init_stack_limit): Initialize the stack limit based on operating system limits (via getrlimit(2)), or 1 MB -- whichever is smaller. 2009-03-27 Andy Wingo add getrlimit and setrlimit wrappers * README: Some rewording. * configure.in: Check for getrlimit and setrlimit. * libguile/posix.h: * libguile/posix.c: Add some getrlimit and setrlimit wrappers. They're documented, but I suspect something else has to be done to get them into the manual. 2009-03-27 Andy Wingo allow building against uninstalled guile; move some things to meta/ * README: Add more info about building against an uninstalled Guile. * meta/: New directory. The proximate cause of its creation is that I want to be able to build external packages against uninstalled Guile, and to do that I need guile-tools in the PATH, but I don't want $top_builddir/libtool in the path. But it seems like a good reorganization, for things that are /about/ Guile: pkg-config files, m4 files, guile-config... then we also include uninstalled info: the environment, the pre-inst-guile script, etc. * meta/guile-1.8-uninstalled.pc.in: New pkg-config template. pkg-config prefers -uninstalled pkg-config files, if they are in its path. * meta/Makefile.am: * meta/ChangeLog-2008: * meta/gdb-uninstalled-guile.in: * meta/guile-1.8.pc.in: * meta/guile-config.in: * meta/guile.m4: * meta/guile-tools.in: Moved to meta/. * meta/guile.in: This is the new name of pre-inst-guile.in. * meta/uninstalled-env.in: And this, pre-inst-guile-env.in. * Makefile.am: * am/guilec: * am/pre-inst-guile: * check-guile.in: * configure.in: * doc/ref/Makefile.am: * gc-benchmarks/run-benchmark.scm: * test-suite/standalone/Makefile.am: * test-suite/standalone/README: * testsuite/Makefile.am: Adapt to meta/ change. 2009-03-27 Ludovic Courtès Improve wording in `libguile/Makefile.am' regarding stack calibration. * libguile/Makefile.am (stack-limit-calibration.scm): Improve wording of the comment. Suggested by Neil Jerram. 2009-03-26 Ludovic Courtès Run the stack calibration script before running the compiler. * am/guilec (.scm.go): Use `pre-inst-guile' and load `stack-limit-calibration.scm'. This is particularly useful when building the first `.go' files where the compiler is run using the interpreter, which may end up using a lot of stack space. * libguile/Makefile.am (BUILT_SOURCES): Add `stack-limit-calibration.scm'. (TESTS, TESTS_ENVIRONMENT): Remove. (stack-limit-calibration.scm): Prepend `-' so that any errors during the calibration are ignored. 2009-03-26 Ludovic Courtès Remove multiple definition of `scm_i_marking'. * libguile/private-gc.h (scm_i_marking): Turn definition into a declaration. (scm_mark_all): Mark as `SCM_INTERNAL'. * libguile/gc-mark.c (scm_i_marking): New definition. 2009-03-25 Ludovic Courtès Fix `testsuite/Makefile.am' for `distcheck'. * testsuite/Makefile.am (check_SCRIPTS): Remove, renamed to `TESTS'. (EXTRA_DIST): Add $(TESTS). 2009-03-24 Ludovic Courtès Aggregate `Makefile.am' files under `examples/'. * configure.in: Don't produce `examples/*/Makefile'. * examples/Makefile.am (SUBDIRS): Remove. (EXTRA_DIST, AM_CFLAGS, AM_LIBS): New. (box/box, box/box.o, box-module/box, box-module/box.o, libbox.la, box-dynamic/box.lo, libbox-module.la, box-dynamic-module/box.lo, installcheck, CLEANFILES, clean-local): New targets, aggregated from `Makefile.am' files formerly in sub-directories. * examples/check.test: New file, aggregated from `check.test' files in sub-directories. 2009-03-24 Ludovic Courtès Include in `gsubr.c'. * libguile/gsubr.c: Include . Reported by Carlo Bramini . 2009-03-22 Ludovic Courtès Remove unneeded SMOB mark procedure in `i18n.c'. * libguile/i18n.c (smob_locale_mark): Remove. (scm_init_i18n): Remove `scm_set_smob_mark ()' call. 2009-03-22 Ludovic Courtès Remove references to `scm_in_heap_p ()'. * libguile/gc.c (scm_i_expensive_validation_check): Don't call `scm_in_heap_p ()'. Cells don't necessarily live in the heap nowadays. * libguile/gc.h (scm_in_heap_p): Remove declaration. 2009-03-22 Ludovic Courtès Remove unneeded VM SMOB mark/free procedures. * libguile/vm.c (vm_mark_stack, vm_cont_mark, vm_cont_free, vm_mark, vm_free): Remove. (scm_bootstrap_vm): Remove corresponding `scm_set_smob_mark ()' and `scm_set_smob_free ()' calls. * libguile/frames.c (vm_frame_mark, vm_frame_free): Remove. (scm_bootstrap_frames): Remove `scm_set_smob_mark ()' and `scm_set_smob_free ()' calls. * libguile/objcodes.c (objcode_mark): Remove. (scm_bootstrap_objcodes): Remove call to `scm_set_smob_mark ()'. * libguile/programs.c (program_mark): Remove. (scm_bootstrap_programs): Remove call to `scm_set_smob_mark ()'. 2009-03-22 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/continuations.c libguile/gc-freelist.c libguile/gc-mark.c libguile/symbols.c libguile/threads.c module/ice-9/boot-9.scm 2009-03-20 Andy Wingo speed up goops rehashing * module/oop/goops/dispatch.scm (cache-try-hash!): Speed up goops rehashing, in theory. I haven't measured, though. fix interpreted methods with empty bodies * module/oop/goops.scm (method): If a method has no body, subst in `(if #f #f)' instead of `(begin)', to please the memoizer. add generic method-formals; fixes to method-source * module/oop/goops.scm (method-source): Don't throw an error if this method has no source. (method-formals): New generic function, the complement of method-specializers for introspection. fix casts to unsigned long in objcodes.c * libguile/objcodes.c (scm_c_make_objcode_slice): Fix casts to unsigned long. 2009-03-19 Ludovic Courtès Have `scm_take_locale_symbol ()' return an interned symbol (fixes bug #25865). * libguile/symbols.c (intern_symbol): New function, with code formerly duplicated in `scm_i_c_mem2symbol ()' and `scm_i_mem2symbol ()'. (scm_i_c_mem2symbol, scm_i_mem2symbol): Use it. (scm_take_locale_symboln): Use `intern_symbol ()'. This fixes bug #25865. * test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_SOURCES, test_scm_take_locale_symbol_CFLAGS, test_scm_take_locale_symbol_LDADD): New variables. (check_PROGRAMS, TESTS): Add `test-scm-take-locale-symbol'. 2009-03-18 Andy Wingo rework procedure-callers to stay correct as callees are redefined * module/system/xref.scm (procedure-callers): Rework to calculate the callers of a *variable*, not of a value. This is because the module-observers only get fired when the module changes, not with the variables change values. Also accept either a variable, a symbol (resolved in the current module), or a modname . symname pair. doubly-weak callers db * module/system/xref.scm (ensure-callers-db): Store the callers db as a doubly-weak hash table. 2009-03-18 Andy Wingo implement procedure-callers * module/system/xref.scm: Implement procedure-callers, as the inverse of procedure-callees, with a cache invalidated by changes in modules. * module/ice-9/boot-9.scm (module-use!): Don't poke module observers when module-use! is called for an already-used module. 2009-03-17 Andy Wingo add xref stub for interpreted procedures * module/system/xref.scm (hacky-procedure-callees): Add a procedure-callees implementation for procedures with source, that currently does nothing. Not sure what to do, going into the future. 2009-03-17 Andy Wingo add xref.scm * module/system/xref.scm: New module, will provide callers/callees info. * module/Makefile.am (SOURCES): Add xref.scm. 2009-03-17 Andy Wingo tweaks to the un-integrated test cases * testsuite/Makefile.am: Sortof turn these VM tests into more automake-like tests. Needs further work. 2009-03-17 Andy Wingo non-srcdir build fixes * guile-tools.in: Fix the checks to account for non-srcdir builds. * libguile/frames.c: * libguile/objcodes.c: * libguile/programs.c: * libguile/instructions.c: * libguile/vm.c: Fix snarf-includes to cope with non-srcdir builds. * libguile/instructions.h: * libguile/instructions.c: Fix the stubs inclusion to be non-srcdir compatible. * libguile/vm-expand.h (VM_DEFINE_INSTRUCTION): Fix some things so as not to require the instructions.h defintitions, since we have the codes already. Not important tho :) * pre-inst-guile-env.in: Minor tweak that should have no effect. * test-suite/standalone/Makefile.am (all-local): Remove a chmod +x step, the configure.ac rule should do that if necessary. 2009-03-17 Andy Wingo try a new way of checking byte order decompile source info into annotations. * module/language/glil/decompile-assembly.scm (decompile-load-program): Decompile source information into annotations. fix bug serializing filenames in source locations * module/language/glil/compile-assembly.scm (limn-sources): Fix bug whereby filename was serialized as a ("foo") instead of "foo". 2009-03-17 Andy Wingo tweaks to asm->glil decompiler, perhaps fix a (program-source p 0) bug * module/language/ghil/compile-glil.scm (codegen): Push a program's source locations before copying external args to heap -- perhaps fixes (program-source p 0) for some programs. * module/language/glil/decompile-assembly.scm (decompile-load-program): Take another arg, the object vector. Emit and correctly. Properly unparse properties. Just have to deal with source locations now. 2009-03-17 Andy Wingo add assembly->glil decompiler * module/language/glil/decompile-assembly.scm: A first pass at an assembly->glil decompiler. Works for a small subset of programs. * module/Makefile.am (GLIL_LANG_SOURCES): * module/language/glil/spec.scm (glil): Add the decompiler. 2009-03-17 Andy Wingo update disassembler for changes to decompiler * module/language/assembly/disassemble.scm (disassemble-load-program) (code-annotation): And update the disassembler for changes to decompiler. parse jumps as labels when decompiling bytecode->assembly * module/language/assembly/decompile-bytecode.scm (decode-load-program): Parse out jumps as labels. procedure-arity on vm-compile apply: verily, unresolved. * test-suite/tests/procprop.test ("procedure-arity"): Procedure-property 'arity on "apply" will fail if "apply" is a program. I suggest that procedure-property is actually the wrong interface for this; if we even want to preseve the old arity forms, we should have an accessor for arity directly that the VM can implement. But in the meantime throw this nasty error while we decide. 2009-03-17 Andy Wingo Merge commit 'cb9d473112ac172a3d328bb029b5b550918d4262' into vm-check 2009-03-17 Andy Wingo Merge commit 'e20d7001c3f7150400169fecb0bf0eefdf122fe2' into vm-check Conflicts: libguile/stacks.c 2009-03-17 Andy Wingo fix marking of double-cell subrs * libguile/gc-mark.c (scm_gc_mark_dependencies): Mark the name, generic, and properties of subrs. Merge commit 'e092357058850a6f998bf462bdc5504c6379c96f' into vm-check Merge commit 'feccd2d3100fd2964d4c2df58ab3da7ce4949a66' into vm-check Merge commit 'cce8b2ce93703aff953750fb40cb53176ea66504' into vm-check Merge commit '4c9e29ec38350a5206aa3e8e72ad4376512ada2b' into vm-check Merge commit 'ad5f5ada1d50ecdab634d60ffe3a13b9193156aa' into vm-check Merge commit '95a040cd2be7ad03bf197edbdb1fec2c52749ef6' into vm-check Merge commit '6290d3f10927f887102a164ccb1a7291cc62288d' into vm-check Merge commit '5bb2d903b9e54fdd5858a16ba11fa91a9dc0c692' into vm-check Merge commit '04795a1cb259c20896fb2edb50c58086027281b0' into vm-check Merge commit '202271f291971cf14175f5a1a193955f72d43d79' into vm-check Merge commit 'c010924a71f942100dc7b4021d5ef1c6decf9c85' into vm-check 2009-03-17 Andy Wingo Merge commit '53d81399bef1d9396665e79fb6b9c25eb8e2a6ad' into vm-check Also cherry-picks the changes from 1405f1b60fa178303484cd428068ecd01ff6d322 Conflicts: module/ice-9/session.scm 2009-03-17 Andy Wingo Merge commit 'ab878b0f8e675a741a7dd56f52638a7cc0419907' into vm-check Merge commit 'cbee5075d69cb057c4af4c5e24319da90367897f' into vm-check Merge commit '32a2609de06af65341e6b4db6961557b788821e8' into vm-check Merge commit 'e95d11110b7af0f528404d28209c3a464ab7074d' into vm-check 2009-03-17 Andy Wingo Merge commit '752be95a475132506c35922d284884cf776149d0' into vm-check Conflicts: INSTALL 2009-03-17 Andy Wingo Merge commit '8b0174c879bf74981efe702a00471ed5b8e6912e' into vm-check 2009-03-17 Andy Wingo revert annotation support in syncase. another day perhaps. * module/ice-9/syncase.scm: Revert support for annotations, as I'm seeing wierd problems whereby syntax-object->datum does not fully strip its input. 2009-03-16 Ludovic Courtès Allow the static allocation of all types of subrs. This is a follow-up to 46f9baf49a8ea4461e8494c75a88b87d0f5c5195 ("Allow the static initialization of subrs.") and e20d7001c3f7150400169fecb0bf0eefdf122fe2 ("Remove "compiled closures" ("cclos") in favor of a simpler mechanism."). * libguile/procs.h (SCM_SUBR_ARITY_TO_TYPE): Return the appropriate type for gsubrs instead of returning -1. * libguile/Makefile.am (snarf-gsubr.h): Remove target. (BUILT_SOURCES, nodist_modinclude_HEADERS, MOSTLYCLEANFILES): Remove `snarf-gsubr.h'. * libguile/snarf.h (SCM_DEFINE)[SCM_SUPPORT_STATIC_ALLOCATION]: Don't include "libguile/snarf-gsubr.h". (SCM_DEFINE_SUBR_reqX_optY_rstZ): Remove. 2009-03-16 Ludovic Courtès Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc Conflicts: libguile/procs.h 2009-03-09 Ludovic Courtès Update `NEWS'. 2009-03-08 Andy Wingo Fix errors when stripping annotations * module/ice-9/annotate.scm (set-annotation-stripped!): Fix prototype to correspond to what syncase needs. * module/ice-9/psyntax.scm (strip-annotation): Use `if', not `when', for portability. * module/ice-9/psyntax-pp.scm: Regenerate. 2009-03-08 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/gc-card.c libguile/gc-mark.c Aggregate `Makefile.am' files under `lang/'. * lang/Makefile.am (SUBDIRS): Remove. (elisp_sources): Aggregate the value of `elisp_SOURCES' formerly found in sub-directories' `Makefile.am'. Move `guardians.test' to its own module. * test-suite/tests/guardians.test: Add `define-module' clause. 2009-03-08 Ludovic Courtès Provide a C vararg interface to gsubr invocation. * libguile/eval.i.c (CEVAL): Update calls to `scm_i_gsubr_apply ()' with a fixed number of arguments. Use `scm_i_gsubr_apply_list ()' for calls with a list of arguments of unknown length. (SCM_APPLY): Use `scm_i_gsubr_apply_list ()' instead of `scm_i_gsubr_apply ()'. * libguile/gsubr.c (gsubr_apply_raw): New. (scm_i_gsubr_apply): Change to take a C vararg list instead of a Scheme list. Use `gsubr_apply_raw ()'. (scm_i_gsubr_apply_list): Use `gsubr_apply_raw ()'. * libguile/gsubr.h (scm_i_gsubr_apply): Update prototype. (scm_i_gsubr_apply_list): New declaration. 2009-03-08 Ludovic Courtès Slightly simplify gsubr invocation in the evaluator. * libguile/eval.i.c (CEVAL): Remove the `cclon' label; replace jumps to `cclon' with `RETURN (scm_i_gsubr_apply (...))'. Add new subr invocation benchmarks. * benchmark-suite/benchmarks/subr.bm (hook1, hook3): New variables. ("subr invocation")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. ("subr application")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. 2009-03-06 Andy Wingo actually use syncase's source information tracking. rock! * module/ice-9/annotate.scm (deannotate/source-properties): Version of deannotate that sets source properties on the resulting expressions. * module/ice-9/syncase.scm (sc-macro, syncase): Annotate expressions before they go into syncase, and deannotate/source-properties when they come out. The upshot is that syncase now understands source information, yay! 2009-03-06 Andy Wingo modify psyntax so it produced annotated source if given annotated source * module/ice-9/psyntax.scm (build-annotated): New helper, used by the output constructors. (build-application, build-conditional, build-lexical-reference) (build-lexical-assignment, build-global-reference) (build-global-assignment, build-global-definition, build-lambda) (build-primref, build-data, build-sequence, build-let) (build-named-let, build-letrec, build-lexical-var): Use build-annotated, so we produce annotated source if we have source information. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-03-06 Andy Wingo support source-level annotations in syncase * module/ice-9/annotate.scm (): Slightly more concise printing. (annotate): Don't create annotations if we have no source info. * module/ice-9/psyntax.scm (annotation?): Remove this definition, as we now provide annotation support. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/syncase.scm: Use (ice-9 annotate). * module/language/scheme/expand.scm (eval-when): Define the eval-when transformer. 2009-03-06 Andy Wingo fix eval-when statements in boot-9 * module/ice-9/boot-9.scm: Fix a couple eval-when statements. 2009-03-06 Andy Wingo Replace eval-case with eval-when * module/ice-9/boot-9.scm (eval-when): Replace eval-case with eval-when. Eval-when is *much* simpler, and more expressive to boot. Perhaps in the future we'll get 'visit and 'revisit too. * module/ice-9/deprecated.scm (eval-case): Provide mostly-working deprecated version of eval-case. * module/ice-9/boot-9.scm (defmacro, define-macro): Relax condition: we can make defmacros that are not at the toplevel now. But in the future we should replace this implementation of defmacros with one written in syntax-case. (define-module, use-modules, use-syntax): Allow at non-toplevel. (define-public, defmacro-public, export, re-export): Don't evaluate at compile-time, I can't see how that helps things. Allow `export' and `re-export' at non-toplevel. * module/ice-9/getopt-long.scm: * module/ice-9/i18n.scm: * module/oop/goops.scm: * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: Switch to use eval-when, not eval-case. * module/language/scheme/compile-ghil.scm (eval-when): Replace eval-case transformer with eval-when transformer. Sooooo much simpler, and it will get better once we separate expansion from compilation. * module/language/scheme/expand.scm (quasiquote): Hm, expand quasiquote properly. Not hygienic. Syncase needed. (lambda): Handle internal defines with docstrings propertly. 2009-03-02 Andy Wingo fixups to expand.scm * module/language/scheme/expand.scm: Some changes to avoid unnecessary begins or empty lets, and properly handle internal defines (finally). 2009-03-02 Andy Wingo add separate expansion phase, to detwingle things a bit * module/language/scheme/expand.scm: New module, implements a separate expansion phase, not interleaved with compilation. * module/language/scheme/amatch.scm: Helper for expand.scm, it's pmatch with support for annotated source. * module/ice-9/Makefile.am (SOURCES): Add annotate.scm to build list -- early on because it will be used in the compiler. * module/ice-9/annotate.scm: Fix the printer, default to unstripped (whatever that is), and add a deannotator. * module/system/base/compile.scm (call-with-compile-error-catch): Fix for new representation of source locations. * module/Makefile.am (SCHEME_LANG_SOURCES): Add amatch and expand. 2009-03-02 Andy Wingo fix printer in struct docs * doc/ref/api-compound.texi (Vtables): Fix example printer. add annotation module * module/ice-9/annotate.scm: Add annotation module, for source location tracking with syncase, and for internal use in the compiler. 2009-03-02 Ludovic Courtès Mark `scm_gsubr_apply ()' as internal. * libguile/gsubr.h (scm_gsubr_apply): Renamed to... (scm_i_gsubr_apply): this. Marked as `SCM_INTERNAL'. Callers updated. 2009-03-02 Ludovic Courtès Remove "compiled closures" ("cclos") in favor of a simpler mechanism. The idea is to introduce `gsubrs' whose arity is encoded in their type (more precisely in the sizeof (void *) - 8 MSBs). This removes the indirection introduced by cclos and simplifies the code. * libguile/__scm.h (CCLO): Remove. * libguile/debug.c (scm_procedure_source, scm_procedure_environment): Remove references to `scm_tc7_cclo'. * libguile/eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2): Replace `scm_tc7_cclo' with `scm_tc7_gsubr'. * libguile/eval.i.c (CEVAL): Likewise. No longer make PROC the first argument. Directly invoke `scm_gsubr_apply ()' instead of jump to the `evap(N+1)' label or call to `SCM_APPLY ()'. * libguile/evalext.c (scm_self_evaluating_p): Remove reference to `scm_tc7_cclo'. * libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name): Likewise. * libguile/gc-mark.c (scm_gc_mark_dependencies): Likewise. * libguile/goops.c (scm_class_of): Likewise. * libguile/print.c (iprin1): Likewise. * libguile/gsubr.c (create_gsubr): Use `unsigned int's for REQ, OPT and RST. Use `scm_tc7_gsubr' instead of `scm_makcclo ()' in the default case. (scm_gsubr_apply): Remove calls to `SCM_GSUBR_PROC ()'. (scm_f_gsubr_apply): Remove. * libguile/gsubr.h (SCM_GSUBR_TYPE): New definition. (SCM_GSUBR_MAX): Changed to 33. (SCM_SET_GSUBR_TYPE, SCM_GSUBR_PROC, SCM_SET_GSUBR_PROC, scm_f_gsubr_apply): Remove. * libguile/procprop.c (scm_i_procedure_arity): Remove reference to `scm_tc7_cclo'; add proper handling of `scm_tc7_gsubr'. * libguile/procs.c (scm_makcclo, scm_make_cclo): Remove. (scm_procedure_p): Remove reference to `scm_tc7_cclo'. (scm_thunk_p): Likewise, plus add proper `scm_tc7_gsubr' handling. * libguile/procs.h (SCM_CCLO_LENGTH, SCM_MAKE_CCLO_TAG, SCM_SET_CCLO_LENGTH, SCM_CCLO_BASE, SCM_SET_CCLO_BASE, SCM_CCLO_REF, SCM_CCLO_SET, SCM_CCLO_SUBR, SCM_SET_CCLO_SUBR, scm_makcclo, scm_make_cclo): Remove. * libguile/stacks.c (read_frames): Remove reference to `scm_f_gsubr_apply'. * libguile/tags.h (scm_tc7_cclo): Remove. (scm_tc7_gsubr): New. (scm_tcs_subrs): Add `scm_tc7_gsubr'. 2009-03-02 Ludovic Courtès Change `scm_gsubr_apply ()' to take the gsubr as its first argument. * libguile/gsubr.c (scm_gsubr_apply): Make SELF the first argument instead of the first element of ARGS. * libguile/gsubr.h: Update. * libguile/eval.i.c (CEVAL): Update. 2009-03-02 Ludovic Courtès Add subr invocation benchmark. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `subr.bm'. 2009-02-28 Ludovic Courtès Move `guardians.test' to its own module. * test-suite/tests/guardians.test: Add `define-module' clause. Increase chances that `guardians.test' can be successfully run. * test-suite/tests/guardians.test: Document overall test sloppiness. ("g2-garbage saved"): Document failure. ("guarding independent objects")["guarding non-immediate", "guarding two non-immediates", "re-guarding non-immediates"]: Improve chances to remove references to the dying object left on the stack. ("guarding weakly referenced objects")["guarded weak vector element gets returned from guardian"]: Likewise. ("guarding weak containers")["element of guarded weak vector gets collected"]: Likewise. ("guarding objects more than once")["guarding twice in one guardian", "guarding twice in two guardians"]: Likewise. Add `DEBUG_GUARDIANS' macro for guardian finalization debugging. * libguile/guardians.c (finalize_guarded): Use `#ifdef DEBUG_GUARDIANS' instead of `#if 0'. Add " guardian for %p vanished\n" debugging statement. 2009-02-27 Andy Wingo make the ES compiler more readable via use of -> * module/language/ecmascript/compile-ghil.scm: Use -> to make the ES compiler more readable. Fix bugs in do, while, and for, whereby we were missing ->boolean calls. use -> macro in scheme->ghil compiler * module/language/scheme/compile-ghil.scm (->): New macro, makes GHIL generation a bit more palatable. Use it in all the transformers. 2009-02-27 Andy Wingo slight optimization in transform-record, note in optimize* * module/language/ghil/compile-glil.scm (optimize*): Add a note. * module/system/base/syntax.scm (transform-record): Access the common slots once at the beginning. Cuts down on the number of toplevel refs needed by the generated code. 2009-02-27 Andy Wingo introduce -> binding inside transform-record body expressions * module/system/base/syntax.scm (transform-record): Introduce a -> binding inside the body, that produces records of the same type. * module/language/ghil/compile-glil.scm (optimize*): Remove our ->ghil definition, as transform-record introduces a -> binding for us. Nice. 2009-02-27 Andy Wingo first stabs as s-expression-driven transformation of GHIL * module/language/ghil/compile-glil.scm (optimize*): Rewritten optimizer -- not yet in use, but it's closer to the code that I'd like to write. * module/system/base/syntax.scm (transform-record): New crazy macro, makes GHIL a little less painful to work with. 2009-02-27 Andy Wingo common slot accessors are procedures-with-setters * module/system/base/syntax.scm (define-type): Common slot accessors are also procedures-with-setters. 2009-02-27 Andy Wingo use common slots mechanism in ghil * module/system/base/syntax.scm (define-type): Fix getter for common slot. * module/language/ghil.scm (): Use the common slots mechanism. 2009-02-27 Andy Wingo define-type has #:common-slots * module/system/base/syntax.scm (define-type): Accept a #:common-slots argument, defining slots that are in all instances of this type. 2009-02-25 Andy Wingo fix variable not initialized spurious warnings * libguile/vm-i-system.c: Work around some spurious "variable not initialized" messages on Etch's gcc. don't crash etch's gcc * libguile/vm-engine.h: Don't allocate registers in registers if we're on Etch's GCC. 2009-02-25 Andy Wingo export procedure-arguments from ice-9 session * module/system/vm/program.scm (program-arguments): New function, used by procedure-arguments. * module/ice-9/session.scm (procedure-arguments): New exported function, returns an alist describing the given procedure. 2009-02-24 Ludovic Courtès Aggregate makefiles for `module/system' and `module/language'. * am/guilec (.scm.go): Create the target's directory, in case $(builddir) != $(srcdir). * configure.in: Don't output any makefile under `module/system' or `module/language'. * module/Makefile.am (SUBDIRS): Remove `language' and `system'. Add `.' to the front. (modpath, SOURCES, SCHEME_LANG_SOURCES, ECMASCRIPT_LANG_SOURCES, GHIL_LANG_SOURCES, GLIL_LANG_SOURCES, ASSEMBLY_LANG_SOURCES, BYTECODE_LANG_SOURCES, OBJCODE_LANG_SOURCES, VALUE_LANG_SOURCES): New variables, taken from former `Makefile.am' files in sub-directories. 2009-02-24 Andy Wingo unbork the repl * module/system/repl/repl.scm (meta-reader): Whoops, unbork the repl. in meta-reader, return directly if the peeked char is EOF * module/system/repl/repl.scm (meta-reader): If the (next-char #t) returns EOF, return that EOF directly, as it seems that with guile -q, the subsequent `read' actually waits for another C-d. Dunno why. use umask when making permissions on .go files * module/system/base/compile.scm (call-with-output-file/atomic): Temp files get created 0600. After we're done writing, chmod them to something in line with the user's umask. use nobase in am/guilec * am/guilec (nobase_mod_DATA): Use nobase_mod_DATA so we install to the correct dir for foo/bar.scm. 2009-02-22 Andy Wingo parse division vs regexps properly * module/language/ecmascript/tokenize.scm (make-tokenizer/1): Whoops, fix the cases in which we detect that division is valid. 2009-02-22 Andy Wingo compile for-in * module/language/ecmascript/base.scm (prop-keys): New method, returns the list of keys of props of this instance. * module/language/ecmascript/impl.scm: Refactor the global object into a special kind of module object. Provide a prop-keys implementation for module objects. * module/language/ecmascript/compile-ghil.scm (comp): Compile for-in. * module/language/ecmascript/impl.scm: Reshuffly things, and implement make-enumerator, a helper for use in for-in statements. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix parsing of for (var foo in bar) {}... 2009-02-22 Andy Wingo fix "for" compilation * module/language/ecmascript/compile-ghil.scm (comp): Whoops, fix `for' compilation. add scheme integration to js via `require' * module/language/ecmascript/impl.scm: Add , that wraps a module. Add js-require, a javascript-happy function that returns an object that wraps a Guile module. Bind it to `require' in the default environment. ecmascript tokens have source info * module/language/ecmascript/tokenize.scm: Attach source information to tokens. We have to enhance the lalr parser to actually let this information propagate through, though... throw SyntaxError on bad syntax * module/language/ecmascript/parse.scm (syntax-error): * module/language/ecmascript/tokenize.scm (syntax-error): Throw an error on bad syntax. 2009-02-22 Andy Wingo more arithmetic on non-numbers * module/language/ecmascript/compile-ghil.scm (comp): Convert to number on unary +. * module/language/ecmascript/impl.scm: Define -, *, /, <, <=, >=, > operations on non-numbers. 2009-02-22 Andy Wingo + for strings, global js object, new Foo() works * module/language/ecmascript/array.scm (*array-prototype*): Declare the constructor. * module/language/ecmascript/base.scm (pput, pdel): Remove some needless checks. (new): Move definition of new here, and use the constructor. * module/language/ecmascript/compile-ghil.scm (compile-ghil): Add a stub so that when we load a compiled JS program, we make sure the runtime has been booted. * module/language/ecmascript/function.scm (js-constructor): Export a js-constructor method instead of a new method. * module/language/ecmascript/impl.scm (): Define a new class for the global "this" object, wrapping bindings from the current module. (init-js-bindings!): Define the dozen or so global properties, in the current module. (+): Define addition operations for non-numbers. This is efficient because the generics are only dispatched if the fast-path fails. 2009-02-21 Andy Wingo compile ecmascript's parser. yay! instant load-time! * module/language/ghil/compile-glil.scm (codegen): If there are more than 255 arguments, make a list and use apply instead of calling directly. * module/language/Makefile.am: Now we can compile parse.scm. Yay! * module/language/scheme/compile-ghil.scm: Add a note. * module/language/ecmascript/compile-ghil.scm: Add a note. 2009-02-21 Andy Wingo be smarter about allocating local variables, reusing slots if possible * module/language/Makefile.am: OK, we can compile compile-ghil.scm now, thankfully. * module/language/ecmascript/compile-ghil.scm (ormatch): New macro, a wrapper around pmatch to avoid some of the more egregious non-tail recursiveness. (comp): Use ormatch. * module/language/ghil.scm (unparse-ghil): The body of bind and mv-bind is a single expression, not a list of expressions. * module/language/ghil/compile-glil.scm (codegen): Be more clever when allocating "local" variables -- if a variable goes out of scope, its index can be re-used later. * module/language/glil.scm (parse-glil, unparse-ghil): The "rest" of a mv-bind is a flag, not a list. The "ra" of an mv-call is a label, not a GLIL expression. * module/language/objcode/spec.scm (collapse-locals, decompile-value): When decompiling a value, process the bindings list differently. Comments in the code. * module/language/scheme/compile-ghil.scm (define-scheme-translator): Fix the generated error procedure. (let): Re-indent. (letrec): Re-indent. * module/system/base/syntax.scm (record-case): If the body of a clause is null, fill it with the unspecified value. 2009-02-21 Andy Wingo implement break and continue, work around overly recursive pmatch expansion * libguile/vm-i-system.c (goto/args): On a tail call to a different procedure, init the locals to valid scheme values. Shouldn't matter for well-compiled scheme, but inspecting uninitialized locals could give garbage, or badly-compiled code could cause a crash. * module/language/Makefile.am (NOCOMP_SOURCES): For the moment, don't compile compile-ghil.scm. I need to fix this. * module/language/ecmascript/compile-ghil.scm (load-toplevel): Sigh, and disable stack checking in the evaluator too. Grr. (comp): Implement (unnamed) break and continue. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix var statements in `for' -- though it still doesn't work. 2009-02-21 Ludovic Courtès Fix `.go' compilation for $(builddir) != $(srcdir). * am/guilec (.scm.go): Use "-o $@" to make sure the output file ends up in $(builddir). 2009-02-21 Ludovic Courtès Add `-o'/`--output' option to "guile-tools compile". * module/system/base/compile.scm (compile-file): Add optional OUTPUT-FILE argument. * scripts/compile (fail): New procedure. (%options): Add `-o'/`--output' option. (compile): Handle `-o'. 2009-02-21 Andy Wingo implement do, while, for * module/language/ecmascript/compile-ghil.scm (comp): Use ghil-bind when making temp vars, so that disassembly understands things. Implement do, while, and for. * module/language/ecmascript/parse.scm (parse-ecmascript): Some tweaks. * module/language/ecmascript/impl.scm (language): Export ->boolean. 2009-02-21 Andy Wingo implement more operations * module/language/ecmascript/base.scm: Implement some more robust property getters that convert strings to symbols. Implement has-property?. * module/language/ecmascript/compile-ghil.scm (comp): Implement lots more mathematical operators. We now do all expressions; on to statements. * module/language/ecmascript/impl.scm: Define some math helpers. They probably need to call ->number on some things. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix a typo. 2009-02-21 Andy Wingo clean up ++ and -- a little bit * module/language/ecmascript/compile-ghil.scm (comp): Define let1 and begin1 helpers. Use them in pre- and post- increment and decrement. 2009-02-21 Andy Wingo implement ++, --, new, delete, void, typeof * module/language/ecmascript/compile-ghil.scm (@impl): Implement with @implv. (comp): Implement ++ and -- (pre- and post-). Quite a pain. I'll be looking for ways to simplify this notation. Also implement new, delete, and void. * module/language/ecmascript/impl.scm: Implement typeof. 2009-02-21 Andy Wingo handle "this" in ecmascript * module/language/ecmascript/base.scm: * module/language/ecmascript/compile-ghil.scm: * module/language/ecmascript/impl.scm: * module/language/ecmascript/parse.scm: Compile "method calls" in such a way that "this" gets propagated correctly. implement more of the standard runtime * module/language/Makefile.am: * module/language/ecmascript/impl.scm: * module/language/ecmascript/array.scm: * module/language/ecmascript/base.scm: * module/language/ecmascript/function.scm: Split out the runtime into different files. Implement more of the spec's runtime. 2009-02-20 Ludovic Courtès Fix interpretation of `(ice-9 getopt-long)'. * module/ice-9/getopt-long.scm (define-one-option-spec-field-accessor, define-one-option-spec-field-modifier): Eval-case for `load-toplevel' as well so that the interpreter can load this module. Fix compilation of `(ice-9 getopt-long)'. * module/ice-9/getopt-long.scm (option-spec-fields): Enclose in a `(load-toplevel compile-toplevel)' `eval-case'. (define-one-option-spec-field-accessor, define-one-option-spec-field-modifier): Enclose in a `compile-toplevel'-only `eval-case'. Add `-L'/`--load-path' option to "guile-tools compile". * scripts/compile (%options): Add `-L'/`--load-path'. (parse-args): Have `load-path' default to '(). (compile): Handle `--load-path' option. Change "guile-tools compile" to use SRFI-37 to process options. * scripts/compile (%options): Rewrite in SRFI-37 style. (parse-args): New procedure. (compile): Update to SRFI-37. Make the `module-defer-observers-mutex' recursive. * module/ice-9/boot-9.scm (module-defer-observers-mutex): Made recursive. See http://lists.gnu.org/archive/html/guile-devel/2009-02/msg00068.html for an example where it matters. 2009-02-19 Andy Wingo support foo["bar"] in addition to foo.bar * module/language/ecmascript/parse.scm (parse-ecmascript): And update the function declaration forms for the new var syntax. * module/language/ecmascript/compile-ghil.scm (comp): Support foo["bar"] in addition to foo.bar. * module/language/ecmascript/impl.scm (pget, pput): Some fixes for when we get non-symbols -- it can happen, yo. I suppose we should allow for non-string keys too.. 2009-02-19 Andy Wingo implement object literals * module/language/ecmascript/impl.scm: * module/language/ecmascript/compile-ghil.scm (comp): Object literals. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix some object literal parsing. 2009-02-19 Andy Wingo var at toplevel works too * module/language/ecmascript/compile-ghil.scm (comp): Fix the var form at toplevel. 2009-02-19 Andy Wingo property gets and puts implemented, yays * module/language/ecmascript/compile-ghil.scm (@impl): Ok, don't recurse on args here. (comp): Implement property gets and puts and lexical assignment. (comp-body): Fix scanning of var forms. * module/language/ecmascript/impl.scm (prop-attrs): Allow for the prop attr array to be #f. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix assignment parsing. 2009-02-19 Andy Wingo add array support * module/language/ecmascript/compile-ghil.scm (@impl): Whoops, fix this macro. (comp): Handle array literals. * module/language/ecmascript/impl.scm: Add support for arrays. 2009-02-19 Andy Wingo further ecmascript work * libguile/vm-i-system.c (drop, return): Declare drop and return as popping one arg from the stack. * module/language/ghil/compile-glil.scm: * module/language/glil/compile-assembly.scm (make-meta): Adjust so that we declare 'drop and 'return calls as popping one arg from the stack. * module/language/ecmascript/compile-ghil.scm (comp, comp-body): Flesh out a bit more. Most significantly, scoping within functions obeys javascript semantics better, modulo bits about with() forms. * module/language/ecmascript/impl.scm: Define some runtime helper routines. * module/language/Makefile.am (SOURCES): Add impl.scm. * module/language/ecmascript/parse.scm (parse-ecmascript): Minor tweaks. * module/language/ecmascript/tokenize.scm (read-identifier): Identifiers now read as symbols, not strings. 2009-02-18 Andy Wingo add more ecmascript compilation -- functions work now * module/language/ecmascript/parse.scm (parse-ecmascript): Lambdas always just have one member in their bodies. * module/language/ecmascript/compile-ghil.scm (comp): Add some more silly compilers. 2009-02-18 Ludovic Courtès Add `load-unsigned-integer' instruction. * libguile/vm-i-loader.c (load_unsigned_integer): New loader. * module/language/assembly.scm (byte-length): Handle `load-unsigned-integer'. * module/language/assembly/compile-bytecode.scm (write-bytecode): Likewise. * module/language/glil/compile-assembly.scm (dump-object): Emit a `load-unsigned-integer' instruction for positive integers. This fixes loading of integers greater than 2^31 - 1. * testsuite/Makefile.am (vm_test_files): Add `t-literal-integers.scm'. * doc/ref/vm.texi (Loading Instructions): Add `load-unsigned-integer'. 2009-02-18 Andy Wingo world's stupidest ecmascript compiler * module/language/ecmascript/spec.scm: Add language spec for ecmascript. * module/language/ecmascript/compile-ghil.scm: Add a stupid compiler. * module/language/Makefile.am: Buildage. 2009-02-18 Andy Wingo add ecmascript parser * module/language/ecmascript/parse-lalr.scm: Add the Boucher/Bison lalr parser. This is from guile-lib, but with : changed to -> so as not to molest `prefix' keywords. Should probably be elsewhere. * module/language/ecmascript/parse.scm: Add parser for ECMAScript. Rules from the spec, 3rd edition. * module/language/ecmascript/tokenize.scm: Add ECMAScript tokenizer, hand-written. Neat stuff. * module/language/Makefile.am: Autofoo. 2009-02-17 Andy Wingo lengths written out in native endianness * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out the lengths that are mapped to struct scm_objcode using native endianness. 2009-02-17 Andy Wingo avoid deprecated functions in SCM_VALIDATE_VECTOR_LEN * libguile/validate.h (SCM_VALIDATE_VECTOR_LEN): Don't use deprecated functions. 2009-02-17 Ludovic Courtès Add tests for the stack inspection API. * test-suite/tests/eval.test (stack->frames): New procedure. ("stacks"): New test prefix. Add new GOOPS tests for built-in types. * test-suite/tests/goops.test ("classes for built-in types"): New test prefix. 2009-02-16 Ludovic Courtès Add test for `procedure-properties'. * test-suite/Makefile.am (SCM_TESTS): Add `tests/procprop.test'. 2009-02-14 Andy Wingo better alignment * module/language/assembly.scm (align-program): Whoops, align programs properly. * module/language/glil/compile-assembly.scm (compile-assembly): Start with addr=-1, for the unserialized load-program byte. (glil->assembly): Align programs in all cases. 2009-02-14 Ludovic Courtès Change `compiled-file-name' to preserve the input file's directory. * module/system/base/compile.scm (compiled-file-name): Prepend "(dirname file)" so that "guile-tools compile foo/bar.scm" produces "foo/bar.go", not "bar.go". 2009-02-14 Andy Wingo align programs on 8-byte boundaries * module/language/assembly.scm (addr+): New helper. (align-program): New function, aligns a (load-program) form, currently to 8-byte boundaries. * module/language/glil/compile-assembly.scm (): Record the object table and the program code separately, so that we can align the program after the object table has been written. (glil->assembly): Use addr+. (dump-object): Rework to fold `addr' through dumping of compound objects, so that procedures can be aligned properly. 2009-02-14 Andy Wingo re-enable assembly packing * module/language/glil/compile-assembly.scm (glil->assembly): Enable assembly packing, for e.g. (make-int8:0). 2009-02-14 Ludovic Courtès Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc Conflicts: .gitignore libguile/procs.h Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/gc-mark.c libguile/procs.c libguile/procs.h libguile/threads.c libguile/threads.h 2009-02-14 Andy Wingo a slight add-method speedup * module/oop/goops.scm (add-method-in-classes!): Use memq instead of memv. 2009-02-14 Andy Wingo generate the fixed-offset accessors at compile-time * module/language/scheme/compile-ghil.scm (define-scheme-translator): Only add an else clause if the transformer didn't have one. * module/oop/goops.scm (min-fixnum, max-fixnum): Define at compile-time as well. (@slot-ref, @slot-set!): Only define transformers for these at compile-time. Avoids loading up the compiler unnecessarily. Also, allow for the `n' to be determined lexically, in which case we dispatch to the primitive. (num-standard-pre-cache, define-standard-accessor-method) (bound-check-get, standard-get, standard-set): Rework the fixed-offset getters and setters so that they can be computed at compile-time. Accessors to fields with n > num-standard-pre-cache will be dispatched to the primitive instead of within the VM. 2009-02-13 Andy Wingo don't re-enter the compiler during method dispatch * libguile/goops.c (scm_make): In the pre-inst `make', default `procedure' to #f, and read a `make-procedure' instead of `compile-env'. * libguile/goops.h (scm_si_make_procedure): This instead of scm_si_compile_env. * module/oop/goops.scm (make-method): Remove this unused function. Users should use (make ...) directly. (method): Capture `make-procedure' instead of `procedure' in the case that the body calls a next-method. Allows for the kind of "recompilation" that we were using before, but with closures instead of re-entering the compiler. Type-specific compilation is still interesting, but probably should be implemented in another way. (initialize): Default #:procedure to #f, and s/compile-env/make-procedure/. * module/oop/goops/compile.scm (code-table-lookup): Just return the cmethod, not the entry -- since the entry is now just (append types cmethod). (compile-make-procedure): New procedure, returns a form that, when evaluated/compiled, will yield a procedure of one argument, the next-method. When called with a next-method, the procedure returns an actual method implementation. compile-make-procedure returns #f if the body doesn't call next-method. (compile-method): Unify to always return procedures. Much cleaner and *much* faster in the compiled case. In the interpreted case, there might be a slight slowdown, but if there is one it should be slight. * module/oop/goops/dispatch.scm (method-cache-install!): Adapt to removal of compute-entry-with-cmethod. 2009-02-13 Andy Wingo flush output when writing .go files * module/system/base/compile.scm (call-with-output-file/atomic): Close the port we are writing to before renaming it, so that we flush output. Might fix some 0-length write errors that Jao was seeing. inline record predicates into record-case * module/system/base/syntax.scm (record-case): Inline record predicates into the record-case. Shaves off a few more milliseconds from a GOOPS load. 2009-02-13 Andy Wingo no keyword arguments in GHIL / GLIL, just optional args -- faster compiles * module/system/base/syntax.scm (define-record): So, in the generated constructors, allow optional arguments, but not keyword arguments. Conses much less in the constructors. (define-record/keywords): And the old define-record is here. * module/language/ghil.scm (parse-ghil): * module/language/ghil/compile-glil.scm (codegen): * module/language/scheme/compile-ghil.scm (translate-1, quote) (quasiquote): Don't use keywords in this compiler hotpath. * module/system/base/language.scm (): * module/system/repl/common.scm (): * module/system/vm/debug.scm (): Use define-record/keywords. 2009-02-12 Ludovic Courtès Link with `-z relro' when available. * acinclude.m4 (GUILE_GNU_LD_RELRO): New macro. * configure.in: Use `GUILE_GNU_LD_RELRO'. 2009-02-12 Ludovic Courtès Update `NEWS'. Small cleanup relative to the use of double cells for subrs. * libguile/procs.c (scm_c_make_subr): Remove comments about the number of subrs, improve formatting. 2009-02-12 Ludovic Courtès Use double-cells to store subrs. * libguile/procs.c (scm_subr_table, scm_subr_table_size, scm_subr_table_room, subr_table_gc_hint, scm_init_subr_table, scm_mark_subr_table): Remove. (scm_c_make_subr): Simply return a double-cell, with the procedure name and properties stored in a two-element array. (scm_free_subr_entry): Free the meta-info slot. * libguile/init.c (scm_i_init_guile): Remove call to `scm_init_subr_table ()'. * libguile/procs.h (SCM_SUBR_META_INFO): New macro. (SCM_SNAME, SCM_SUBR_PROPS): Use it. (SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): Update. (scm_t_subr_entry, SCM_SUBR_ENTRY, SCM_SUBRNUM, scm_subr_table, scm_mark_subr_table, scm_init_subr_table): Remove. 2009-02-11 Ludovic Courtès Add `SCM_SET_SUBR_GENERIC ()' to replace `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/goops.c (scm_c_extend_primitive_generic): Use `SCM_SET_SUBR_GENERIC ()' instead of using `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/procs.c (scm_c_make_subr_with_generic): Use `SCM_SET_SUBR_GENERIC_LOC ()'. * libguile/procs.h (SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): New macros. 2009-02-11 Ludovic Courtès Use `SCM_SNAME ()' when requesting the name of a subr. * libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Use `SCM_SNAME ()' instead of `SCM_SUBR_ENTRY (subr).name'. * libguile/procs.c (scm_c_define_subr_with_generic, scm_makcclo): Likewise. (scm_c_make_subr_with_generic): Same with `SCM_SUBR_GENERIC ()'. 2009-02-11 Ludovic Courtès Small cleanup relative to the use of double cells for subrs. * libguile/procs.c (scm_c_make_subr): Remove comments about the number of subrs, improve formatting. * libguile/Makefile.am: Comment the generation of `snarf-gsubr.h'. 2009-02-11 Andy Wingo provide program apply_0, apply_1, apply_2 implementations * libguile/programs.c (program_apply_0, program_apply_1) (program_apply_2, scm_bootstrap_programs): Provides some cons-less smob application procedures. This molests some internal interfaces, but hey, we're internal. 2009-02-11 Andy Wingo speed up record-case * module/language/ghil.scm: Whoops, export some unquote-splicing accessors that we didn't have exported before. * module/system/base/syntax.scm: Speed up record-case, by syntactically determining the predicates and accessors. Nasty, in a way; but also much faster. 2009-02-10 Andy Wingo match bare literals with eq? in pmatch, not equal? * module/system/base/pmatch.scm (ppat): Match atoms with eq?, not equal?. This speeds up compilation considerably, as we never match against numbers or strings or what-have-you. Note, you can match against literals with equal? via quoting the literal in the pattern. 2009-02-10 Andy Wingo propagate much more source info through compilation * module/language/ghil/compile-glil.scm (codegen): Record source location for offset 0 into a lambda, if we can. * module/language/scheme/compile-ghil.scm (translate-1) (define-scheme-translator): In the retrans procedures, propagate the location information from the enclosing expression if the subexpression has no location information. Gives source information to many more expressions. (location): Just propagate the source properties as they are, the glil->assembly compiler will interpret them. * module/language/glil.scm (): Change glil-source to take "props" and not "loc", as it's the source properties that we're interested in. * module/language/glil/compile-assembly.scm (limn-sources): New function, takes a list of addr-source property pairs and "compresses" them for serialization to disk. (glil->assembly): Limn the sources before writing them to disk. Avoid non-tail recursion when determining total byte length of code. * module/system/vm/program.scm (source:file, source:line, source:column): Update for new source representation. (program-source): Export. (write-program): Nicer pretty-printing of anonymous procedures. * libguile/backtrace.c (display_backtrace_get_file_line): Update for the new VM source representation. * libguile/programs.h: * libguile/programs.c (scm_program_sources): Update for the new serialized source representation, where the filename is not in the stream unless it changes. (scm_program_source): New exported function, looks up the source for a given ip offset. (scm_c_program_source): Update to return the last source information that was <= the given IP, because we only serialize source info when it changes. 2009-02-09 Neil Jerram Merge branch 'master' into ossau-gds-dev Clean lib-version.texi * doc/ref/Makefile.am (CLEANFILES): Add lib-version.texi. 2009-02-09 Andy Wingo nicety in the compiler * module/language/scheme/compile-ghil.scm (lookup-transformer): Use @@. Delightfully metacircular. allow defmacros to unquote in macros into expanded expressions * module/language/scheme/compile-ghil.scm (lookup-transformer): Allow macros to be unquoted into the car of any form that results from macro expansion. This lets modules export defmacros built on other defmacros that are not exported. 2009-02-09 Andy Wingo minor cleanups * libguile/stacks.c (scm_make_stack): Instead of aborting when we misread the number of stack frames, just print a warning. I'd like to figure out what these cases are, exactly. * module/language/scheme/compile-ghil.scm (lambda): Reindent the lambda transformer. * module/system/base/compile.scm (call-with-compile-error-catch): Write the expression instead of displaying it. (call-with-output-file/atomic): Don't actually redirect output to this port, as it's not necessary -- the language-printer should respect the port that we pass. 2009-02-08 Neil Jerram Merge branch 'master' into ossau-gds-dev 2009-02-08 Neil Jerram Allow @ to work with (ice-9 syncase) (Reported by Panicz Maciej Godek.) * test-suite/tests/syncase.test ("@ works with syncase"): New test. * ice-9/syncase.scm (guile-macro): When a Guile macro transformer produces a variable, don't pass it through sc-expand. 2009-02-08 Neil Jerram Fix build when compiled with -Wundef -Werror (Reported by David Fang) * libguile/inline.h: Check if __APPLE_CC__ is defined before testing its value. 2009-02-05 Andy Wingo fix the ping-pong between evaluator and vm stacks in make-stack * libguile/frames.c (vm_frame_print): Add a frame printer. * libguile/stacks.c (stack_depth, read_frames): Only switch the VM stack for boot program dframes. * libguile/vm-engine.c (VM_NAME): Push one debug frame per invocation, unconditionally. (If we push them at all, of course.) 2009-02-05 Andy Wingo fix boot program detection, which in turn makes `make-stack' actually work * libguile/programs.h (SCM_F_PROGRAM_IS_BOOT, SCM_PROGRAM_IS_BOOT): Flags for determining if a program is a boot program. It turns out that our heuristics e.g. in stacks.c would catch non-boot programs, like programs that end with (goto/args 1), because the 1 is the same byte as `halt'. That took a while to find... * libguile/stacks.c (stack_depth, read_frames): Use the new boot prog macros. (scm_make_stack): Assert that we read the number of frames that we said we would. * libguile/vm.c (really_make_boot_program): Mark boot programs appropriately. 2009-02-05 Andy Wingo in debug mode, make sure that calls to the vm can be captured via make-stack * libguile/vm-engine.c (VM_PUSH_DEBUG_FRAMES): New knob, if true we much with the scm_i_last_debug_frame when entering the VM, because sometimes the evaluator doesn't do it for us. (VM_ENGINE): Plug through debug frame fondling. Now, program exit comes back to the main text. Rename err_args to finish_args, and reuse for the return value. * libguile/vm-engine.h (PUSH_LIST): * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Update for finish_args. (halt): goto vm_done, now, instead of returning directly. 2009-02-05 Andy Wingo scm_call_N doesn't cons for calling programs * libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3) (scm_call_4): Special-case compiled procedures here, to avoid consing. * libguile/vm.h: * libguile/vm.c (scm_c_vm_run): Take a SCM after all. (scm_vm_apply, scm_load_compiled_with_vm): Adapt to vm_run change. 2009-02-05 Andy Wingo use append-map in goops * module/oop/goops.scm (ensure-metaclass, make-extended-generic): Some minor optimizations to use append-map. 2009-02-05 Andy Wingo inline call to scm_make_program when making closures * libguile/programs.c (scm_make_program): Add a comment. * libguile/vm-engine.h (INIT_ARGS): Add a couple of UNLIKELY notes. * libguile/vm-i-system.c (make-closure): Inline the call to scm_make_program, which avoids some redundant checks. 2009-02-04 Andy Wingo enable multiple vm engines (regular, debug, ...) * libguile/vm-engine.c (VM_USE_HOOKS, VM_USE_CLOCK, VM_CHECK_EXTERNAL) (VM_CHECK_OBJECT): Update to define these here, before including vm-engine.h. (vm_run): Change so that we can make different engines. Also, we take an array of arguments, and the struct scm_vm directly, so as to avoid any need to cons. * libguile/vm-engine.h (CHECK_EXTERNAL, CHECK_OBJECT): Add some UNLIKELY bits; don't seem to help. * libguile/vm.c (vm_dispatch_hook): Change to not pass the VP. This needs some love, and perhaps we revert to the old way. (VM_ENGINE): Actually make two engines, vm_regular_engine and vm_debug_engine. Probably there is room for improvement here. Actually their speeds are the same at the moment. (make_vm): Choose which engine to run; currently the debug engine by default. (scm_c_vm_run): A thin wrapper to invoke a VM without consing. (scm_vm_apply): Use scm_c_vm_run. (scm_load_compiled_with_vm): Use scm_c_vm_run. 2009-02-04 Andy Wingo "optimize" dispatch to specific GF's in goops * libguile/goops.c: Some micro-optimizations so that calling generic functions as part of the protocol doesn't cons. 2009-02-04 Andy Wingo make catch cache and restore vm regs, not the vm itself -- speedy speedy * libguile/throw.c (scm_c_catch): Stash away the current vm's regs, and restore them if there's a nonlocal exit. There is a terrible case we have to handle if we catch from when the vm smob type isn't registered but the throw has the vm registered, but I think we handle this fine. * libguile/vm-engine.c (vm_run): * libguile/vm-i-system.c (halt): Don't make a dynwind context, so that entering the VM doesn't cons at all, except for the arg list. Maybe we can fix that bit too. * libguile/vm.c (vm_reset_stack): Remove, as there is no more dynwind. (make_vm): Return #f if the tc16 hasn't yet been registered. 2009-02-03 Andy Wingo make symbol -> opcode lookup faster * libguile/instructions.c (fetch_instruction_table) (scm_lookup_instruction_by_name): Rework so we lazily load instructions into an array keyed by opcode, and a hash table keyed by symbolic name. Much faster, in this hot spot of compilation. * libguile/vm-engine.c (vm_run): Use malloc instead of scm_gc_malloc, given that we aren't ever going to free this thing. * libguile/vm-expand.h (VM_DEFINE_FUNCTION, VM_DEFINE_LOADER): Rework to always be aliases to VM_DEFINE_INSTRUCTION. (VM_DEFINE_INSTRUCTION): In the table case, update to work with fetch_instruction_table(). 2009-02-03 Andy Wingo inline dispatch to program cmethods, tick in return, remove old goops methods * libguile/objects.c (scm_apply_generic): Inline the case when the generic is a program. * libguile/vm-i-system.c (return): Tick when functions return. * module/oop/goops.scm (object-eqv?, object-equal?): Remove these historical methods. 2009-02-03 Ludovic Courtès GOOPS: Statically allocate the PORT class array. * libguile/goops.c (scm_port_class): Statically allocate it. (create_port_classes): Don't use `scm_calloc ()'. * libguile/goops.h (scm_port_class): Update declaration. * libguile/ports.c (scm_make_port_type): When checking whether GOOPS is initialized, check whether the first element of SCM_PORT_CLASS is non-zero. 2009-02-03 Ludovic Courtès Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'. * libguile/goops.c (create_port_classes): Use `SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256. * libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX): Likewise. * libguile/ports.c (scm_make_port_type): Likewise. * libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro. 2009-02-03 Ludovic Courtès GOOPS: Statically allocate the SMOB class array. * libguile/goops.c (scm_smob_class): Statically allocate it. (create_smob_classes): Don't malloc(3) `scm_smob_class'. * libguile/goops.h (scm_smob_class): Update declaration. * libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When checking whether GOOPS is initialized, check whether the first element of SCM_SMOB_CLASS is non-zero. 2009-02-03 Ludovic Courtès Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/goops.c (create_smob_classes): Refer to `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256. * libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro. 2009-02-02 Andy Wingo Name anonymous let- or letrec-bound procedures * module/language/scheme/compile-ghil.scm (let, letrec): Give names to procedures of the form (let ((foo (lambda ....)))). 2009-02-02 Andy Wingo tick in calls, procedure-name works on compiled procedures * module/system/vm/program.scm: * libguile/programs.h: * libguile/programs.c (scm_program_bindings, scm_program_bindings) (scm_program_properties, scm_program_name): Unfortunately, implement more procs in C, so that C can use them more easily. * libguile/debug.c (scm_procedure_name): Dispatch to scm_program_name as appropriate. * libguile/vm-i-system.c (call): Tick in a call. 2009-02-02 Julian Graham Update SRFI-11 docs to use correct name for let*-values. 2009-02-01 Ludovic Courtès Use `GC_base ()' to determine whether a pointer points to the heap. * libguile/boehm-gc.h (SCM_I_IS_POINTER_TO_THE_HEAP): Use `GC_base ()' instead of `GC_{least,greatest}_plausible_heap addr' since the GC does not assume that the heap is contiguous (suggested by Ivan Maidanski and Hans Boehm). 2009-02-01 Andy Wingo fix the disassembler for load-string, load-symbol et al * module/language/assembly/decompile-bytecode.scm (decode-bytecode): Fix decoding of lengths in loader instructions. no disasm in measure.scm * benchmark/measure.scm: Don't use (system vm disasm). don't make intermediate garbage when making vectors in the vm * libguile/vm-i-system.c (vector): Don't cons up a list just to make a vector. Saves a couple percent in total cell allocation when loading syncase. Probably not worth it, but foo! 2009-02-01 Andy Wingo avoid 8 words of allocation per lambda, whoooo * libguile/objcodes.c (scm_bytecode_to_objcode): Check that the length of the vector matches the length embedded in the bytecode. * libguile/programs.c (scm_program_meta): Call through to scm_objcode_meta, instead of looking in the object table. Avoids consing up a program+objcode slice for the meta until the meta is actually called. * libguile/vm-i-loader.c (load-program): Step past the metadata too. * module/language/glil/compile-assembly.scm (make-meta): Just return the load-program form, or #f. (assoc-ref-or-acons, object-index-and-alist, make-object-table): Don't write the meta into the object table. (glil->assembly): Instead write the meta into the load-program form. 2009-02-01 Andy Wingo add code for writing out metadata to the end of a program * libguile/objcodes.c (make_objcode_by_mmap, scm_c_make_objcode_slice): Verify the lengths with the meta-length. (scm_objcode_meta): New procedure, for getting at the meta-info of an objcode. (scm_objcode_to_bytecode): (scm_write_objcode): Write bytecode with the metadata too. * module/system/vm/objcode.scm: Export object-meta. * module/language/assembly.scm (byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): * module/language/glil/compile-assembly.scm (glil->assembly): * test-suite/tests/asm-to-bytecode.test ("compiler"): Change to load-program format to have meta-or-#f instead of meta-length, so that we can serialize the meta as objcode without a load-program byte. Add a test for writing out the meta. 2009-02-01 Andy Wingo add metalen field to bytecode serialization * libguile/objcodes.h (struct scm_objcode): Add a new field, metalen, in preparation for embedding metadata within a program. (SCM_OBJCODE_META_LEN, SCM_OBJCODE_TOTAL_LEN): New defines. * libguile/vm.c (really_make_boot_program): * module/language/assembly.scm (*program-header-len*, byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): * module/language/glil/compile-assembly.scm (glil->assembly): * test-suite/tests/asm-to-bytecode.test ("compiler"): Update for metalen addition. 2009-02-01 Ludovic Courtès Fix invalid writes to read-only stringbufs. * libguile/strings.c (SET_STRINGBUF_SHARED): Don't modify BUF if it's already marked as shared since it might be a read-only stringbuf. This error can be caught when linking with GNU ld with "-z relro". 2009-01-31 Ludovic Courtès Allow the static initialization of subrs. * libguile/Makefile.am (snarf-gsubr.h): New target. (BUILT_SOURCES, nodist_modinclude_HEADERS, MOSTLYCLEANFILES): Add `snarf-gsubr.h'. * libguile/procs.h (SCM_SUBR_ARITY_TO_TYPE): New macro. * libguile/snarf.h (SCM_DEFINE): Rename to... (SCM_DEFINE_GSUBR): this. (SCM_DEFINE_SUBR)[SCM_SUPPORT_STATIC_ALLOCATION]: New macro. (SCM_DEFINE_SUBR_reqX_optY_rstZ)[SCM_SUPPORT_STATIC_ALLOCATION]: New set of macros. (SCM_IMMUTABLE_SUBR): New macro. 2009-01-31 Andy Wingo cache 8 boot programs * libguile/vm.c (vm_make_boot_program): Cache boot programs for nargs < 8. 2009-01-31 Ludovic Courtès Allow several `SNARF_INIT ()' per CPP output line. * libguile/guile-snarf.in (modern_snarf): Allow several `SNARF_INIT ()' per line. This makes it possible to write snarffing macros that contain several `SNARF_INIT ()' invocations. Improve CPP token pasting in . * libguile/snarf.h (scm_i_paste, scm_i_paste3): New macros. (SCM_SYMBOL, SCM_GLOBAL_SYMBOL, SCM_IMMUTABLE_STRING): Use them. 2009-01-31 Ludovic Courtès Don't register disappearing links for non-heap objects. * libguile/boehm-gc.h (SCM_I_IS_POINTER_TO_THE_HEAP, SCM_I_REGISTER_DISAPPEARING_LINK): New. * libguile/vectors.c (scm_c_vector_set_x): Use `SCM_I_REGISTER_DISAPPEARING_LINK ()' instead of `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'. * libguile/weaks.c (scm_weak_car_pair, scm_weak_cdr_pair, scm_doubly_weak_pair): Likewise. 2009-01-30 Andy Wingo remove conv.scm, disasm.scm; objcode->bytecode rename * module/system/vm/Makefile.am: * module/system/vm/conv.scm: * module/system/vm/disasm.scm: Remove these modules, as their functionality is now in (language ...). * libguile/objcodes.h: * libguile/objcodes.c: * module/system/vm/objcode.scm: Rename objcode->u8vector to objcode->bytecode. * module/system/vm/frame.scm: * module/language/bytecode/spec.scm: Fix for objcode->bytecode. * scripts/disassemble: * testsuite/run-vm-tests.scm: Fix for (system vm disasm) removal. * module/system/repl/command.scm: Use the right disassembler. 2009-01-30 Andy Wingo add disassembler that fits in with old compiler tower * module/language/assembly/Makefile.am: * module/language/assembly/disassemble.scm: Add a disassembler, based on the old one but fitting in with the decompiler tower. * module/language/objcode/spec.scm (decompile-value): When decompiling programs, shove all the metadata that we know about into the "env". * module/system/base/compile.scm (decompile-fold, decompile): Return the env from `decompile' as a second value. Not sure if `compile' should do this too. 2009-01-30 Andy Wingo add decompilers that can take us back to assembly * module/language/assembly/Makefile.am: * module/language/assembly/spec.scm: * module/language/assembly/decompile-bytecode.scm: Add a bytecode decompiler. Neat! * module/language/bytecode/spec.scm (decompile-objcode): * module/language/objcode/spec.scm (decompile-value): Add some "decompilers" here too. * module/system/base/compile.scm (current-language): Since we can refer to languages by name, do so here -- removes the previous anti-circularity hack. (compile-file, compile): Refer to target languages by name. (decompile): New public function. Neat! * module/system/base/language.scm (lookup-decompilation-order): Fix so we look for decompilers with the high-level language definition. 2009-01-30 Andy Wingo allow specification of languages by name; add decompilers to languages * module/system/base/language.scm (lookup-decompilation-order): New function, like its compiling cousin, but backwards. (compute-translation-order): Rework so that languages can be specified either by name or by identity. Return a list of language - procedure pairs, without the "to" language in the list, instead of a list of languages. (invalidate-compilation-cache!): Invalidate the decompilation cache too. (): Add a decompiler field. * module/system/base/compile.scm (compile-passes): Much simpler now that lookup-compilation-order gives us the procedures directly. * module/language/*/spec.scm: Specify compilers by name, so that we can avoid unnecessary module loads, and so that when we specify decompilers, we can avoid cycles. 2009-01-30 Andy Wingo remove glil->objcode path in favor of passing through assembly; refactorings. * module/language/assembly.scm: Refactor a bit; remove the name "code" from the API, as it's too generic, and replace with "assembly". * module/language/assembly/compile-bytecode.scm: Get byte lengths via, well, byte-length. * module/language/glil/Makefile.am: * module/language/glil/spec.scm: * module/language/glil/compile-objcode.scm: Remove compile-objcode, as we just go through bytecode now. * module/language/glil/compile-assembly.scm (glil->assembly) (dump-object): s/object->code/object->assembly/. 2009-01-30 Andy Wingo add new language between assembly and objcode: bytecode * module/language/bytecode/Makefile.am: * module/language/bytecode/spec.scm: Add another language to the stack, bytecode. Bytecode is the u8vector form of object code.. * configure.in: * module/language/Makefile.am: * module/language/assembly/Makefile.am: * test-suite/tests/asm-to-bytecode.test: * module/language/assembly/spec.scm: * module/language/assembly/compile-bytecode.scm: Update to include the new pass. 2009-01-29 Andy Wingo remove GPKG.def files * module/language/ghil/GPKG.def: * module/language/r5rs/GPKG.def: Reove these, they aren't used any more. 2009-01-29 Andy Wingo static opcodes; refactor program/objcode division; use new assembly pipeline * gdbinit: Untested attempts to get the stack fondling macros to deal with the new program representation. * libguile/frames.c (scm_vm_frame_arguments, scm_vm_frame_source) (scm_vm_frame_local_ref, scm_vm_frame_local_set_x): SCM_PROGRAM_DATA is a struct scm_objcode*. * libguile/instructions.h: * libguile/instructions.c: Hide the instruction table and the struct scm_instruction structure; all access to instructions now goes through procedures. This is because instructions are no longer in a packed array indexed by opcode. Also, declare a mask that all instructions should fit in. * libguile/objcodes.h: * libguile/objcodes.c: Rewrite so that object code directly maps its arity and length from its bytecode. This makes it unnecessary to keep this information in programs, allowing programs to be simple conses between the code (objcodes) and data (the object table and the closure variables). * libguile/programs.c (scm_make_program): Rework so that make-program takes objcode, an object table, and externals as arguments. It's much clearer this way, and we avoid malloc(). * libguile/stacks.c (is_vm_bootstrap_frame): Update for program/objcode changes. * libguile/vm-engine.c (vm_run): Initialize the jump table on the first run, with the opcodes declared in the instruction sources, and with bad instructions raising an error instead of wandering off into the Unknown. * libguile/vm-engine.h (FETCH_LENGTH): Always represent lengths as 3 bytes. The old code was too error-prone. (NEXT_JUMP): Mask the instruction with SCM_VM_INSTRUCTION_MASK. (NEW_FRAME): Update for program/objcode changes. * libguile/vm-expand.h (VM_DEFINE_FUNCTION, VM_DEFINE_INSTRUCTION) (VM_DEFINE_LOADER): Update so that we explicitly specify opcodes, so that we have a stable bytecode API. * libguile/vm-i-loader.c: Update license to LGPLv2+. Explicitly declare opcodes. (load-integer): Use an int instead of a long as the accumulator; still need to revisit this code at some point, I think. (load-program): Simplify, thankfully!! Just creates the objcode slice and rolls with it. * libguile/vm-i-scheme.c: Number the opcodes explicitly. * libguile/vm-i-system.c: Update license to LGPLv2+. Explicitly declare opcodes. (make-closure): Update for new program API. * libguile/vm.c (vm_make_boot_program): Update for new program/objcode API. Still a bit ugly. (scm_load_compiled_with_vm): Update for new program/objcode API. * module/language/assembly.scm (byte-length): Fix byte-length calculation for loaders, and load-program. (code-pack, code-unpack): Start to move things from (system vm conv) here. (object->code, code->object): More things from conv.scm. * module/language/glil.scm (): Add a new field, closure-level. (make-glil-program, compute-closure-level): Calculate the "closure level" when making a glil program. This is the maximum depth of external binding refs in this closure. (unparse-glil): Fix label serialization. * module/language/glil/compile-assembly.scm (make-meta): Prepend #f for the meta's object table, though maybe in the future we can avoid creating assembly in the first place. (assoc-ref-or-acons, object-index-and-alist): GRRR! Caught again by the different sets of arguments to assoc and assoc-ref! (glil->assembly): Attempt to make the case more readable, and fix the bugs. Sorry I don't know how to comment this change any more than this. (glil->assembly): For serialize the whole key, not just the name. (dump-object): subprogram-code is already a list. Serialize integers as strings, not u8vectors. Fix the order of lists and vectors. * module/language/glil/spec.scm (glil): Switch orders, so we prefer glil -> assembly -> objcode. Actually glil->objcode doesn't work any more, needs to be removed I think. * module/language/objcode/spec.scm (objcode->value): s/objcode->program/make-program/. * module/language/scheme/inline.scm: Add acons inline. * module/system/vm/conv.scm (make-byte-decoder): Skip the first 8 bytes, they are header. Handle subprograms properly. Still needs help though. (decode-length): Lengths are always 3 bytes now. * module/system/vm/disasm.scm: Superficial changes to keep things working. I'd like to fix this better in the future. * module/system/vm/frame.scm (bootstrap-frame?): Fixes for program-bytecode. * module/system/vm/program.scm: Export make-program. It's program-objcode now, no more program-bytecode. * module/system/vm/vm.scm (vm-load): Use make-program. * test-suite/tests/asm-to-bytecode.test: New test, very minimal. * module/system/vm/objcode.scm: Export word-size, byte-order, and write-objcode. 2009-01-28 Andy Wingo cleanups to value and help help handlers * ice-9/session.scm (*value-help-handlers*): Define object-documentation as the default value help handler. (remove-value-help-handler!, add-name-help-handler!) (remove-name-help-handler!): Fix docs. (help, help-doc): Fix so that we try object-documentation through try-value-help, and we obey the docs regarding what happens with return values. 2009-01-27 Andy Wingo merge in from guile-lib: add some extensibility to `help' * ice-9/session.scm (add-value-help-handler!) (remove-value-help-handler!, add-name-help-handler!) (remove-name-help-handler!): New public interfaces, to allow some basic extensibility of the help interface. Merged in from guile-lib's (scheme session). 2009-01-23 Neil Jerram Fix build when scm_t_timespec is different from struct timespec Reported by Roland Haeder. The declaration and definition of scm_pthread_cond_timedwait were using possibly different types for the third arg. * THANKS: Added Roland Haeder. * libguile/threads.h (scm_pthread_cond_timedwait): Use scm_t_timespec for third arg rather than struct timespec, for consistency with the function implementation. 2009-01-23 Neil Jerram Fix MinGW HAVE_STRUCT_TIMESPEC build problem Reported by Carlo Bramini. See the comment in _scm.h. * THANKS: Add Carlo Bramini. * libguile/_scm.h: Undefine HAVE_STRUCT_TIMESPEC. 2009-01-21 Ludovic Courtès Use double-cells to store subrs. * libguile/procs.c (scm_subr_table, scm_subr_table_size, scm_subr_table_room, subr_table_gc_hint, scm_init_subr_table): Remove. (scm_c_make_subr): Simply return a double-cell, with the procedure name and properties stored in a two-element array. * libguile/init.c (scm_i_init_guile): Remove call to `scm_init_subr_table ()'. * libguile/procs.h (SCM_SUBR_META_INFO): New macro. (SCM_SNAME, SCM_SUBR_PROPS): Use it. (SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): Update. (scm_t_subr_entry, SCM_SUBR_ENTRY, SCM_SUBRNUM, scm_subr_table, scm_init_subr_table): Remove. 2009-01-20 Ludovic Courtès Add `SCM_SET_SUBR_GENERIC ()' to replace `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/goops.c (scm_c_extend_primitive_generic): Use `SCM_SET_SUBR_GENERIC ()' instead of using `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/procs.c (scm_c_make_subr_with_generic): Use `SCM_SET_SUBR_GENERIC_LOC ()'. * libguile/procs.h (SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): New macros. 2009-01-20 Ludovic Courtès Use `SCM_SNAME ()' when requesting the name of a subr. * libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Use `SCM_SNAME ()' instead of `SCM_SUBR_ENTRY (subr).name'. * libguile/procs.c (scm_c_define_subr_with_generic, scm_makcclo): Likewise. (scm_c_make_subr_with_generic): Same with `SCM_SUBR_GENERIC ()'. 2009-01-19 Ludovic Courtès Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc 2009-01-19 Andy Wingo add assembly intermediate language * configure.in: * module/language/Makefile.am: * module/language/assembly/Makefile.am: Automakery. * module/language/assembly.scm: * module/language/assembly/spec.scm: Add a new language, which is oddly even lower than GLIL. I got tired of GLIL's terrible compile-objcode.scm, and wanted a cleaner intermediate format. * module/language/glil/compile-assembly.scm: A purely-functional assembler, that produces "assembly". Will document later. * module/language/glil/spec.scm: Declare the compiler to assembly. 2009-01-18 Ludovic Courtès Remove useless cooperative multi-threading source files. 2009-01-18 Ludovic Courtès Make variables related to the subr table size private and unsigned. * libguile/procs.c (scm_subr_table_size, scm_subr_table_room): Made `static' and `unsigned'. (scm_c_make_subr)[entry]: Made `unsigned'. * libguile/procs.h (scm_subr_table_size, scm_subr_table_room): Remove declarations. 2009-01-18 Ludovic Courtès GOOPS: Statically allocate the PORT class array. * libguile/goops.c (scm_port_class): Statically allocate it. (create_port_classes): Don't use `scm_calloc ()'. * libguile/goops.h (scm_port_class): Update declaration. * libguile/ports.c (scm_make_port_type): When checking whether GOOPS is initialized, check whether the first element of SCM_PORT_CLASS is non-zero. 2009-01-18 Ludovic Courtès Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'. * libguile/goops.c (create_port_classes): Use `SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256. * libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX): Likewise. * libguile/ports.c (scm_make_port_type): Likewise. * libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro. 2009-01-18 Ludovic Courtès GOOPS: Statically allocate the SMOB class array. * libguile/goops.c (scm_smob_class): Statically allocate it. (create_smob_classes): Don't malloc(3) `scm_smob_class'. * libguile/goops.h (scm_smob_class): Update declaration. * libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When checking whether GOOPS is initialized, check whether the first element of SCM_SMOB_CLASS is non-zero. 2009-01-18 Ludovic Courtès Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/goops.c (create_smob_classes): Refer to `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256. * libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro. 2009-01-18 Ludovic Courtès Use `scm_gc_malloc ()' when allocating GOOPS `t_extension' objects. * libguile/goops.c (extension_gc_hint): New. (scm_c_extend_primitive_generic): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. (setup_extended_primitive_generics): Don't call `free(3)' when removing a `t_extension' object. Use `scm_gc_malloc ()' when allocating hook entries. * libguile/hooks.c (hook_entry_gc_hint): New. (scm_c_hook_add): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. (scm_c_hook_remove): Don't explicitly free(3) the entry, let the GC do its job. 2009-01-18 Ludovic Courtès Use `scm_gc malloc_pointerless ()' in `scm_i allocate_string_pointers ()'. * libguile/dynl.c (free_string_pointers): Remove. (scm_dynamic_args_call): Remove reference to `free_string_pointers ()' and remove dynwind. * libguile/posix.c (free_string_pointers): Remove. (scm_execl, scm_execlp, scm_execle, scm_environ): Remove references to `free_string_pointers ()'. * libguile/simpos.c (free_string_pointers): Remove. (scm_system_star): Remove reference to `free_string_pointers ()', remove enclosing dynwind. * libguile/strings.c (scm_i_allocate_string_pointers): Use `scm_gc_malloc_pointerless ()' and `scm_gc_malloc ()' instead of `scm_malloc ()' and `scm_to_locale_string ()', so that the result is automatically GC'd when no longer referenced. Remove unneeded dynwind. (scm_i_free_string_pointers): Remove. * libguile/strings.h (scm_i_free_string_pointers): Remove declaration. 2009-01-18 Ludovic Courtès Use `scm_gc_malloc ()' when allocating the allocated fluid vector. * libguile/fluids.c (next_fluid_num): Use `scm_gc_malloc ()'. Don't explicitly free the previously allocated array. Remove useless cooperative multi-threading source files. Use `scm_gc_malloc ()' and friends when allocating the subr table. * libguile/procs.c (subr_table_gc_hint): New. (scm_c_make_subr): Use `scm_gc_realloc ()' instead of `scm_realloc ()'. (scm_init_subr_table): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. 2009-01-18 Ludovic Courtès Make variables related to the subr table size private and unsigned. * libguile/procs.c (scm_subr_table_size, scm_subr_table_room): Made `static' and `unsigned'. (scm_c_make_subr)[entry]: Made `unsigned'. * libguile/procs.h (scm_subr_table_size, scm_subr_table_room): Remove declarations. 2009-01-18 Ludovic Courtès Don't use `scm_immutable_cell ()' for subrs. * libguile/procs.c (scm_c_make_subr): Use `scm_cell ()' instead of `scm_immutable_cell ()' since subr cells can be mutated, e.g., via `SCM_SUBR_GENERIC ()' as in `scm_c_extend_primitive_generic ()' (this doesn't make any difference in practice as of libgc 7.1, though). 2009-01-17 Neil Jerram Remove `INSTALL' * INSTALL: Removed. 2009-01-17 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am m4/gnulib-cache.m4 m4/gnulib-comp.m4 2009-01-17 Andy Wingo move module and meta inside programs' object tables * libguile/programs.h (struct scm_program): Remove the module and meta fields. * libguile/programs.c (scm_c_make_program): Add a new argument, `objs'. If it's a vector, we'll look for the module and the metadata in there, instead of having them in the scm_program structure. (scm_c_make_closure, program_mark, scm_program_meta) (scm_c_program_source, scm_program_module): Adapt to the new program representation. * libguile/objcodes.c (scm_objcode_to_program): Pass #f as the object table when making the program. * libguile/vm-engine.h (CACHE_PROGRAM): * libguile/vm-engine.c (vm_run): Rework to use the simple vector API for getting the current object table. Call the helper, vm_make_boot_program, to make the boot program. * libguile/vm-i-loader.c (load-program): Set the current module and the meta in the object vector, which we pass to scm_c_make_program. * libguile/vm-i-system.c (toplevel-ref, toplevel-set): Adapt to the new program representation. * module/language/glil/compile-objcode.scm (codegen): Clarify. 2009-01-17 Andy Wingo placeholder for meta and module in a program's object table * module/language/glil/compile-objcode.scm (codegen): If the generated objcode will have a meta or it has objects, prepend two cells to the object table: one for the meta, and one for the module. This is a placeholder for future work. 2009-01-16 Neil Jerram Don't try to unlock already unlocked heap mutex For each thread that goes into Guile mode, Guile pushes a cleanup function, scm_leave_guile_cleanup, whose purpose is to execute `scm_leave_guile ()' if the thread is terminated while in Guile mode. The problem is that there are various places - like scm_pthread_cond_wait, scm_without_guile and scm_std_select - where the thread temporarily leaves Guile mode (which means unlocking the heap mutex), and the cleanup function is still in place. Therefore if the thread is terminated at these places, the cleanup function ends up trying to unlock a mutex (the heap mutex) which isn't actually locked. * libguile/threads.h (scm_i_thread): New heap_mutex_locked_by_self field. * libguile/threads.c (scm_enter_guile): Set heap_mutex_locked_by_self. (scm_leave_guile): Only unlock if heap_mutex_locked_by_self is 1. (guilify_self_1): Initialize heap_mutex_locked_by_self. (scm_i_thread_sleep_for_gc): Remove incorrect use of t->held_mutex here. 2009-01-15 Andy Wingo fold in ludovic's suggestions for new manual sections * INSTALL: Update from newest merge * doc/ref/compiler.texi: * doc/ref/vm.texi: Fold in Ludovic's suggestions 2009-01-15 Andy Wingo Merge commit 'origin/master' into vm Conflicts: INSTALL 2009-01-15 Neil Jerram Invoke gnulib-tool with --no-vc-files option, and remove files that should not have been committed to the repository. Revert lib/.gitignore and m4/.gitignore to how they should be (before my confused Gnulib commits...) Revert unintended change to INSTALL made by commit 4a462e35440fdc3f10b0f88b3fb737fa76ed146d Add more missing Gnulib files 2009-01-14 Neil Jerram Add more missing Gnulib files Add missing Gnulib file (m4/localcharset.m4) 2009-01-14 Ludovic Courtès Add support for static allocation of cells, strings and stringbufs. * libguile/__scm.h (SCM_ALIGNED): New macro. * libguile/_scm.h: Include "libguile/strings.h", to make the string/stringbuf-related constants visible to snarffed code. * libguile/snarf.h (SCM_SUPPORT_STATIC_ALLOCATION): New macro. (SCM_SYMBOL, SCM_GLOBAL_SYMBOL)[SCM_SUPPORT_STATIC_ALLOCATION]: New alternative versions of these macros with support for (almost) static allocation via the use of `string->symbol'. (SCM_IMMUTABLE_DOUBLE_CELL, SCM_IMMUTABLE_STRINGBUF, SCM_IMMUTABLE_STRING): New macros. * libguile/tags.h (SCM)[SCM_DEBUG_TYPING_STRICTNESS==1]: Use a pointer type that is compatible with other pointer types, to avoid potential violation of strict aliasing rules. 2009-01-13 Ludovic Courtès Expose some of the string/stringbuf internal flags and tags. * libguile/strings.h (scm_tc7_ro_string, SCM_I_STRINGBUF_F_SHARED, SCM_I_STRINGBUF_F_INLINE): New macros. * libguile/strings.c (STRINGBUF_F_SHARED): Alias for `SCM_I_STRINGBUF_F_SHARED'. (STRINGBUF_F_INLINE): Alias for `SCM_I_STRINGBUF_F_INLINE'. (RO_STRING_TAG): Alias for `scm_tc7_ro_string'. 2009-01-13 Andy Wingo fix marking empty VM continuations * libguile/vm.h (struct scm_vm_cont): * libguile/vm.c (capture_vm_cont, reinstate_vm_cont): Change so we just store the registers as they are, with the reloc. (vm_cont_mark): Only mark the stack if it has elements on it, otherwise we get a bogus fp. * libguile/stacks.c (scm_make_stack): Update for change to vm continuations. 2009-01-12 Andy Wingo Merge branch 'master' into vm 2009-01-12 Ludovic Courtès Fixlet for `run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (%default-options): Default to the empty list for `input'. gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework. * gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'. (GCOld): Fix the order of the predicate and run-maker. gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al. See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for details. gc-benchmarks: Add `run-benchmark.scm'. gc-profile: Show the result of `(version)'. * gc-benchmarks/gc-profile.scm (main): Show `(version)'. gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter. (run-benchmark): Moved from `twobit-compat.scm'. Honor `*iteration-count*'. (%options): Add `--iterations'. (show-help): Document it. (main): Parameterize `*iteration-count*'. Import GC benchmarks from Larceny, by Hansen, Clinger, et al. These GPLv2+-licensed GC benchmarks are available from http://www.ccs.neu.edu/home/will/GC/sourcecode.html . gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer. * gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm". (save-directory-excursion, load-larceny-benchmark): New procedures. (%options): New variable. (show-help, parse-args): New procedures. (main): Use `parse-args' and `load-larceny-benchmark'. Add GC benchmarks. 2009-01-12 Neil Jerram Make sure that we have a real on-the-stack alloca() Because of how Guile saves and restores continuations (by copying the stack), and how it uses alloca to create space for debug information on the stack, we must have an alloca() that really does use the stack, and not one that uses the heap. To do this, we use the Gnulib "alloca-opt" module instead of "alloca". This commit also updates the Gnulib sources from the current Gnulib Git repository. 2009-01-12 Andy Wingo remove a paranoid define; fix bitrot in measure.scm. * benchmark/measure.scm (measure): Fix bitrot. * libguile/vm.c (VM_ENABLE_STACK_NULLING): Undefine this, as it hasn't caught any errors in quite a while. 2009-01-12 Andy Wingo fix mismerge on srfi-19.scm * module/srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Whoops, fix broken manual merge on srfi-19.scm. fix typo when compiling receive forms * module/language/glil/compile-objcode.scm (codegen): Fix an embarassing typo, introduced in c2c82b62f40242a4212528c3d3e882038b48f0a2 2009-01-12 Andy Wingo Merge commit 'origin/master' into vm Conflicts: .gitignore guile-tools.in srfi/srfi-19.scm 2009-01-11 Andy Wingo fold in neil's feedback to history.texi * doc/ref/history.texi: Fold in Neil's feedback 2009-01-11 Andy Wingo word tweaks * doc/ref/guile.texi: Finish some wording. * doc/ref/compiler.texi: Fix some goofiness. 2009-01-11 Andy Wingo tweaks to compiler.texi * doc/ref/compiler.texi: Minor tweaks. 2009-01-11 Andy Wingo finish compiler.texi, woo * libguile/objcodes.c (do-pair): Removed unused debuging hack. * module/language/glil/spec.scm (glil): Simplify a bit. * module/system/repl/repl.scm (default-catch-handler): Don't catch vm-error, as vm-backtrace doesn't exist any more. * doc/ref/compiler.texi: Finish documenting GLIL and object code. 2009-01-11 Andy Wingo rename to * module/language/glil.scm (): Rename from . * module/language/ghil/compile-glil.scm (codegen): * module/language/glil.scm (parse-glil, unparse-glil): * module/language/glil/compile-objcode.scm (preprocess, codegen): Adapt to naming change. 2009-01-11 Andy Wingo remove useless helper type, serialize GHIL more strictly * module/language/ghil.scm (parse-ghil, unparse-ghil): Rework to make the parse format correspond more closely with the object representation, so that I only have to document it once in the manual. The salient change is that no expression is self-quoting, and that variable references should go through `(ref FOO)'. Rename `set!' to `set'. * module/language/ghil/compile-glil.scm: Add a couple of compilers for unquote and unquote-splicing, that just raise an error. This way I can document unquote and unquote-splicing as normal ghil expressions, except that it's the compiler that catches them if they're outside a quasiquote. (codegen): Adapt to change in . * module/language/ghil/spec.scm (parse): Fix parser typo bug. * module/language/glil.scm (): Remove useless structure, which also had a confusing name. Just put the nargs, nrest, nlocs, and nexts in the directly. (parse-glil, unparse-glil): Serialize `asm' more straightforwardly. * module/language/glil/compile-objcode.scm (): Remove , as with . (preprocess, make-meta, codegen, dump-object!): Adapt to change in . 2009-01-09 Andy Wingo rename translate.scm to compile-ghil.scm, and more work on compiler.texi * doc/ref/api-evaluation.texi: Fix some typos and xrefs. * doc/ref/compiler.texi (The Scheme Compiler): Document the scheme compiler, and start documenting the GHIL language. * doc/ref/guile.texi (Guile Implementation): Whoops, put autoconf after the implementation foo. Unless we want it before? * doc/ref/history.texi (The Emacs Thesis): Fix typo. * doc/ref/vm.texi (Environment Control Instructions): Rename offset to index. * module/language/ghil.scm (parse-ghil): Fix what I think was a bug -- the consumer in a mv-call shouldn't be a rest arg. * module/language/scheme/Makefile.am (SOURCES): * module/language/scheme/compile-ghil.scm: Rename this file from translate.scm. * module/oop/goops.scm: * module/language/scheme/spec.scm: Deal with renaming. 2009-01-09 Andy Wingo fix some xrefs, flesh out compiler.texi a bit more * doc/ref/api-debug.texi: * doc/ref/vm.texi: Fix some cross-references. * doc/ref/compiler.texi: Hack some more, finishing the section on the compiler tower. 2009-01-09 Andy Wingo finish api-procedures.texi * doc/ref/api-procedures.texi: Finish documenting bits on compiled procedures. 2009-01-08 Andy Wingo more work on api-procedures.texi * doc/ref/api-procedures.texi (Compiled Procedures): Stub out these docs some more, taking some commented-out docs from vm.texi. * doc/ref/vm.texi: Move docs ^. 2009-01-08 Andy Wingo start at documenting the compiler * doc/ref/api-evaluation.texi: Add documentation for the standard compilation interface, and some notes about compiled files. * doc/ref/api-procedures.texi (Compiled Procedures): A stub at documenting compiled procedures. * doc/ref/compiler.texi (Compiling to the Virtual Machine): Flesh out with some structure, though much of the text remains to be written. This stuff is hard to write! 2009-01-08 Andy Wingo (language ghil def) becomes (language ghil) * module/language/Makefile.am: * module/language/ghil/Makefile.am: * module/language/ghil.scm: * module/language/ghil/compile-glil.scm: * module/language/ghil/spec.scm: * module/language/glil/Makefile.am: * module/language/glil.scm: * module/language/glil/compile-objcode.scm: * module/language/glil/spec.scm: * module/language/scheme/inline.scm: * module/language/scheme/translate.scm: * module/oop/goops.scm: Rename (language ghil def) and (language glil def) to not have the "def". They're nicer names. 2009-01-08 Andy Wingo move lang-specific modules, e.g. (system il compile) to (language ghil compile-glil) * configure.in: Remove module/system/il directory. * module/language/ghil/Makefile.am (SOURCES): * module/language/ghil/compile-glil.scm (system): * module/language/ghil/def.scm (language): * module/language/ghil/spec.scm (language, ghil): * module/language/glil/Makefile.am (SOURCES): * module/language/glil/compile-objcode.scm (language): * module/language/glil/def.scm (language): * module/language/glil/spec.scm (language, compile): * module/language/scheme/Makefile.am (SOURCES): * module/language/scheme/inline.scm (system, define-inline): * module/language/scheme/translate.scm (language): Move files, renaming the modules. * module/oop/goops.scm (load-toplevel): Unfortunately the GHIL name leaked here. Patch it up. * module/system/vm/Makefile.am (SOURCES): Remove assemble.scm. 2009-01-06 Andy Wingo react to comments by ludovic on history.texi * doc/ref/history.texi: Adjust to some of Ludovic's comments. finish vm.texi except references * doc/ref/vm.texi: Finish writing the VM reference, all correct except for the missing references. 2009-01-04 Neil Jerram NEWS entry for %fast-slot-ref/set! fix 2009-01-04 Neil Jerram Fix implementation of %fast-slot-ref and %fast-slot-set! * libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x): Correct incantation for getting the number of slots of the specified instance. * libguile/goops.h (SCM_NUMBER_OF_SLOTS): Removed (because wrong). * test-suite/standalone/test-fast-slot-ref.in: New standalone test. * configure.in: Generate test-suite/standalone/test-fast-slot-ref. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add test-fast-slot-ref. 2009-01-04 Andy Wingo allow `apply' on %nil-terminated lists * libguile/vm-engine.h (PUSH_LIST): Add a parameter to check that the list was proper. * libguile/vm-i-system.c: Adapt PUSH_LIST callsites to pass SCM_NULLP or SCM_NULL_OR_NIL_P, as appropriate. Add a check to return/values*. * libguile/vm.c: Add lang.h header for SCM_NULL_OR_NIL_P. * test-suite/tests/elisp.test: Fix XFAIL for elisp + apply. 2009-01-03 Neil Jerram Update autogen.sh * autogen.sh: Don't call guile-readline/autogen.sh; not needed because autoreconf recurses itself. Remove copies of config.guess and config.sub, which are now invalid because we don't have those files in the top level directory. Remove mention of --enable-maintainer-mode, as we don't use AM_MAINTAINER_MODE any more. 2009-01-03 Ludovic Courtès Delete redundant `config.{guess,sub}'. 2008-12-26 Andy Wingo remove heap links in VM frames, incorporate vm frames into normal backtraces * doc/ref/vm.texi (Stack Layout): Update to remove references to the "heap link". * gdbinit: Update for "heap link" removal. * libguile/frames.c: * libguile/frames.h: Update macros and diagram for removal of "heap link". As part of this, we also remove "heap frames", replacing them with "vm frames", which are much like the interpreter's debug objects, but for VM stacks. That is to say, they don't actually hold the stack themselves, just the pointers into stack that's held by a continuation (either captured or current). * libguile/stacks.c (stack_depth, read_frames): Since a "stack" object is really a copy of information that comes from somewhere else, it makes sense to copy over info from the VM, just as `make-stack' does from the evaluator. The tricky bit is to figure out how to interleave VM and interpreter frames. We do that by starting in the interpreter, and whenever the current frame's procedure is actually a program, we switch to the VM stack, switching back when we reach a "bootstrap frame". The last bit is hacky, but it does work... (is_vm_bootstrap_frame): Hacky predicate to see if a VM frame is a bootstrap frame. (scm_make_stack): Accept a VM frame in addition to debug frames. Probably has some bugs in this case. But in the case that the arg is #t (a common case), do the right thing, capturing the top VM frame as well, and interleaving those frames appropriately on the stack. As an accident, we lost the ability to limit the number of frames in the backtrace. We could add that back, but personally I always want *all* frames in the trace... Narrowing still works fine, though there are some hiccups sometimes -- e.g. an outer cut to a procedure that does a tail-call in VM code will never find the cut, as it no longer exists in the continuation. * libguile/vm.h (struct scm_vm): So! Now that we have switched to save stacks in the normal make-stack, there's no more need for `this_frame' or `last_frame'. On the other hand, we can take this opportunity to fix tracing: when we're in a trace hook, we set `trace_frame' on the VM, so we know not to fire hooks when we're already in a hook. (struct scm_vm_cont): Expose this, as make-stack needs it to make VM frames from VM continuations. * libguile/vm.c (scm_vm_trace_frame): New function, gets the current trace frame. (vm_mark, make_vm): Hook up the trace frame. (vm_dispatch_hook): New hook dispatcher, with a dynwind so it does the right thing if the hook exits nonlocally. * libguile/vm-engine.c (vm_run): No more this_frame in the wind data. * libguile/vm-engine.h (RUN_HOOK): Run hooks through the dispatcher. (ALIGN_AS_NON_IMMEDIATE, POP_LIST_ON_STACK): Remove unused code. (NEW_FRAME): Adapt for no HL in the frame. * libguile/vm-i-system.c (goto/args, mv-call, return, return/values): Adapt for no HL in the frame. * module/system/vm/frame.scm: * module/system/vm/vm.scm: Beginnings of some reworkings, needs more thought. 2008-12-26 Andy Wingo repl.scm relies on `display-backtrace' to do everything, some naming tweaks * module/ice-9/boot-9.scm (default-pre-unwind-handler): Rename from default-lazy-handler. (pre-unwind-handler-dispatch): Rename from lazy-hadler-dispatch. (error-catching-loop): Adjust caller. * module/system/repl/repl.scm (default-pre-unwind-handler): Remove this definition, in favor of the default one in boot-9. (default-catch-handler): Don't do a vm-backtrace, as we will soon be relying on core machinery to do that for us. (call-with-backtrace): Start a new stack for the thunk. (with-backtrace): Macro version of call-with-backtrace. (start-repl): Use with-backtrace for brevity. Start a stack with #t as the tag instead of repl-eval, because all traces of repl-eval are gone after it does a tail-call. * module/ice-9/debugger.scm: * module/ice-9/debugging/traps.scm: * module/ice-9/stack-catch.scm: Adapt to s/lazy/pre-unwind/ in boot-9.scm. 2008-12-26 Andy Wingo add scm_c_program_source * libguile/programs.h: * libguile/programs.c (scm_c_program_source): New helper for getting source information from C. backtrace.c: allow vectors for SCM_FRAME_SOURCE (frame) * libguile/backtrace.c (display_backtrace_get_file_line): If the source is a vector, treat it as a #(line column file) vector, as emitted by the VM. Needs subsequent patches to make sense. fix doc typo * doc/ref/data-rep.texi (Non-immediate objects): Fix a typo, thanks to Dale Smith. 2008-12-22 Ludovic Courtès Fix typo in SRFI-19. * srfi/srfi-19.scm (priv:string->date): Check for EOF on CH, not PORT. 2008-12-19 Andy Wingo remove the `late-bind' instruction * doc/ref/vm.texi: Minor fixes. * libguile/vm-i-loader.c: Remove the unused `late-bind' instruction. 2008-12-19 Andy Wingo write history.texi * doc/ref/vm.texi: Flesh out the VM documentation, adding a rationale. * doc/ref/history.texi: Write the Guile history. * doc/ref/guile.texi (Top): Some tweaks. 2008-12-18 Ludovic Courtès Update `INSTALL', from Automake 1.10.2. Don't use deprecated functions in `debug-malloc.c'. * libguile/debug-malloc.c (scm_malloc_stats): Use `scm_from_locale_string ()'. Patch by Linas Vepstas . 2008-12-18 Ludovic Courtès srfi-19: Fix `string->date' weekday lookup. * srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Use `locale-day-short' since it expects integers in the range 1-7, unlike `priv:locale-abbr-weekday'. (priv:locale-long-weekday->index): Likewise. * test-suite/tests/srfi-19.test ("SRFI date/time library")["string->date works on Sunday"]: New test. 2008-12-14 Ludovic Courtès Fixlet for `run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (%default-options): Default to the empty list for `input'. Fix typo in makefile. * libguile/Makefile.am (DOT_X_FILES): Substitute `gettext.x' to `gettext.c'. Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am libguile/struct.c libguile/threads.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 2008-12-13 Neil Jerram Ignore gds-test.debug and gds-test.transcript 2008-12-13 Neil Jerram Support multiple concurrent instances of Emacs + GDS server By: - Making the Unix socket name unique (for each Emacs instance), by appending Emacs's PID to it. - Changing the GDS server to listen on both Unix domain and TCP (and not to mind if the TCP bind fails, which will happen if another GDS instance has already bound to the TCP port number). - Adding this unique Unix socket name to the environment (as GDS_UNIX_SOCKET_NAME), so that Guile clients started from inside Emacs can pick it up. - Changing the GDS client code to look for GDS_UNIX_SOCKET_NAME in the environment, and to connect to the Unix socket with that name instead of over TCP. Guile clients started outside Emacs will not find GDS_UNIX_SOCKET_NAME and so will fall back to using TCP. This means they will connect to whichever Emacs + GDS server instance started first. * emacs/gds-server.el (gds-start-server): Take both Unix socket name and TCP port args, instead of just one (which could be either Unix or TCP), and pass these on to `run-server'. Remove unused optional bufname arg. * emacs/gds.el (gds-unix-socket-name, gds-tcp-port): New variables. (gds-socket-type-alist): Removed. (gds-run-debug-server): Pass gds-unix-socket-name and gds-tcp-port to gds-start-server. Add the Unix socket name to the environment. (gds-server-socket-type): Note now obsolete. * ice-9/gds-client.scm (connect-to-gds): Get Unix socket name from environment, and connect to this in preference to using TCP. * ice-9/gds-server.scm (run-server): Take both Unix socket name and TCP port args. Listen and accept connections on both. 2008-12-12 Neil Jerram Thank people who provided reports or fixes for GDS (while it was a standalone project) * THANKS (R Clayton, John Steele Scott, Thomas Wawrzinek): Added. 2008-12-12 Neil Jerram Add more files that I wrote to the list in AUTHORS * AUTHORS (Neil Jerram): Several files added. 2008-12-12 Neil Jerram Add GDS test and documentation files (Transferred from the remains of the old standalone guile-debugging project at gna.org.) * emacs/gds-faq.txt, emacs/gds-test.el, emacs/gds-test.sh, emacs/gds-test.stdin, emacs/gds-tutorial.txt: New files. 2008-12-11 Neil Jerram Add a GDS protocol hook, that we can use for testing * emacs/gds.el (gds-protocol-hook): New hook. (gds-debug-protocol): Run this hook for each received protocol form. 2008-12-10 Neil Jerram Revert "(scm_shell_usage): Note need for subscription to bug-guile@gnu.org." This reverts commit f3e3f530c28cfa5c7830c5d9b01de6fc388bc42a, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. Conflicts: 2008-12-10 Neil Jerram Revert "Note need for subscription to bug-guile@gnu.org." This reverts commit cbea802b3763aa8cb43c88f7df272da3e41c32da, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. Conflicts: 2008-12-10 Neil Jerram Revert "(Reporting Bugs): Note need for subscription to" This reverts commit e563095988a1c64feb30307928bcc090828cdda9, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. Conflicts: 2008-12-10 Neil Jerram Revert "* README: Note need for subscription to bug-guile@gnu.org." This reverts commit 51d079ab0d23e4175d333ce22eb3e74aeae5913d, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. 2008-12-10 Ludovic Courtès i18n: Add comment about standardization of the `locale_t' API. * libguile/i18n.c: Add pointer to the POSIX 2008 standardization of the API. Fix erroneous differences in `NEWS' compared to `branch_release-1-8'. configure: Check for . * configure.in: Check for , to clarify misconfigurations. configure: Don't substitute `DLPREOPEN'. * configure.in: Don't substitute `DLPREOPEN' since it's no longer used (see commit 72db29f200c38fca64a8ccd0d679821eb25de5a9). 2008-12-10 Neil Jerram Remove everything to do with GDS Breakpoints (which I now regard as an unsuccesful experiment) This commit makes all affected files the same in master as they are in branch_release-1-8. * doc/ref/api-debug.texi (Breakpoints): Removed. * doc/ref/scheme-using.texi (GDS Introduction, GDS Getting Started, Displaying the Scheme Stack): Remove mentions of breakpoints. (Setting Specific Breakpoints, Setting GDS-managed Breakpoints, Setting and Managing Breakpoints, Listing and Deleting Breakpoints, Moving and Losing Breakpoints): Removed. * emacs/gds-scheme.el (gds-bufferless-breakpoints, gds-bpdef:behaviour, gds-bpdef:type, gds-bpdef:file-name, gds-bpdef:proc-name, gds-bpdef:lc, gds-breakpoint-number, gds-breakpoint-buffers, gds-breakpoint-programming, gds-breakpoint-cache, gds-breakpoint-face, gds-breakpoints-file-name, gds-delete-lost-breakpoints, gds-bpdefs-cache, gds-read-breakpoints-file, gds-adopt-breakpoints, gds-adopt-breakpoint, gds-make-breakpoint-overlay, gds-send-breakpoint-to-client, gds-default-breakpoint-type, gds-set-breakpoint, gds-defun-name-region, gds-breakpoint-overlays-at, gds-write-breakpoints-file, gds-fold-breakpoints, gds-delete-breakpoints, gds-delete-breakpoint, gds-breakpoint-at-point, gds-union, gds-user-selected-breakpoint, gds-describe-breakpoints, gds-describe-breakpoint, gds-after-save-update-breakpoints, gds-breakpoint-map): Removed. (gds-nondebug-protocol): Removed handling for `breakpoint' and `get-breakpoints'. * emacs/gds.el (gds-scheme-first-load): Removed. * ice-9/debugging/Makefile.am (ice9_debugging_sources): Removed breakpoints.scm and load-hooks.scm. * ice-9/debugging/breakpoints.scm: Removed. * ice-9/debugging/load-hooks.scm: Removed. * ice-9/gds-client.scm (handle-nondebug-protocol): Remove everything to do with breakpoints. (breakpoints, set-gds-breakpoints): Removed. (run-utility): Call `connect-to-gds' instead of `set-gds-breakpoints'. 2008-12-09 Ludovic Courtès Mention the end of `ChangeLog' files in `NEWS'. Make `config.status' happier. * guile-tools.in (datarootdir): New variable, needed since `pkgdatadir' may refer to `${datarootdir}'. 2008-12-08 Ludovic Courtès Add other missing Gnulib files. 2008-12-07 Ludovic Courtès Remove useless references to Libtool's `dlpreopen' mechanism. * libguile/Makefile.am (guile_LDFLAGS): Remove `@DLPREOPEN@' since it has no effect. * libguile/guile.c (main): Don't invoke `LTDL_SET_PRELOADED_SYMBOLS ()' since it had no effect given how we invoke `libtool'. It also fixes compatibility issues when using libltdl 1.5 with a Libtool 2.2 package. 2008-12-07 Ludovic Courtès Add missing Gnulib M4 files. Reported by Neil Jerram. 2008-12-07 Neil Jerram Several new hash table tests, written by Gregory Marton. * test-suite/tests/hash.test ("make-hash-table, hash-table?", "hash-set and hash-ref", "auto-resizing hashx", "hashx"): New tests. * AUTHORS, THANKS: Add Gregory Marton as a contributor. 2008-12-02 Ludovic Courtès Fix sloppy bound checking in `string-{ref,set!}' with the empty string. * libguile/strings.c (scm_string_ref): Add proper range checking for the empty string. (scm_string_set_x): Likewise. Reported by Bill Schottstaedt . * test-suite/tests/strings.test ("string-ref"): New test prefix. ("string-set!")["empty string", "empty string and non-zero index", "out of range", "negative index", "regular string"]: New tests. * NEWS: Update. 2008-12-02 Ludovic Courtès Update `NEWS'. 2008-11-30 Ludovic Courtès Fix potential deadlock in `make-struct'. * libguile/struct.c (scm_make_struct): Remove critical section, as suggested by Linas Vepstas . See http://lists.gnu.org/archive/html/bug-guile/2008-11/msg00036.html for a discussion. 2008-11-30 Ludovic Courtès Make GNU Libtool 2.2.x happier. * configure.in: Use `AC_CONFIG_MACRO_DIR([m4])'. Reverts patch b01284227e180d223c97e1b9ba7e2cbd0ddded7e and makes `libtoolize' from Libtool 2 happier (removes a couple of warnings). * Makefile.am (ACLOCAL_AMFLAGS): Remove `-I guile-config' since that directory only contains macros that we distribute, not macros that we use. 2008-11-30 Ludovic Courtès Check the return value of libc's functions to make `_FORTIFY_SOURCE=2' work. This fixes bug #24009 reported by Martin Pitt. * libguile/threads.c (guilify_self_1): Check the return value of pipe(2). (scm_std_select): Use `full_read ()' instead of `read ()' when reading from WAKEUP_FD. * libguile/async.c (scm_i_queue_async_cell): Use `full_write ()' instead of write(2) when writing to SLEEP_FD. * libguile/fports.c (fport_flush): Likewise. * libguile/posix.c (getgroups): Use the return value of getgroups(2) as NGROUPS. (scm_nice): Get the return value of nice(2) to make glibc happy. * libguile/scmsigs.c (take_signal): Use `full_write ()' instead of write(2). 2008-11-30 Ludovic Courtès Use Gnulib's `full-write' and `full-read' modules. Update Gnulib files to commit d4b129b8e5f8a8d1198020fd6fc79310d305936c. 2008-11-24 Ludovic Courtès Use orthodox libtoology in `guile'. * libguile/guile.c (main): Use `LTDL_SET_PRELOADED_SYMBOLS ()' instead of our own trick. 2008-11-24 Ludovic Courtès Run the handler of SRFI-34's `with-exception-handler' in the right dyn. env. * srfi/srfi-34.scm (with-exception-handler): Use `with-throw-handler' instead of `lazy-catch'. * test-suite/tests/srfi-34.test ("SRFI 34")["`with-exception-handler' invokes HANDLER in THUNK's dynamic env."]: New test. * test-suite/tests/srfi-39.test: Use `(srfi srfi-34)'. ("SRFI-39")["SRFI-34"]: New test. * NEWS: Update. 2008-11-24 Ludovic Courtès Fix comments in `test-scm-c-read.c'. * test-suite/standalone/test-scm-c-read.c (make_port): Fix comments. 2008-11-23 Ludovic Courtès Add C unit test for `scm_c_read ()' and the port API. * test-suite/standalone/Makefile.am (check_PROGRAMS, TESTS): Add `test-scm-c-read'. (test_scm_c_read_SOURCES, test_scm_c_read_CFLAGS, test_scm_c_read_LDADD): New. 2008-11-23 Neil Jerram Make scm_c_read use caller buffer only for unbuffered ports. We recently modified scm_c_read so that it temporarily swaps the caller's buffer with the port's normal read buffer, in order to improve performance in the case where the port is unbuffered (which actually means having a single-byte buffer) - but we implemented the swap in the buffered case too. The latter turns out to be a bad idea - because it means that the C code of a custom port implementation cannot rely on a port's buffer always being the same as when it was first set up - and so this commit reverts that. The buffer swapping trick now applies to unbuffered ports only. * libguile/ports.c (scm_c_read): Only do swapping of port and caller buffer for unbuffered ports. 2008-11-20 Andy Wingo late-variable-{ref,set} -> toplevel-{ref,set} * benchmark/lib.scm: * libguile/vm-i-system.c (toplevel-ref, toplevel-set): * module/system/vm/assemble.scm (codegen): * module/system/vm/disasm.scm (code-annotation): s/late-variable/toplevel/. It's just a better name. 2008-11-20 Andy Wingo merge vm docs into guile reference (as yet unfinished) * doc/ref/compiler.texi: A new empty section on the compiler. * doc/ref/data-rep.texi: Made to be a section of a chapter instead of an appendix. The beginnings of some revision, but not there yet. * doc/ref/guile.texi: Put the "Data Representation" essay into the new "History and Implementation Details" chapter. * doc/ref/history.texi: New empty section on Guile history. * doc/ref/libguile-concepts.texi: * doc/ref/libguile-smobs.texi: Fix up some xrefs. * doc/ref/vm.texi: New section documenting the VM. Not done yet. 2008-11-14 Andy Wingo nifty generic compiler infrastructure -- no more hardcoded passes * module/system/base/language.scm (): Rework so that instead of hardcoding passes in the language, we define compilers that translate from one language to another. Add `parser' to the language fields, a bit of a hack but useful for languages with s-expression external representations but with record internal representations. (define-language, *compilation-cache*, invalidate-compilation-cache!) (compute-compilation-order, lookup-compilation-order): Add an algorithm that does a depth-first search for a translation path from a source language to a target language, caching the result in a lookup table. * module/language/scheme/spec.scm: * module/language/ghil/spec.scm: Update to the new language format. * module/language/glil/spec.scm: Add a language specification for GLIL, with a compiler to objcode. Also there are parsers and printers, for repl usage, but for some reason this doesn't work yet. * module/language/objcode/spec.scm: Define a language specification for object code. There is some sleight of hand here, in the "compiler" to values; but there is method behind the madness, because this way we higher levels can pass environments (a module + externals pair) to objcode->program. * module/language/value/spec.scm: Define a language specification for values. There is something intellectually dishonest about this, but it does serve its purpose as a foundation for the language hierarchy. * configure.in: * module/language/Makefile.am * module/language/ghil/Makefile.am * module/language/glil/Makefile.am * module/language/objcode/Makefile.am * module/language/value/Makefile.am: Autotomfoolery for the ghil, glil, objcode, and value languages. * module/language/scheme/translate.scm (translate): Import the bits that understand `compile-time-environment' here, and pass on the relevant portions of the environment to the next compiler pass. * module/system/base/compile.scm (current-language): New procedure, refs the current language fluid, or lazily sets it to scheme. (call-once, call-with-output-file/atomic): Refactor these bits to use with-throw-handler. No functional change. (compile-file, compile-and-load, compile-passes, compile-fold) (compile): Refactor the public interface of the compiler to be generic and simple. Uses `lookup-compilation-order' to find a path from the source language to the target language. * module/system/base/syntax.scm (define-type): Adapt to changes in define-record. (define-record): Instead of expecting all slots in the first form, expect them in the body, and let the first form hold the options. * module/system/il/compile.scm (compile): Adapt to the compilation pass API (three in and two out). * module/system/il/ghil.scm (, ) (): Adapt to define-record changes. * module/system/il/glil.scm (): Adapt to define-record changes. (, print-glil): Add a GLIL record printer that uses unparse. (parse-glil, unparse-glil): Update unparse (formerly known as pprint), and write a parse function. * module/system/repl/common.scm (): Adapt to define-record changes. (repl-parse): New function, parses the read form using the current language. Something of a hack. (repl-compile): Adapt to changes in `compile'. (repl-eval): Fix up the does-the-language-have-a-compiler check for changes in . * module/system/repl/repl.scm (start-repl): Parse the form before eval. * module/system/repl/command.scm (describe): Parse. (compile): Be more generic. (compile-file): Adapt to changes in compile-file. (disassemble, time, profile, trace): Parse. * module/system/vm/debug.scm: * module/system/vm/assemble.scm: Adapt to define-record changes. * module/language/scheme/translate.scm (receive): Fix an important bug that gave `receive' letrec semantics instead of let semantics. Whoops! 2008-11-14 Ludovic Courtès Update `THANKS'. 2008-11-14 Ludovic Courtès Update the thread stack base when `scm_with_guile' is invoked multiple times. * NEWS: Update. * libguile/threads.c (scm_i_init_thread_for_guile): When the thread is already guilified, update `t->base' so that it corresponds to the new stack base. Bug report and patch by Linas Vepstas . * test-suite/standalone/Makefile.am (test_scm_with_guile_CFLAGS, test_scm_with_guile_LDADD): New. (check_PROGRAMS, TESTS): Add `test-scm-with-guile'. 2008-11-13 Ludovic Courtès Augment `.gitignore'. Update "guile(1)" man page. * doc/guile.1: Remove reference to the version and date. Mention R5RS, instead of R4RS. Explicitly say that the full documentation is in Texinfo (as other GNU packages do). 2008-11-13 Ludovic Courtès Add "guile(1)" man page. Robert Merkel's copyright assignment to the FSF had apparently been on file for some time. * NEWS: Update. * doc/Makefile.am (dist_man1_MANS): New. 2008-11-12 Andy Wingo more ghil parsing fixen * module/system/il/ghil.scm (parse-ghil): Fix a typo for values* (unparse-ghil): Only output (quote foo) if the object is a symbol. (unparse-ghil): Fix some missing ,@. 2008-11-11 Andy Wingo fix unparse-ghil errors with quasiquote * module/system/il/ghil.scm (unparse-ghil): Fix some issues with quasiquote and unquote[-splicing]. Doh! rashly bump stack limit to 40k words * libguile/eval.c (scm_debug_opts): Whereas, today's machines are larger than yesterday's; GCC consumes more words per stack frame than it used to; and you can get quite some recursion in a halfway-compiled system, be it resolved: let's bump up the C stack limit to 40k words (160 kB / 320 kB, depending on word size). 2008-11-11 Andy Wingo add parsers and unparser for ghil; ,language ghil works now * module/system/repl/common.scm (repl-print): Slightly refine the meaning of "language-printer": a language printer prints an expression of a language, not the result of evaluation. `write' prints values. * module/language/ghil/spec.scm (ghil): Define a language printer, and a translator for turning s-expressions (not scheme, mind you) into GHIL. * module/language/scheme/translate.scm (quote, quasiquote): Add some #:keyword action, so that we can (quote #:keywords). * module/system/base/language.scm (): * module/system/base/compile.scm (read-file-in): Don't require that a language have a read-file; instead error when read-file is called. (compile-passes, compile-in): Refactor to call a helper method to turn the language + set of options into a set of compiler passes. * module/system/base/syntax.scm (define-type): Allow the type to be a list, with the car being the name and the cdr being keyword options. Interpret #:printer as a printer, and pass it down to... (define-record): Here. * module/system/il/ghil.scm (print-ghil, ): New printer for GHIL, yay! (parse-ghil, unparse-ghil): New lovely functions. Will document them in the manual. 2008-11-11 Ludovic Courtès gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework. * gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'. (GCOld): Fix the order of the predicate and run-maker. gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al. See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for details. gc-benchmarks: Add `run-benchmark.scm'. gc-profile: Show the result of `(version)'. * gc-benchmarks/gc-profile.scm (main): Show `(version)'. 2008-11-10 Ludovic Courtès Have `version' return `PACKAGE_VERSION'. * libguile/version.c (scm_version): Return `PACKAGE_VERSION' instead of "MAJOR.MINOR.MICRO". Change `GUILE_VERSION' to `1.9.0-bdwgc'. * GUILE-VERSION (GUILE_VERSION): Add `-bdwgc' prefix. Use `pkg-config' to detect BDW-GC at configure-time. * configure.in: Use `PKG_CHECK_MODULES' to look for libgc. This only works with GC 7.x+, which is what we want anyway. gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter. (run-benchmark): Moved from `twobit-compat.scm'. Honor `*iteration-count*'. (%options): Add `--iterations'. (show-help): Document it. (main): Parameterize `*iteration-count*'. Import GC benchmarks from Larceny, by Hansen, Clinger, et al. These GPLv2+-licensed GC benchmarks are available from http://www.ccs.neu.edu/home/will/GC/sourcecode.html . gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer. * gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm". (save-directory-excursion, load-larceny-benchmark): New procedures. (%options): New variable. (show-help, parse-args): New procedures. (main): Use `parse-args' and `load-larceny-benchmark'. 2008-11-10 Andy Wingo remove .cvsignore files 2008-11-05 Ludovic Courtès Work around unintentional retention of modules by the GC. This reverts par of "Document the failure of `gc.test' wrt. unused modules." (commit 328efeb9a66dddcf78a24fad96d3db58e9c3375d.) * ice-9/boot-9.scm (set-module-eval-closure!): Don't set the `module' property on CLOSURE. * libguile/modules.c (scm_lookup_closure_module): Call `abort ()' to make it clear that code that uses the `module' property no longer works. That code is unused anyway. 2008-11-04 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/threads.c 2008-11-02 Ludovic Courtès Remove the SMOB mark procedure for source properties. * libguile/srcprop.c (srcprops_mark): Remove. (scm_init_srcprop): Remove call to `scm_set_smob_mark ()'. 2008-11-02 Andy Wingo proper printing of thunks, reduced disasm verbosity * module/system/vm/disasm.scm (disassemble-program): Don't print the nargs= nrest= etc line, it's redundant. * module/system/vm/program.scm (program-bindings-as-lambda-list): If the program bindings is null, then that's that. 2008-11-01 Andy Wingo define macros before functions using macros; more MV fixen in srfi-69 * module/srfi/srfi-69.scm: Move the macros up before the functions that use them, so that the compiler can do its job. (hash-table-walk): While it is true about what I said about R5RS before, it seems that for R6 this will have to change. Anyway. In the meantime, since the test suite checks that hash-table-walk procedures' return values and number of return values are ignored, call that procedure within a call-with-values. 2008-11-01 Andy Wingo fix for (apply values '(1)) * libguile/vm-i-system.c (return/values): In the multiple-values-to-a-single-value-continuation (or MV but where N=1), null out the correct number of values from the stack. Fixes aborts on (apply values '(1)). * testsuite/t-values.scm (call-with-values): Add a test. 2008-11-01 Andy Wingo fix multiple values coming from interpreted or C procedures * libguile/vm-i-system.c (call, goto/args): Handle the case in which a non-program (i.e. interpreted program or a subr) returns multiple values. * testsuite/t-values.scm: Add test case that exhibited this problem. 2008-11-01 Andy Wingo make-procedure-with-setter inherits name from getter * libguile/procs.c (scm_make_procedure_with_setter): Patch through the getter's procedure name to the procedure-with-setter. Fixes part of the srfi-17 test, as the VM doesn't set procedure-name on define -- but perhaps that is the bug that should be fixed. In any case this patching is cheap. * test-suite/tests/eval.test: Change so that (define name pws) is initially passed an anonymous procedure-with-setter, as was the case before the procs.c change. 2008-11-01 Andy Wingo avoid delivering 0 values to 1-valued continuations in srfi-19 * module/srfi/srfi-19.scm: Some parts of this code used a strange idiom, `(values)', to indicate that a procedure did nothing. However, quoth R5RS: Except for continuations created by the `call-with-values' procedure, all continuations take exactly one value. Indeed the VM indicated this error. I reworked the code to avoid these cases. 2008-11-01 Andy Wingo move scm srfi files to module/srfi, and compile them. * .gitignore: Add gdb-pre-inst-guile. * configure.in: Add module/srfi/Makefile. * module/Makefile.am: Add srfi/. * module/srfi/: SRFI scheme files moved here, and compiled. * srfi/Makefile.am: Remove the bits about the scheme files. 2008-11-01 Andy Wingo move guilec.mk to am/guilec * am/Makefile.am: * am/guilec: guilec moved here from /guilec.mk. All includers of guilec adapted. 2008-11-01 Andy Wingo remove stale env script, clean up gdb-pre-inst-guile * env: Removed (a vestige of the guile-vm merge). * gdb-pre-inst-guile.in: Make a bit more robust (using libtool --mode=execute). 2008-11-01 Andy Wingo move ice-9/ and oop/ under module/ Moved ice-9/ and oop/ under module/, with the idea being that we have only scheme under module/. Adjusted configure.in and Makefile.am appropriately. Put oop/ at the end of the compilation order. 2008-10-31 Ludovic Courtès Fix initialization of the SMOB GC "kind". * libguile/smob.c (scm_smob_prehistory): When initializing SMOB_GC_KIND, pass 1 as the CLEAR_NEW_OBJECTS argument to `GC_new_kind ()'. Without this, an assertion failure is triggered in libgc's `reclaim.c'. 2008-10-31 Andy Wingo compile goops accessors. woot! * oop/goops.scm: Define compiler hooks for dealing with @slot-ref and @slot-set!. (make-bound-check-get, make-get, make-set): Compile these indexed accessors instead of having them be closures. Probably slower for the memoizer, but faster for the vm... not sure what the perfect solution is. * test-suite/tests/goops.test ("defining classes"): Add a test that defining a class with accessors works (it didn't until I figured out that (@ (system base compile) compile) thing). 2008-10-31 Andy Wingo new ops: slot-ref, slot-set. remove and recompile your .go files * libguile/vm-i-scheme.c (slot-ref, slot-set): New ops. fix bug in define-scheme-translator * module/language/scheme/translate.scm (define-scheme-translator): Fix a bug in this macro for the syntax-error case. pass backtraces through the compiler * module/system/base/compile.scm (call-with-nonlocal-exit-protect): New helper, like unwind-protect but only for nonlocal exits. (call-with-output-file/atomic): Use call-with-nonlocal-exit-protect so that we don't mess up backtraces by catching all and then rethrowing. Should fix this more comprehensively somewhere, though. make define-inline more usable from external modules * module/system/il/inline.scm (define-inline): Use @ when accessing module vars so that other modules don't need to import all of our modules. However case-lambda is still needed. rework the scheme translator so it's extensible by external modules * module/language/scheme/translate.scm (*translate-table*) (define-scheme-translator): Rework the translator to have the clauses defined separately via the define-scheme-translator macro, so that external modules can define their own translators. Should be no functional change in this commit, though. 2008-10-31 Andy Wingo compile goops submodules, goops.test now passes again * libguile/goops.c (get_slot_value, set_slot_value): While keeping the inlined getter/setter dispatch for closures, allow the getters and setters to be any kind of procedure. * oop/goops.scm (compute-getters-n-setters): Relax the checks on getter/setter procedures, so that if a getter is a procedure but not a closure, we don't try to poke its arity. * oop/goops/Makefile.am (SOURCES): Compile all the goops submodules! * oop/goops/old-define-method.scm: Removed, in an act of housekeeping. * oop/goops/compile.scm: * oop/goops/dispatch.scm: Break a circular module dependency by making sure that (oop goops) is loaded when we go to compile submodules. * oop/goops/compile.scm (compile-method/memoizer) (compile-method/memoizer+next): Allow a procedure without source through. This can happen with getter and setter lambdas that were compiled, and in that case there is no next-method call anyway. Ideally we should be able to specify compile-method for accessor methods... 2008-10-31 Andy Wingo fix chaining up from interpreted to compiled methods; allow compiled init-thunk * libguile/goops.c (scm_sys_initialize_object): Don't assume that an init thunk is a closure; just go through scm_call_0 instead. * oop/goops/compile.scm (make-make-next-method/memoizer): Allow for the case that the next method is compiled. 2008-10-31 Ludovic Courtès Don't invoke `on_thread_exit ()' from a pthread key destructor. The `on_thread_exit ()' function allocates memory via libgc. When called from the context of a pthread key detructor, the thread is essentially "dead" already and `GC_lookup_thread ()' returns NULL, which triggers an assertion in libgc's `thread_local_alloc.c'. This patch arranges so that `on_thread_exit ()' is called from a suitable context. * libguile/threads.c (on_thread_exit): Remove now invalid comment about access to libgc's TLS. (init_thread_key): Don't pass `on_thread_exit ()' to `scm_i_pthread_key_create ()'. (scm_leave_guile_cleanup): Invoke `do_thread_exit ()'. (really_launch): Invoke `pthread_exit ()'. 2008-10-31 Andy Wingo compile goops The pending task is to make the accessors compiled too, and also to compile compile.scm and dispatch.scm, and to integrate dispatch into the VM. * oop/Makefile.am (SOURCES): VM-ify the makefile, so we compile goops.scm by default. * oop/goops.scm (load-toplevel): Load goops builtins when compiling too. (method): Fix a literal # in the generated procedure (for an empty body). (internal-add-method!): Cleverness when bootstrapping add-method!. Neat! (initialize for ): Use the `method' macro so we get compilation support. * oop/goops/dispatch.scm (cache-methods): Don't assume entries are pairs. 2008-10-30 Andy Wingo compile occam-channel * ice-9/Makefile.am (SOURCES): Compile the goops-using occam-channel.scm. 2008-10-30 Andy Wingo fix up some assumptions that cmethods were lists * libguile/eval.i.c (type_dispatch, apply_vm_cmethod) (apply_memoized_cmethod): Tweak the nastiness a bit more so as to deal with the '(no-method) empty entries. I would like to stop the search if the cdr isn't a pair, but currently with the inlined memoized bits, the cdr is a pair. The fix would be to make the memoizer return a procedure and not the already-inlined bits -- slightly slower but the vm will be faster anyway. * libguile/objects.c (scm_mcache_lookup_cmethod): Same fixes here. * oop/goops/dispatch.scm (cache-hashval, cache-try-hash!): Allow non-list cmethod tails. 2008-10-30 Andy Wingo runtime byte compilation of goops methods, whooooo * ice-9/boot-9.scm (make-modules-in): Change to make sure that we are making modules in modules; that is, that a global binding of `compile' doesn't prevent a module from importing a submodule named `compile'. (resolve-module): Clean up a bit, and serialize the logic. * libguile/objects.c (scm_mcache_lookup_cmethod, scm_apply_generic): * libguile/eval.i.c (CEVAL): Now that cmethod entries can have a program as their tail instead of a memoized proc, we have to change the halting condition on the method cache search, in both places: the one that's inlined into eval.i.c and the one in objects.c. If the cmethod isn't a pair, apply it. * libguile/goops.c (make): In the `make' procedure that's used before GOOPS is booted, bind #:formals, #:body, and #:compile-env on methods. * oop/goops/compile.scm (compute-entry-with-cmethod): There was a terrible trick here that involved putting a dummy pair in the cache, then modifying it in place with the result of memoization. The note claimed that this was to cut recursion short, or something. I can't see how it could recurse, given that `methods' is changing each time. Also, the pair trick doesn't work with byte-compiled methods. So, remove it. (compile-method): Dispatch to the appropriate method compiler, based on whether the method was defined with the interpreter or with the compiler. (make-next-method): New function, generically computes a `next-method' procedure, though the caller has to supply the arguments. (compile-method/vm): Exciting method byte compiler! (make-make-next-method/memoizer, compile-method/memoizer): Add the /memoizer suffix, and move all this code to the bottom of the file. 2008-10-30 Andy Wingo recompiling with compile environments, fluid languages, cleanups * ice-9/boot-9.scm (compile-time-environment): Remove definition from boot-9 -- instead, autoload it and `compile' from (system base compile). * libguile/objcodes.h: * libguile/objcodes.c (scm_objcode_to_program): Add an optional argument, `external', the external list to set on the returned program. * libguile/vm-i-system.c (externals): New instruction, returns the external list. Only used by (compile-time-environment). * libguile/vm.c (scm_load_compiled_with_vm): Adapt to scm_objcode_to_program change. * module/language/scheme/translate.scm (translate): Actually pay attention to the environment passed as an argument. (custom-transformer-table): Expand out (compile-time-environment) to something that can be passed to `compile'. * module/system/base/compile.scm (*current-language*): Instead of hard-coding `scheme' in various places, use a current language fluid, initialized to `scheme'. (compile-file, load-source-file): Adapt to *current-language*. (load-source-file): Ada (scheme-eval): Removed, no one used this. (compiled-file-name): Don't hard-code "scm" and "go"; instead use the %load-extensions and %load-compiled-extensions. (cenv-module, cenv-ghil-env, cenv-externals): Some accessors for compile-time environments. (compile-time-environment): Here we define (compile-time-environment) to something that will return #f; the compiler however produces different code as noted above. (compile): New function, compiles an expression into a thunk, then runs the thunk to get the value. Useful for procedures. The optional second argument can be either a module or a compile-time-environment; in the latter case, we can recompile even with lexical bindings. (compile-in): If the env specifies a module, set that module for the duration of the compilation. * module/system/base/syntax.scm (%compute-initargs): Fix a bug where the default value for a field would always replace a user-supplied value. Whoops. * module/system/il/ghil.scm (ghil-env-dereify): New function, takes the result of ghil-env-reify and turns it back into a GHIL environment. * scripts/compile (compile): Remove some of the tricky error handling, as the library procedures handle this for us. * test-suite/tests/compiler.test: Add a test for the dynamic compilation bits. 2008-10-28 Ludovic Courtès Document the impossibility to call the GC from within `on_thread_exit ()'. * libguile/threads.c (on_thread_exit): Add `FIXME' comment. 2008-10-26 Neil Jerram Fix stack calibration-related errors when running make distcheck. * libguile/Makefile.am (stack-limit-calibration.scm): Use $(srcdir), to support building in a different directory. (MOSTLYCLEANFILES): Add stack-limit-calibration.scm. 2008-10-25 Andy Wingo add `formals', `body', and `compile-env' slots to * ice-9/boot-9.scm (compile-time-environment): Return #f instead of erroring under the interpreter, a bit more sane. * libguile/goops.c (create_standard_classes): * libguile/goops.h (scm_si_formals, scm_si_body, scm_si_compile_env): * oop/goops.scm (method, initialize): Add `formals', `body', and `compile-env' slots to . 2008-10-25 Andy Wingo defmacroize (oop goops accessors), (oop goops save) * oop/goops/accessors.scm (define-class-with-accessors) (define-class-with-accessors-keywords): Turn into defmacros. * oop/goops/save.scm (readable, restore, write-component): Turn into defmacros. Both of these changes are untested, unfortunately. 2008-10-25 Andy Wingo add `compile-time-environment' * ice-9/boot-9.scm (compile-time-environment): New function, with documentation. The trick is that the compiler recognizes calls to (compile-time-environment) and replaces it with a representation of the *available* lexicals. Note that this might not be all the lexicals; only the heap-allocated ones are returned. * module/language/scheme/translate.scm (custom-transformer-table): Compile `compile-time-environment' to . * module/system/il/compile.scm (codegen): Add clause, which calls ghil-env-reify. * module/system/il/ghil.scm (ghil-env-reify): New procedure, returns a list of (NAME . EXTERNAL-INDEX). (): Add object. 2008-10-25 Andy Wingo define-type no longer expects `|' subform * module/system/base/syntax.scm (define-type): Rework to not require the `|', which confuses Emacs. * module/system/il/ghil.scm (): * module/system/il/glil.scm (): Adapt to define-type changes. 2008-10-25 Neil Jerram Add measure-hwm.scm to the set of distribution files. * libguile/Makefile.am (EXTRA_DIST): Add measure-hwm.scm. 2008-10-24 Neil Jerram Fix hang in srfi-18.test * libguile/threads.h (held_mutex): New field. * libguile/threads.c (enqueue, remqueue, dequeue): Use critical section to protect access to the queue. (guilify_self_1): Initialize held_mutex field. (on_thread_exit): If held_mutex non-null, unlock it. (fat_mutex_unlock, fat_cond_free, scm_make_condition_variable, fat_cond_signal, fat_cond_broadcast): Delete now unnecessary uses of c->lock. (fat_mutex_unlock): Pass m->lock to block_self() instead of c->lock; move scm_i_pthread_mutex_unlock(m->lock) call from before block_self() to after. (scm_pthread_cond_wait, scm_pthread_cond_timedwait, scm_i_thread_sleep_for_gc): Set held_mutex before pthread call; reset it afterwards. I was seeing a hang in srfi-18.test, when running make check in master, in the "exception handler installation is thread-safe" test. It wasn't 100% reproducible, so looked like a race. The problem is that wait-condition-variable is not actually atomic in the way that it is supposed to be. It unlocks the mutex, then starts waiting on the cond var. So it is possible for another thread to lock the same mutex, and signal the cond var, before the wait-condition-variable thread starts waiting. In order for wait-condition-variable to be atomic - e.g. in a race where thread A holds (Scheme-level) mutex M, and calls (wait-condition-variable C M), and thread B calls (begin (lock-mutex M) (signal-condition-variable C)) - it needs to call pthread_cond_wait with the same underlying mutex as is involved in the `lock-mutex' call. In terms of the threads.c code, this means that it has to use M->lock, not C->lock. block_self() used its mutex arg for two purposes: for protecting access and changes to the wait queue, and for the pthread_cond_wait call. But it wouldn't work reliably to use M->lock to protect C's wait queue, because in theory two threads can call (wait-condition-variable C M1) and (wait-condition-variable C M2) concurrently, with M1 and M2 different. So we either have to pass both C->lock and M->lock into block_self(), or use some other mutex to protect the wait queue. For this patch, I switched to using the critical section mutex, because that is a global and so easily available. (If that turns out to be a problem for performance, we could make each queue structure have its own mutex, but there's no reason to believe yet that it is a problem, because the critical section mutex isn't used much overall.) So then we call block_self() with M->lock, and move where M->lock is unlocked to after the block_self() call, instead of before. That solves the first hang, but introduces a new one, when a SRFI-18 thread is terminated (`thread-terminate!') between being launched (`make-thread') and started (`thread-start!'). The problem now is that pthread_cond_wait is a cancellation point (see man pthread_cancel), so the pthread_cond_wait call is one of the few places where a thread-terminate! call can take effect. If the thread is cancelled at that point, M->lock ends up still being locked, and then when do_thread_exit() tries to lock M->lock again, it hangs. The fix for that is a new `held_mutex' field in scm_i_thread, which is set to point to the mutex just before a pthread_cond_(timed)wait call, and set to NULL again afterwards. If on_thread_exit() finds that held_mutex is non-NULL, it unlocks that mutex. A detail is that checking and unlocking held_mutex must be done before on_thread_exit() calls scm_i_ensure_signal_delivery_thread(), because the innards of scm_i_ensure_signal_delivery_thread() can do another pthread_cond_wait() call and so overwrite held_mutex. But that's OK, because it's fine for the mutex check and unlock to happen outside Guile mode. Lastly, C->lock is then not needed, so I've removed it. 2008-10-24 Neil Jerram Fix hang in srfi-18.test * libguile/threads.h (held_mutex): New field. * libguile/threads.c (enqueue, remqueue, dequeue): Use critical section to protect access to the queue. (guilify_self_1): Initialize held_mutex field. (on_thread_exit): If held_mutex non-null, unlock it. (fat_mutex_unlock, fat_cond_free, scm_make_condition_variable, fat_cond_signal, fat_cond_broadcast): Delete now unnecessary uses of c->lock. (fat_mutex_unlock): Pass m->lock to block_self() instead of c->lock; move scm_i_pthread_mutex_unlock(m->lock) call from before block_self() to after. (scm_pthread_cond_wait, scm_pthread_cond_timedwait, scm_i_thread_sleep_for_gc): Set held_mutex before pthread call; reset it afterwards. I was seeing a hang in srfi-18.test, when running make check in master, in the "exception handler installation is thread-safe" test. It wasn't 100% reproducible, so looked like a race. The problem is that wait-condition-variable is not actually atomic in the way that it is supposed to be. It unlocks the mutex, then starts waiting on the cond var. So it is possible for another thread to lock the same mutex, and signal the cond var, before the wait-condition-variable thread starts waiting. In order for wait-condition-variable to be atomic - e.g. in a race where thread A holds (Scheme-level) mutex M, and calls (wait-condition-variable C M), and thread B calls (begin (lock-mutex M) (signal-condition-variable C)) - it needs to call pthread_cond_wait with the same underlying mutex as is involved in the `lock-mutex' call. In terms of the threads.c code, this means that it has to use M->lock, not C->lock. block_self() used its mutex arg for two purposes: for protecting access and changes to the wait queue, and for the pthread_cond_wait call. But it wouldn't work reliably to use M->lock to protect C's wait queue, because in theory two threads can call (wait-condition-variable C M1) and (wait-condition-variable C M2) concurrently, with M1 and M2 different. So we either have to pass both C->lock and M->lock into block_self(), or use some other mutex to protect the wait queue. For this patch, I switched to using the critical section mutex, because that is a global and so easily available. (If that turns out to be a problem for performance, we could make each queue structure have its own mutex, but there's no reason to believe yet that it is a problem, because the critical section mutex isn't used much overall.) So then we call block_self() with M->lock, and move where M->lock is unlocked to after the block_self() call, instead of before. That solves the first hang, but introduces a new one, when a SRFI-18 thread is terminated (`thread-terminate!') between being launched (`make-thread') and started (`thread-start!'). The problem now is that pthread_cond_wait is a cancellation point (see man pthread_cancel), so the pthread_cond_wait call is one of the few places where a thread-terminate! call can take effect. If the thread is cancelled at that point, M->lock ends up still being locked, and then when do_thread_exit() tries to lock M->lock again, it hangs. The fix for that is a new `held_mutex' field in scm_i_thread, which is set to point to the mutex just before a pthread_cond_(timed)wait call, and set to NULL again afterwards. If on_thread_exit() finds that held_mutex is non-NULL, it unlocks that mutex. A detail is that checking and unlocking held_mutex must be done before on_thread_exit() calls scm_i_ensure_signal_delivery_thread(), because the innards of scm_i_ensure_signal_delivery_thread() can do another pthread_cond_wait() call and so overwrite held_mutex. But that's OK, because it's fine for the mutex check and unlock to happen outside Guile mode. Lastly, C->lock is then not needed, so I've removed it. 2008-10-23 Ludovic Courtès Expose `GC_dump ()' at the Scheme level. * libguile/gc.h (scm_gc_dump): New declaration. * libguile/gc.c (scm_gc_dump): New function. 2008-10-23 Andy Wingo method is a defmacro. * oop/goops.scm (method): Make into a defmacro. define-method is a defmacro * oop/goops.scm (define-method): Make into a defmacro -- didn't change any of the logic, but the logic is a bit dodgy (see the note in the source). define-generic, define-accessor are defmacros too * oop/goops.scm (define-generic, define-accessor): Define as defmacros. I find their semantics to be a bit odd, though -- but the test case checks for this behavior, so we'll follow the test cases. make `define-class' and `class' into defmacros * oop/goops.scm: Use srfi-1, as util.scm already does. (kw-do-map): New helper for processing keyword args. (define-class-pre-definition, define-class): Rework so that define-class is a defmacro without side effects. There are two functional differences: we don't check that define-class is called only at the toplevel, because defining a lexical class might makes sense, and defmacros don't give us the toplevel check that we would want. Second in the redefinition case, we don't do a `define', as we don't actually need a new variable. (class): Similarly, make `class' a defmacro. 2008-10-18 Andy Wingo fix typo in assembler * module/system/vm/assemble.scm (dump-object!): Whoops, spell `nexts' correctly. 2008-10-18 Andy Wingo fix bug in self-tail-recursion with "external" variables; other sundries * gdbinit (pp, inst): New commands. * libguile/vm-engine.c (vm_error_not_a_pair): New error case. * libguile/vm-i-scheme.c (VM_VALIDATE_CONS): New macro -- use this instead of SCM_VALIDATE_* because SCM_VALIDATE will exit nonlocally before we have a chance to sync the regs. (car, cdr, set-car, set-cdr): Use VM_VALIDATE_CONS. * libguile/vm-i-system.c (goto/args): Bugfix: when doing a self-tail-recursion, allocate fresh externals. Fixes use of match.go. * module/system/vm/assemble.scm (dump-object!): Add some checks that we aren't dumping out values that the VM can't handle. * module/system/vm/disasm.scm (disassemble-externals): Fix rotten call to `print-info'. * oop/goops/dispatch.scm: Add a FIXME. * testsuite/Makefile.am (vm_test_files): * testsuite/t-closure4.scm (extract-symbols): New test, distilled with much effort out of match.scm. * ice-9/Makefile.am (NOCOMP_SOURCES): Re-enable compilation of match.scm. Yay! 2008-10-18 Andy Wingo bug fix to enable code "packing" * module/system/vm/conv.scm (code-pack): Fix so that we actually recognize (make-int8 1) and turn it into (make-int8:1). 2008-10-17 Neil Jerram Avoid `Stack overflow' errors when running `make check' For explanation, see comments and text in the new file libguile/measure-hwm.scm. * .gitignore: Add libguile/stack-limit-calibration.scm. * check-guile.in: Load libguile/stack-limit-calibration.scm. * configure.in: Add AC_CONFIG_FILES to generate test-use-srfi from test-use-srfi.in. * libguile/Makefile.am (TESTS, TESTS_ENVIRONMENT, stack-limit-calibration.scm): New targets, so that `make check' calibrates the stack limit before running the Guile test suite. * libguile/measure-hwm.scm: New file, calibrates stack limit for `make check'. * libguile/stackchk.c (scm_sys_get_stack_size): New primitive. * libguile/stackchk.h (scm_sys_get_stack_size): New primitive (declaration). * test-suite/standalone/test-use-srfi: Renamed test-use-srfi.in, so that ./configure can fill in variables in it. * test-suite/standalone/test-use-srfi.in: Load libguile/stack-limit-calibration.scm. 2008-10-16 Andy Wingo elisp.test: apply to nil-terminated list is UNRESOLVED with compiled boot-9 * test-suite/tests/elisp.test: If running the '(apply foo nil) test fails with a vm-error, throw UNRESOLVED. This allows the test suite to pass in the compiled boot-9.scm while still keeping the elisp apply issue open. run the elisp test with a larger stack limit * test-suite/tests/elisp.test: Enlarge the stack for the duration of the elisp test. It's a hack, but it at least allows the test to run with a compiled ice-9. fix backtraces, broken since the program-bindings format change * module/system/vm/frame.scm (frame-bindings): Fix for new binding format; actually use the bindings accessors. (frame-lookup-binding): Clarify. 2008-10-16 Andy Wingo fix use of `binding' data abstraction * module/system/vm/assemble.scm (make-temp-binding, btemp:name) (btemp:extp, btemp:index): Don't abuse program.scm's make-binding to make something that actually isn't a binding. (codegen): Do use program.scm's make-binding to make something that actually is a binding. * module/system/vm/program.scm (binding:start, binding:end): New accessors. (make-binding): Expand to have the start and end arguments in the constructor. 2008-10-16 Andy Wingo ensure that lists pushed onto the stack are proper I saw this problem when running elisp.test -- it tries to apply a function to an arglist ending in nil, which obviously is not null. * libguile/vm-engine.h (PUSH_LIST): New helper macro, pushes the elements of a list onto the stack. Checks to make sure that the list is proper. * libguile/vm-i-system.c (list-break, mv-call, apply, goto/apply) (goto/cc): Use LIST_BREAK. * libguile/vm-engine.c (vm_error_improper_list): New error case. 2008-10-16 Andy Wingo fix asyncs running in the vm; re-enable popen.scm compilation * libguile/vm-i-system.c (goto/args): Sync the registers before doing the SCM_TICK. We probably need a different SCM_TICK that saves the regs only if necessary. This fixes GC problems with a compiled popen.scm. * ice-9/Makefile.am: Re-enable popen.scm compilation. 2008-10-15 Andy Wingo fix `(help)' * ice-9/session.scm (help): Return valid scheme forms in the no-arg and no-regex cases. fix mv-call disasm bug * module/system/vm/disasm.scm (code-annotation): Fix bug with mv-call. fix disasm bugs, add some more instruction annotations * module/system/vm/disasm.scm (disassemble-program): Fix misunderstanding of nlocs: the *actual* number of locals is nlocs + nargs, even if the arg is heap-allocated -- because our calling convention always puts the initial val on the stack. Also: don't disassemble the objects, they are now woven into the text. (code-annotation): Fix external-{ref,set} handling to allow for referencing externals from enclosed stack frames. Really this should be statically determined, though. Add late-variable-{ref,set} handling. 2008-10-12 Ludovic Courtès Add GC benchmarks. 2008-10-12 Andy Wingo make disassembly better -- a more woven text. * module/system/vm/assemble.scm (pop): Define a pop here too. (codegen): Rework how bindings are represented in a program's meta-info, so they declare their range in the binding list instead of you having to figure out when they end. * module/system/vm/conv.scm (make-byte-decoder): Return the end-address as well; requires a change to callers. * module/system/vm/disasm.scm (disassemble-objcode, disassemble-program) (disassemble-bytecode, disassemble-objects, disassemble-externals) (disassemble-meta, source->string, make-int16, code-annotation) (print-info): Rework to display my domination of `format', and, more seriously, start to integrate the "subsections" of the disassembly into the main disassembly text. * module/system/vm/program.scm (program-bindings-as-lambda-list): Update for new bindings format; should be more correct. 2008-10-11 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/threads.c 2008-10-11 Andy Wingo simplify disassembly annotations a bit * module/system/vm/disasm.scm (original-value): Simplify a bit to normally dispatch on the instruction, only trying code->object at the end. make each invocation of `while' throw to different keys * ice-9/boot-9.scm (while): Further fixes to while, brought out by the test suite. Also updated documentary comments. relax an assertion -- the test suite completes without aborting, whee * libguile/vm-i-system.c (call/cc, goto/cc): Don't assert that ip matches vp->ip, because vp->ip is not restored by vm_reset_stack, and indeed it's re-set to 0 by `halt'. But still, perhaps reset_stack and halt should indeed reset vp->ip. 2008-10-11 Andy Wingo truly thread-local vms; don't compile popen.scm * ice-9/Makefile.am: Don't compile popen.scm, its behaviour at runtime is not consistent -- seems to miss some GC references? I suspect a bug in the compiler. In any case without popen.scm being compiled, continuations.test, r4rs.tes, and r5rs_pitfall.test do pass. * libguile/threads.h (scm_i_thread): * libguile/threads.c (thread_mark, guilify_self_2): Add a field for the thread's vm. Previously I had this as a fluid, but it seems that newly created threads share their fluid values from the creator thread; as expected, I guess. In any case one VM should not be active in two threads. * libguile/vm.c (scm_the_vm): Change to access the thread-local vm, instead of accessing a fluid. (scm_the_vm_fluid): Removed. * module/system/vm/vm.scm: Removed *the-vm*. 2008-10-10 Ludovic Courtès Fix compilation error due to strict aliasing rules on `i386-unknown-freebsd7.0'. * libguile/threads.c (scm_threads_mark_stacks): Cast `&t->regs' to `(void *)' rather than `(SCM_STACKITEM *)' to avoid "warning: dereferencing type-punned pointer will break strict-aliasing rules" with GCC 4.2.1 on `i386-unknown-freebsd7.0'. 2008-10-09 Ludovic Courtès Fix compilation of the hard copy of the R5RS, tutorial and GOOPS manual. * doc/tutorial/Makefile.am (TEXINFO_TEX): Remove. * doc/goops/Makefile.am (TEXINFO_TEX): Remove. * doc/r5rs/Makefile.am (TEXINFO_TEX): Remove. 2008-10-09 Ludovic Courtès Add test case to make sure `read' returns mutable strings. * test-suite/tests/reader.test ("reading")["returned strings are mutable"]: New test, as reported by szgyg . 2008-10-09 Ludovic Courtès Revert "Make literal strings (i.e., returned by `read') read-only." This reverts commit fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4. The rationale is that `read' must return mutable strings, as reported by szgyg . 2008-10-09 Andy Wingo NULLSTACK fixes for nonlocal exits in reentrant pre-wind handlers * libguile/vm-i-system.c (goto/cc): Add some asserts here. * libguile/vm.c (capture_vm_cont): Add some asserts here too. (reinstate_vm_cont): Null the correct number of bytes. Add a FIXME. (vm_reset_stack): Make the code a bit clearer. Null the correct number of bytes. * libguile/vm-engine.h (NULLSTACK_FOR_NONLOCAL_EXIT): New macro, handles a very tricky case that took me days to find! Amply commented. Expands to nothing in the normal case. * libguile/vm-i-system.c (call, goto/args, mv-call): Call NULLSTACK_FOR_NONLOCAL_EXIT in the right places. Fixes continuations.test. 2008-10-09 Andy Wingo sundries: side effects in interpreted repl, wrong-num-args in vm, self-checks * libguile/vm-engine.c (vm_error_wrong_num_args): Sync the registers before calling scm_wrong_num_args. (The other cases are handled more uniformly.) * libguile/vm.c (vm_heapify_frames_1): Add a FIXME: I don't think we should be modifying the stack. (scm_vm_save_stack): If stack nulling is enabled, verify the stack here before reifying it. * module/language/scheme/spec.scm (scheme): Use primitive-eval here instead of eval, because at the repl we do want to allow evaluations to have side effects like setting the current module. 2008-10-09 Andy Wingo handle throws to unknown keys in the repl * module/system/repl/repl.scm (default-catch-handler): Don't rethrow if we don't know the key, just print an error. fix dynwind + nonlocal entrance/exit + programs bug * libguile/dynwind.c (scm_i_dowinds): Invoke guard procedures when entering and exiting nonlocally. Previously this procedure was program-racist. 2008-10-03 Andy Wingo precise stack marking, fix some missed references, still imperfect * libguile/vm-engine.h (CHECK_STACK_LEAK, NULLSTACK): Add a new mode, VM_ENABLE_STACK_NULLING, that tries to ensure that all stack data past the top of the stack is NULL. This helps to verify the VM's consistency. If VM_ENABLE_STACK_NULLING is not defined, there is no overhead. (DROP, DROPN): Hook into NULLSTACK. (POP_LIST): Hoo, fix a good bug: if CONS triggered a GC, the elements of the list that had not yet been consed would not be marked, because the sp was already below them. (NEXT): Hook into CHECK_STACK_LEAK. (INIT_ARGS): Add a note that consing the rest arg can cause GC. (NEW_FRAME): Cons up the external data after initializing the frame, so that if GC is triggered, the precise marker sees a well-formed frame. * libguile/vm-i-loader.c (load-program): In the four-integers case, use the POP macro so that we can hook into NULLSTACK (if necessary). * libguile/vm-i-scheme.c (ARGS2, ARGS3): Hook into NULLSTACK. * libguile/vm-i-system.c (halt): Null the nvalues. Rework some asserts into using ASSERT, and null the stack when we free the frame. (variable-set): Use DROPN instead of sp -= 2. (BR): Hook into NULLSTACK. (goto/args): Hook into NULLSTACK. In the non-self case, delay updating the frame until after INIT_ARGS so that GC sees a well-formed frame. Delay consing the externals until after the frame is set up, as in NEW_FRAME. (call/cc): Add some asserts. (return): Rework some asserts into ASSERT, and hook into NULLSTACK. (return/values): Hook into NULLSTACK, and use ASSERT. (return/values*) Use ASSERT. * libguile/vm.c (VM_ENABLE_ASSERTIONS, VM_ENABLE_STACK_NULLING): These are the variables that control assertions and nulling. Perhaps we can do these per-engine when we start compiling the debug engine separate from a speedy engine. (vm_mark_stack): Add a precise stack marker. Yay! (vm_cont_mark): Mark the continuation stack precisely. (capture_vm_cont): Record the difference from the vp's stack_base too, so that we can translate the dynamic links when marking the continuation stack. Memset the stack to NULL if we are doing nulling. (reinstate_vm_cont): If we are nulling, null out the relevant part of the stack. (vm_reset_stack): When resetting sp due to a nonlocal exit, null out the stack too. (vm_mark): If we are nulling, assert that there are no extra values on the stack. Mark the stack precisely. 2008-10-03 Andy Wingo remove repl.scm's start-stack definition * module/system/repl/repl.scm: Now that we actually compile start-stack, no need to provide our own definition here. add gdb-pre-inst-guile * configure.in: * gdb-pre-inst-guile.in: Add gdb-pre-inst-guile, because I'm tired of typos. You can run it just like Guile. For compiling, you might try GUILE=./gdb-pre-inst-guile scripts/compile foo.scm. 2008-10-02 Andy Wingo be more like the interpreter in signalling wrong-num-args * libguile/vm-engine.c: Call scm_wrong_num_args in the wrong-num-args case, to be more like the interpreter. * libguile/vm-engine.h (ASSERT): New macro. * libguile/vm-i-system.c (apply, goto/apply): Assert that nargs >= 2, because the compiler should always feed us correct instructions. (call/cc): If no values are returned to the continuation, signal no_values instead of wrong_num_args. 2008-09-30 Andy Wingo load the i18n extension when compiling i18n.scm * ice-9/i18n.scm: Load the i18n extension when compiling too, so that the macros that depend on (provided? 'nl-langinfo) actually have nl-langinfo. Fixes the i18n test. 2008-09-30 Andy Wingo fix compilation of quasiquote with splicing and improper lists * libguile/vm-engine.h (POP_CONS_MARK): New macro, analagous to POP_LIST_MARK; used in quasiquote on improper lists. * libguile/vm-i-system.c (cons-mark): New instruction. You know the drill, remove all your .go files please. * module/system/il/compile.scm (codegen): Compile quasiquoted improper lists with splices correctly. Additionally check that we don't have slices in the CDR of an improper list. * testsuite/t-quasiquote.scm: Add a test for unquote-splicing in improper lists. 2008-09-30 Andy Wingo fix some missed references when calling C functions * gdbinit: Update to be a bit more useful. * libguile/vm-i-system.c: Make sure that arguments to C procedures are visible on the stack so they get marked. Could be a source for the missed references. 2008-09-30 Andy Wingo Merge commit 'origin/master' into vm Conflicts: doc/Makefile.am ice-9/Makefile.am libguile/gc.c 2008-09-30 Andy Wingo (oop goops) works again, after (the-environment) removal * oop/goops.scm: Update so as not to use (the-environment), which no longer exists. I think that the speed characteristics are the same, broadly speaking. object-documentation knows about programs * ice-9/documentation.scm (object-documentation): Add hooks for getting documentation for compiled procedures, too. (Goops would be helpful here.) don't require users of users of optargs to have used optargs * ice-9/optargs.scm: Do the compile-friendly equivalent of unquoting in a value into the macro: use @@. 2008-09-30 Andy Wingo compile @ and @@ * libguile/vm-engine.c (vm_run): Add new error case for resolving @ or @@ references, but there is no such module. Possible if module-public-interface returns #f. * libguile/vm-i-loader.c (link-now): Allow the stack arg to be a sym, as before, or a list, indicating an absolute reference. Could be two separate instructions, but I'm lazy. * libguile/vm-i-system.c (late-variable-ref, late-variable-set): As in link-now, allow the lazy reference to be a list, for @ and @@. * module/language/scheme/translate.scm (custom-transformer-table): Compile @ and @@, and set! forms for both of them. This will ease the non-hygienic pain for exported macros. * module/system/il/compile.scm (make-glil-var): Translate public and private module variable references into glil-module variables. * module/system/il/ghil.scm (ghil-var-at-module!): New function, resolves a variable for @ or @@. * module/system/il/glil.scm (): Revival of , this time with the semantics that it really links to a particular module. * module/system/vm/assemble.scm (, ): Redefine as taking a "key" as the argument, which may be a sym or a list; see the notes on link-now for more details. (codegen): Compile appropriately. Some duplication here, probably could use some cleanup later. 2008-09-29 Andy Wingo call toplevel variables "toplevel", not "module" * module/system/il/ghil.scm (ghil-var-for-set!, ghil-var-for-ref!) (ghil-var-define!): ghil-var-kind of a toplevel var is now 'toplevel. * module/system/il/glil.scm: Renamve to . Remove the unused `module' field. Remove the unused type. * module/system/il/compile.scm (make-glil-var): s/toplevel/module/ * module/system/vm/assemble.scm (, ): Remove the unused `module' parameters from these two types. (codegen, dump-object!): Adapt to module/toplevel name changes. 2008-09-29 Andy Wingo remove `type' and `value' fields from * module/system/il/ghil.scm (): Remove `type' and `value' fields, as they were not used. move module-public-interface to C, and expose it as C API * libguile/modules.h: * libguile/modules.c: * ice-9/boot-9.scm (module-public-interface): Move definition of module-public-interface to C, where it is now available as scm_module_public_interface (). 2008-09-28 Han-Wen Nienhuys Remove GH and its traces. 2008-09-28 Andy Wingo allocate variables that are set! on the heap * module/system/il/ghil.scm (ghil-lookup): So, it turns out this function needed to be split into three: (ghil-var-is-bound?, ghil-var-for-ref!, ghil-var-for-set!): The different facets of ghil-lookup. Amply commented in the source. The difference being that we now allocate variables that are set! on the heap, so that other continuations see their possibly-modified values. (force-heap-allocation!): New helper. * testsuite/Makefile.am: * testsuite/t-call-cc.scm: New test, that variables that are set! are allocated on the heap, so that subsequent modifications are still seen by the continuation. The test was distilled from test 7.3 in r5rs_pitfall.test. 2008-09-28 Andy Wingo revert part of 7ff017002ddc980 that caused missed references * libguile/programs.c (scm_c_make_closure): If the program is actually not a program, abort. This can happen if GC misses a reference, as currently seems to happen. * libguile/vm.c (vm_mark): Revert part of 7ff017002ddc980f684120653549a10c6c7cde5c, which changed the call to scm_mark_locations. I'm 99% *sure* this is wrong, but it seems to prevent missed references when recompiling the .go files in guile itself. Needs revisiting soon, but for the time being we can go back to where we were a couple of days ago. * libguile/vm-i-system.c (halt, vector, vector-mark): Sync the registers before calling into C, as it may GC. 2008-09-28 Andy Wingo don't compile psyntax.scm * ice-9/Makefile.am: Don't try to compile psyntax.scm 2008-09-26 Ludovic Courtès Don't use `scm_leave_guile ()' in mutex/cond-related procedures. * libguile/threads.c (scm_pthread_mutex_lock, scm_pthread_cond_wait, scm_pthread_cond_timedwait): Don't call `scm_{leave,enter}_guile ()'. Implement `scm_std_select ()' in terms of `scm_without_guile ()'. * libguile/threads.c (struct select_args): New. (do_std_select): New function. (scm_std_select): Don't use `scm_{leave,enter}_guile ()' since they don't have any effect; use `scm_without_guile ()' instead. 2008-09-26 Andy Wingo rename psyntax.ss to psyntax.scm to hack around makefile foo * ice-9/Makefile.am (SOURCES): * ice-9/syncase.scm: * ice-9/psyntax.scm: Renamve psyntax.ss to psyntax.scm. This way the guilec rules won't delete it on a make clean. Doh! 2008-09-26 Andy Wingo Fix continuation marking, and some tests. * libguile/continuations.c (continuation_mark): Mark the vm continuations. * libguile/vm.c (vm_cont_mark): Fix the marking function. (vm_mark): Fix this one too -- the size is a number of STACKITEMS, which we foolishly assume are the same size as SCM. * test-suite/tests/ftw.test: Make our stat hacks verifyable without assuming that they are interpreted. * test-suite/tests/r5rs_pitfall.test: Re-indent. 2008-09-26 Andy Wingo actually compile start-stack to something useful * ice-9/boot-9.scm (start-stack): Define as a defmacro instead of an acro in C. We have a way to delay evaluation of the exp, after all: putting it in a thunk is sufficient. * libguile/debug.h: * libguile/debug.c (scm_sys_start_stack): Renamed from scm_start_stack, and exposed to the user. Takes a thunk instead of an expression + environment. (scm_m_start_stack): Remove this acro. * module/language/scheme/translate.scm (custom-transformer-table): Remove the start-stack special case. 2008-09-25 Ludovic Courtès Enclose `regexp.test' in a module. * test-suite/tests/regexp.test: Add `define-module' clause. 2008-09-25 Ludovic Courtès Fix handling of the FLAGS argument in `fold-matches'. * ice-9/regex.scm (fold-matches): If FLAGS is non-null, use `(car flags)', not `flags'. * test-suite/tests/regexp.test ("fold-matches"): New test prefix. * NEWS: Update. 2008-09-25 Andy Wingo further compilation fixes -- all files compile fine now * ice-9/runq.scm (strip-sequence): Remove use of obtuse guile `define' extension. * ice-9/boot-9.scm (while): Redefine so as not to unquote in a procedure. Less hygienic. Perhaps we should switch to syncase at some point. * ice-9/session.scm (help): Redefine as a normal macro, so that it can be compiled. Not very useful though -- further effort should go into (system repl ...). (system-module): Removed, it didn't work, and is not useful as far as I can tell. * ice-9/string-fun.scm (string-prefix-predicate): Remove guile define extension usage. Compilation also fixed by `while' compilation fix. * ice-9/threads.scm (par-mapper): Remove guile define extension usage. 2008-09-25 Andy Wingo compile `delay' into `make-promise' with a thunk * module/language/scheme/translate.scm (custom-transformer-table): Translate `delay' into `make-promise'. 2008-09-25 Andy Wingo export `make-promise' to scheme * libguile/eval.h: * libguile/eval.c (scm_make_promise): Rename from `scm_makprom', and export as the scheme procedure, `make-promise'. * libguile/eval.i.c (CEVAL): s/makprom/make_promise/. 2008-09-25 Andy Wingo enable compilation of more modules * ice-9/Makefile.am: Compile most modules. There are still a couple that fail to compile. 2008-09-25 Andy Wingo a number of small compilation fixes * ice-9/boot-9.scm: Allow a compiled load of posix, networking, and deprecated files. * module/language/scheme/translate.scm (lookup-transformer): Lookup the sc-macro by value, not by name. Works around the fact that compiled macros don't have names, which is probably a bug. * module/system/base/compile.scm (syntax-error) (call-with-compile-error-catch): Throw and catch a key that's not used by anyone else. Write error messages to the error port. * module/system/repl/repl.scm (default-catch-handler): Call display-error with the correct number of arguments. * module/system/vm/frame.scm (frame-program-name): Guard against unbound variables. * ice-9/optargs.scm (let-keywords-template): Don't unquote in a helper procedure. A bit irritating. I suppose we should fix the modules + syncase situation at some point, and then switch to syncase. 2008-09-25 Andy Wingo compile psyntax-pp * ice-9/Makefile.am: Compile psyntax-pp.scm, which is the new name of psyntax.pp. * ice-9/syncase.scm: Load the pre-processed source as psyntax-pp so that we load up a .go file if available. 2008-09-25 Andy Wingo fix handling of multiple values from c functions * libguile/vm-i-system.c (mv-call, goto/cc): Fix handling of values returns from C or interpreted functions. add gdbinit for debugging the vm * gdbinit: Add my gdbinit. The most useful commands are gwrite and vmstack. 2008-09-25 Andy Wingo compile call/cc, yee ha * libguile/vm-i-system.c (call, goto/args): Add a FIXME for handling the case in which a call to the interpreter returns a values object. (call/cc, goto/cc): Flesh out, and handle full continuations (with the C stack also). * module/language/scheme/translate.scm (custom-transformer-table): Compile call-with-current-continuation. This is necessary so that the called procedure is called in tail position. * module/system/il/compile.scm (codegen): Translate apply to goto/apply, call/cc to goto/cc, etc when in tail position. 2008-09-25 Andy Wingo fix bug introduced in the fluid commit * libguile/vm.c (the-vm): If the dynamic binding of *the-vm* is false, make a new vm. Fixes multiple threads with the vm since the *the-vm* fluid changes. 2008-09-24 Andy Wingo make call/cc capture and restore the vm stacks * libguile/continuations.c (scm_make_continuation): Capture VM continuations as well, as their stack is outside the C stack. (copy_stack): Reinstate VM stacks with the C stack. * libguile/continuations.h (scm_t_contregs): Add a pointer for VM stacks. A binary-incompatible change -- hopefully not too many people were messing around with this struct, though. * libguile/vm-engine.c (vm_run): Add a note about possibly maintaining a stack of vms. * libguile/vm.c (struct scm_vm_cont): New struct, distinct from scm_vm. (vm_cont_mark, vm_cont_free, capture_vm_cont, reinstate_vm_cont): Reorder some code, and fix some bad assumptions about what part of the stack to copy; obviously this code was never used. * libguile/vm.h: * libguile/vm.c (scm_vm_capture_continuations) (scm_vm_reinstate_continuations): New public functions, used by continuations.c. 2008-09-24 Andy Wingo the vm is a fluid * module/system/vm/vm.scm: * libguile/vm.h: * libguile/vm.c: Make the `the-vm' procedure access a fluid, `*the-vm*'. Export that fluid from vm.h and vm.scm. 2008-09-23 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc 2008-09-23 Ludovic Courtès Make literal strings (i.e., returned by `read') read-only. * libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to return a read-only string, as mandated by R5RS. Reported by Bill Schottstaedt . * libguile/strings.c (scm_i_make_read_only_string): New function. (scm_i_shared_substring_read_only): Special-case the empty string so that the read-only and read-write empty strings are `eq?'. This optimization is relied on by the `substring/shared' `empty string' test case in `srfi-13.test'. * libguile/strings.h (scm_i_make_read_only_string): New declaration. * test-suite/tests/strings.test ("string-set!")["literal string"]: New test. * NEWS: Update. 2008-09-23 Ludovic Courtès Make `symbol->string' return a read-only string. * libguile/strings.c (scm_i_symbol_substring): Return a read-only string since R5RS requires `symbol->string' to return a read-only string. Reported by Bill Schottstaedt . * test-suite/tests/symbols.test: Add `define-module' clause. (exception:immutable-string): Adjust to current exception. ("symbol->string")["result is an immutable string"]: Use `pass-if-exception' instead of `expect-fail-exception'. * NEWS: Update. 2008-09-22 Neil Jerram Fix for incorrect (gcd -2) => -2; should give 2. (reported by Bill Schottstaedt) * libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs to ensure that result is non-negative. * test-suite/tests/numbers.test ("gcd"): New test, (gcd -2). 2008-09-19 Ludovic Courtès Use GC's accessors rather than its global variables. * libguile/gc.c (scm_storage_prehistory): Use `GC_set_free_space_divisor ()' instead of accessing the global variable directly. 2008-09-18 Ludovic Courtès Fix `strftime' documentation wrt. `%Z'. * doc/ref/posix.texi (Time)[strftime]: Remove erroneous note saying that `%Z' ignores `tm:zone'. Reported by Neil Jerram. 2008-09-18 Andy Wingo don't poke installed scm, go, etc files when running pre-inst-guile * libguile/load.c (scm_init_load_path): If GUILE_SYSTEM_PATH is set, use that instead of the compiled-in suffix to the load path. And, as a special case, GUILE_SYSTEM_PATH= is interpreted as '(). A bit nasty. * pre-inst-guile-env.in (top_builddir): Set GUILE_SYSTEM_PATH to the empty string, if it is not set. 2008-09-18 Ludovic Courtès Implement `scm_without_guile ()' in terms of `GC_do_blocking ()'. * libguile/threads.c (guilify_self_1): Initialize `t->guile_mode'. (guilify_self_2): Likewise. (struct without_guile_arg): New type. (without_guile_trampoline): New function. (scm_without_guile): Implement in terms of `GC_do_blocking ()'. * libguile/threads.h (scm_i_thread)[guile_mode]: New field. 2008-09-18 Ludovic Courtès Remove double inclusion of in `threads.c'. configure: Look for `GC_do_blocking ()' and its declaration. * configure.in: Look for `GC_do_blocking ()' and its declaration. 2008-09-18 Andy Wingo lambda-lifting for (lambda () ...) as consumer of call-with-values * libguile/vm-engine.c (vm_run): Add new error case, vm_error_not_enough_values. * libguile/vm-i-system.c (goto/nargs, call/nargs): So, in these cases, if we get too many values, we don't truncate the values like we do in the single-value continuation case, or in the mvbind case. What to do? I guess we either truncate them here, or only allow the correct number of values. Dunno. Mark the code as a fixme. (truncate-values): New instruction, for mv-bind: checks that the number of values on the stack is compatible with the number of bindings we have arranged for them, truncating if necessary. * module/language/scheme/translate.scm (custom-transformer-table): Compile receive as a primary form -- not so much because it is a primary form, but more to test the mv-bind machinery. Also it's more efficient, I think. * module/system/il/compile.scm (lift-variables!): New helper, factored out of `optimize'. (optimize): Add a few more cases. Adapt `lambda' optimization, which isn't much. I'm not happy with ghil as a mungeable language. Add a case for call-with-values with the second argument is a lambda: lift the lambda. Untested. (codegen): Refactor the push-bindings! code. Compile mv-bind. * module/system/il/ghil.scm (): Add mv-bind construct, along with its procedures. * module/system/il/glil.scm (): Add mv-bind construct, different from the high-level one. It makes sense in the source, I think. * module/system/vm/assemble.scm (codegen): Assemble glil-mv-bind by pushing onto the bindings list, and actually push some code to truncate the values. 2008-09-18 Ludovic Courtès Use the `GC_FREE_SPACE_DIVISOR' environment variable. * libguile/gc.c (scm_storage_prehistory): Initialize `GC_free_space_divisor' using the `GC_FREE_SPACE_DIVISOR' environment variable. 2008-09-18 Ludovic Courtès Fix first-time compilation Hello! The attached patch fixes first-time compilation, by ensuring SRFI modules are built before "guile-tools compile" is ever run. Thanks, Ludo'. From 691a111c440a26c021f52b4027b0d9772f8e04cc Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 16 Sep 2008 23:13:38 +0200 Subject: [PATCH] Fix compilation order of the sub-directories. * Makefile.am (SUBDIRS): Move `ice-9' past `srfi' and friends, so that the SRFI modules needed by the compiler are built before "guile-tools compile" is used. 2008-09-18 Andy Wingo fix case in which we can fail to exit the repl cleanly * module/system/repl/repl.scm (next-char): Don't throw if we get an EOF, just return the EOF object. Fixes a case in which we fail to exit cleanly. 2008-09-18 Ludovic Courtès Remove per-thread `gc_running_p'. * libguile/gc.c (scm_gc): Don't use `scm_gc_running_p' as an lvalue. * libguile/gc.h (scm_gc_running_p): Define to 0. * libguile/threads.h (scm_i_thread)[gc_running_p]: Remove. 2008-09-17 Ludovic Courtès Remove GC-related fields from `scm_i_thread'. * libguile/gc.h (scm_i_freelist, scm_i_freelist2): Remove declarations. * libguile/threads.c (resume): Don't use `t->clear_freelists_p' and `scm_i_freelist{,2}'. (scm_enter_guile, scm_leave_guile, guilify_self_1): Don't use the `heap_mutex' and other fields removed from `scm_i_thread'. (scm_i_freelist, scm_i_freelist2): Remove. * libguile/threads.h (scm_i_thread)[heap_mutex, freelist, freelist2, clear_freelists_p]: Remove. 2008-09-17 Ludovic Courtès Remove code intended to put threads to sleep. Actually, threads would "go to sleep" either by blocking on a heap allocation, or by noticing `scm_i_thread_go_to_sleep' is set when running `SCM_TICK', which limits the applicability of this technique (e.g., it was not appropriate for the shared string code). * libguile/threads.c (scm_i_thread_go_to_sleep, scm_i_thread_put_to_sleep, scm_i_thread_invalidate_freelists, scm_i_thread_wake_up, scm_i_thread_sleep_for_gc): Remove. * libguile/threads.h (scm_i_thread_go_to_sleep, scm_i_thread_put_to_sleep, scm_i_thread_invalidate_freelists, scm_i_thread_wake_up, scm_i_thread_sleep_for_gc): Remove declarations. (SCM_THREAD_SWITCHING_CODE): Do nothing. 2008-09-17 Ludovic Courtès Remove use of `scm_i_thread_put_to_sleep ()' in the string code. * libguile/strings.c (scm_i_string_writable_chars): Remove use of `scm_i_thread_put_to_sleep ()'. This leaves a race condition, which is hopefully not harmful. 2008-09-17 Ludovic Courtès Remove GC-related code from fluids. * libguile/fluids.c (all_dynamic_states, all_fluids): Remove. Together, they prevented dynamic states and fluids to be collected. Callers no longer use them. (resize_all_states): Remove. (grow_dynamic_state): New function. (next_fluid_num): Don't call `resize_all_states ()'. (scm_i_fluid_num, scm_i_fast_fluid_ref, scm_i_fast_fluid_set_x): Remove, as they broke encapsulation and would have needed duplication of the lazy dynamic state growing code. (scm_fluid_ref, scm_fluid_set_x): Lazily grow the dynamic state's fluid vector. (scm_fluids_prehistory): Don't set an `scm_after_sweep_c_hook'. * libguile/fluids.h (SCM_FLUID_NUM, SCM_FAST_FLUID_REF, SCM_FAST_FLUID_SET_X, scm_i_fluid_num, scm_i_fast_fluid_set_x, scm_i_fast_fluid_ref): Remove. * libguile/load.c (the_reader_fluid_num): Remove. (scm_primitive_load): Use `scm_fluid_ref ()' instead of `SCM_FAST_FLUID_REF ()'. (scm_init_load): Likewise. 2008-09-16 Ludovic Courtès Use immutable cells for vectors. * libguile/vectors.c (scm_c_make_vector): Use `scm_immutable_cell ()'. Use immutable double-cells for symbols. * libguile/strings.c (scm_i_make_symbol): Use `scm_immutable_double_cell ()'. Add `scm_immutable_double_cell ()'. * libguile/inline.h (scm_immutable_double_cell): New. 2008-09-16 Andy Wingo compile call-with-values, woot! * libguile/vm-engine.c (vm_run): Add another byte onto the bootstrap program, as the offset passed to mv-call now takes two bytes. * module/system/vm/frame.scm (bootstrap-frame?): Update for the new bootstrap length. Really we should just check for 'halt though. * libguile/vm-i-system.c (FETCH_OFFSET): New helper, used in BR(). (goto/nargs, call/nargs): Versions of goto/args and call, respectively, that take the number of arguments from a value on the top of the stack. (mv-call): Call FETCH_OFFSET to get the offset. * module/language/scheme/translate.scm (custom-transformer-table): Compile call-with-values to . There is some trickery because of the r4rs.scm call-with-values trampolines. * module/system/il/ghil.scm: Add and accessors. * module/system/il/compile.scm (codegen): Compile . * module/system/il/glil.scm: Add , which needs some special assembly because of the label. Fix some typos. * module/system/vm/assemble.scm (byte-length): New helper, factored out and made more general. (codegen): Assemble mv-call, including the label. (check-length): New helper, makes sure that the addressing is consistent within the produced object code. (stack->bytes): Rewrite to be more generic -- now `br' instructions aren't the only ones jumping around in the instruction stream. * module/system/vm/conv.scm (make-byte-decoder): Return two values in the #f case. * module/system/vm/disasm.scm (disassemble-bytecode): Rewrite, because the previous implementation depended on a guile interpreter quirk: namely, that multiple values could be represented within one value, and destructured later. 2008-09-15 Ludovic Courtès Use immutable cells for closures. * libguile/eval.c (scm_closure): Use `scm_immutable_cell ()' instead of `scm_cell ()'. * libguile/procs.h (SCM_SETCODE, SCM_SETENV): Remove. 2008-09-15 Ludovic Courtès Use immutable cells (aka. libgc "stubborn") for subrs. * libguile/procs.c (scm_c_make_subr): Use `scm_immutable_cell ()' instead of `scm_cell ()'. (scm_free_subr_entry): Remove. * libguile/procs.h (SCM_SET_SUBRNUM, SCM_SET_SUBRF): Remove. (scm_free_subr_entry): Remove declaration. 2008-09-15 Ludovic Courtès Add `scm_immutable_cell ()'. * libguile/inline.h (scm_immutable_cell): New. 2008-09-15 Ludovic Courtès Remove unused GC string/symbol functions. * libguile/strings.c (scm_i_stringbuf_mark, scm_i_stringbuf_free, scm_i_string_mark, scm_i_string_free, scm_i_symbol_mark, scm_i_symbol_free): Remove. * libguile/strings.h: Remove corresponding declarations. 2008-09-15 Ludovic Courtès Conditionalize GC 6.x code. * libguile/gc.c (scm_storage_prehistory): Have `GC_init ()' called only with GC 6.x (it doesn't hurt with 7.x, though). 2008-09-15 Neil Jerram Make multi-byte reads on unbuffered ports more efficient. Idea and original patch were by Ludovic Courts, this is Neil Jerram's reworking of it. * libguile/srfi-4.c (scm_uniform_vector_read_x): Use scm_c_read, instead of equivalent code here. * libguile/ports.c (scm_fill_input): Add assertion that read buffer is empty when called. (port_and_swap_buffer, swap_buffer): New, for... (scm_c_read): Use caller's buffer for reading, to avoid making N 1-byte low-level read calls, in the case where the port is unbuffered (or has a very small buffer). 2008-09-15 Ludovic Courtès Add `uniform-vector-read!' benchmark. 2008-09-15 Andy Wingo add special case for (apply values ...) * libguile/vm-engine.c (vm_run): Move nvalues to the top level, to avoid (spurious, it seems) gcc warnings about it being used uninitialized. * libguile/vm-i-system.c (halt, return/values): Adapt to gcc silliness. Deindent some of return/values. (return/values*): New instruction, does what (apply values . args) would do. * module/language/scheme/translate.scm (custom-transformer-table): Move the apply and @apply cases here from inline.scm, because we need some more cleverness when dealing with cases like (apply values . args). (lookup-apply-transformer): Define an eval transformer for `values', turning it into ghil-values*. * module/system/il/compile.scm (codegen): Compile into return/values*. * module/system/il/ghil.scm: Add and accessors. (ghil-lookup): Add optional argument, define?, which if false tells us not to actually cache the binding if it is not found in the toplevel. * module/system/il/inline.scm: Remove apply clauses. * module/system/vm/frame.scm (bootstrap-frame?): Update heuristic for bootstrap-frame?, as the bootstrap frame is now 5 bytes since it accepts multiple values. 2008-09-14 Ludovic Courtès Fix detection of the GC version. * libguile/boehm-gc.h: Don't expect `GC_VERSION_MAJOR' to be defined, as it's defined only since 7.x. 2008-09-14 Andy Wingo add multiple values support to the vm * libguile/vm-engine.c (vm_run): The bootstrap program now uses mv_call, so as to allow multiple values out of the VM. (It did before, because multiple values were represented internally as single scm_values objects, but now that values go on the stack, we need to note the boot frame as accepting multiple values.) (vm_error_no_values): New error, happens if you pass no values into a single-value continuation. Passing more than one is OK though, it just takes the first one. * libguile/vm-i-system.c (halt): Assume that someone has pushed the number of values onto the stack, and package up that number of values as a scm_values() object, for communication with the interpreter. (mv-call): New instruction, calls a procedure with a multiple-value continuation, even handling calls out to the interpreter. (return/values): New instruction, returns multiple values to the continuation. If the continuation is single-valued, takes the first value or errors if there are no values. Otherwise it returns to the multiple-value return address, pushing the number of values on top of the values. * module/system/il/compile.scm (codegen): Compile forms. * module/system/il/ghil.scm () Add new GHIL data structure and associated procedures. * module/language/scheme/translate.scm (custom-transformer-table): Compile (values .. ) forms into . 2008-09-14 Andy Wingo look up scheme translators by value, not by name * module/language/scheme/translate.scm (custom-transformer-table): Rename from `primitive-syntax-table', because now it will handle procedural values as well. (lookup-transformer): Update for renaming. Look up custom transformers by value, not name. (make-pmatch-transformers): Key the transformer table by value, not name. 2008-09-13 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/private-gc.h m4/.cvsignore m4/gnulib-cache.m4 m4/gnulib-comp.m4 2008-09-13 Ludovic Courtès Include in standalone tests. * test-suite/standalone/Makefile.am (test_cflags): Add `-I$(top_builddir)' so that can be found. (snarfcppopts): Likewise. * test-suite/standalone/*.c: Include . 2008-09-13 Andy Wingo rename tail-call to goto/args, add some more tail instructions * libguile/vm-i-system.c (call): Rename continuation invocation from `vm_call_cc' to `vm_call_continuation', because that's what it really does. Add a note that it doesn't handle multiple values at the moment. (goto/arg): Renamed from tail-call, in deference to the progenitors, on Dale Smith's suggestion. (goto/apply): New instruction, for `apply' in a tail context. Not yet used, or vetted for that matter. (call/cc): No need to pop the program, I don't think; although this isn't tested either. (goto/cc): New instruction, for call/cc in a tail context. * module/language/scheme/translate.scm (*forbidden-primitives*): Rename from %forbidden-primitives. * module/system/il/compile.scm (codegen): Adapt to goto/args instead of tail-call. * module/system/il/inline.scm: Start inlining some macros used in r4rs.scm -- not yet fully tested. * ice-9/boot-9.scm: Allow load of a compiled r4rs file. 2008-09-13 Andy Wingo add a multiple values return address to stack frames * libguile/frames.c (frame-mv-return-address): New accessor. * libguile/frames.h: Update frame diagram. (SCM_FRAME_UPPER_ADDRESS): Update for data area growing by one pointer. (SCM_FRAME_MV_RETURN_ADDRESS): New macro. * libguile/vm-engine.h (NEW_FRAME): Update for frame getting bigger by a pointer. In a normal NEW_FRAME, set the MV return address to NULL, to indicate that this continuation does not accept multiple values. * libguile/vm-i-system.c (tail-call): Update frame replacement code to understand the MV return address. (return): Make room for the MVRA. 2008-09-13 Andy Wingo inline frame replacement in tail-call * libguile/programs.c (program_print): Only try to lookup write-program if the module system is booted. * libguile/vm-engine.h (FREE_FRAME): Remove, it's now inlined everywhere. * libguile/vm-i-system.c (tail-call): Inline FREE_FRAME, and implement the calling bits here. Will make things more hackable. 2008-09-13 Ludovic Courtès Include in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'. 2008-09-13 Andy Wingo inline FREE_FRAME in halt * libguile/vm-i-system.c (halt): Inline FREE_FRAME, specialized for the halt case. 2008-09-13 Andy Wingo inline FREE_FRAME in return, sync stack_base in CACHE_REGISTER * libguile/vm-engine.h (CACHE_REGISTER): Sync stack_base too. * libguile/vm-i-system.c (return): Inline FREE_FRAME here, micro-optimizing a wee bit. Sounds silly, but it's to enable some refactoring. 2008-09-13 Andy Wingo clean up NEW_FRAME macro * libguile/vm-engine.h (NEW_FRAME): Clean up this macro. readability improvement in vm-i-scheme * libguile/vm-engine.h: * libguile/vm-i-scheme.c: Move some helper macros closer to their use sites. 2008-09-13 Andy Wingo tweaks for printing programs * module/system/vm/program.scm (program-bindings-as-lambda-list): Handle the bindings-is-null case too -- not sure how it comes about, though. A thunk with no let, perhaps. (write-program): Another default for the name: the source location at which it was defined. * libguile/programs.c (program_print): Add some "logic" to stop doing detailed prints if one print had a nonlocal exit -- preventing exceptions in backtraces. 2008-09-13 Andy Wingo programs can now get at their names, and print nicely * module/system/vm/frame.scm (frame-call-representation) (frame-program-name): Rename program-name to frame-program-name, and use the program-name if it is available. * module/system/vm/program.scm (program-bindings): Return #f if there are no bindings. (program-name): New public procedure. (program-bindings-as-lambda-list, write-program): A more useful writer for programs. * libguile/programs.c (scm_bootstrap_programs, program_print): Add a smob printer for programs, which dispatches to `write-program'. 2008-09-13 Andy Wingo (define (foo ...) ...) actually gives the lambda a name * module/language/scheme/translate.scm (primitive-syntax-table): In forms like (define x y) where y is a lambda, and the lambda has no name yet, set the lambda's name in its metadata. fix confusion in disassemble-bindings * module/system/vm/disasm.scm (disassemble-bindings): Fix external/local confusion when printing args and locals. 2008-09-13 Andy Wingo fix *another* bug in compiling `or'. incredible. * module/system/il/compile.scm (codegen): Fix *another* bug in compiling `or' -- in the case in which the value was being discarded, as in `or' used as a control structure, we were sometimes leaving a value on the stack. * testsuite/t-or.scm: Add another test case for `or'. 2008-09-12 Andy Wingo untabify process-define-module * ice-9/boot-9.scm (process-define-module): Untabify. correctly disassemble program bindings (arguments, locals, externals) * module/system/vm/disasm.scm (disassemble-bindings): New function, properly disassembles the bindings data. Neat! 2008-09-11 Ludovic Courtès Revert "Use Gnulib's `count-one-bits' module." We don't need it in this branch. This reverts commit d7014610b16cd5f273479e70db253bff2f0124fc. 2008-09-11 Ludovic Courtès Adjust to be usable with `libgc' 7.1. * libguile/boehm-gc.h: Only include with `libgc' 6.x. Define `GC_PTR' for `libgc' 7.x+. Fix bug in port eviction code * libguile/fports.c (scm_i_evict_port): Check whether PORT has a ptab entry associated with it. It's unclear when this can happen. 2008-09-10 Ludovic Courtès Fix broken hash-table merge. * libguile/hashtab.c (scm_hash_fn_create_handle_x): Return IT only when it satisfies `scm_is_pair ()'. 2008-09-10 Ludovic Courtès Fix broken GC and threads merge. * libguile/private-gc.h (scm_i_tag_name): New declaration. * libguile/threads.c: Include . 2008-09-10 Ludovic Courtès Fix broken port merge. * libguile/ports.c (finalize_port): Don't call `scm_remove_from_port_table ()'. (scm_flush): Don't refer to `scm_i_port_table_size'. (scm_ports_prehistory): Don't allocate `scm_i_port_table'. * libguile/ports.h (scm_i_port_table_room): Remove declaration. 2008-09-10 Ludovic Courtès Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/coop-defs.h libguile/gc-card.c libguile/gc-freelist.c libguile/gc-malloc.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/hashtab.c libguile/hashtab.h libguile/inline.h libguile/private-gc.h libguile/struct.c libguile/struct.h libguile/threads.c libguile/threads.h libguile/vectors.h libguile/weaks.h test-suite/tests/gc.test 2008-09-10 Ludovic Courtes Document the failure of `gc.test' wrt. unused modules. * test-suite/tests/gc.test (Unused modules are removed): Use guardians instead of `gc-live-object-stats'. Explain failure (FIXME). * ice-9/boot-9.scm (make-module): Add `FIXME' about circular reference. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-9 2008-09-10 Ludovic Courtes Add comment about `GC_local_malloc ()' upon thread destruction. * libguile/threads.c (on_thread_exit): Add caveat about possible segfault. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-8 2008-09-10 Ludovic Courtes Remove `scm_get_stack_base ()'. * libguile/threads.c: Replace `scm_get_stack_base ()' by `GC_stackbottom'. * libguile/gc.h (scm_get_stack_base): Remove declaration. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-7 2008-09-10 Ludovic Courtès Merge commit '2e77f7202b11ad0003831fcff94ec7db80cca015' into boehm-demers-weiser-gc Conflicts: libguile/threads.c Merge commit '29776e85da637ec4d44b2b2822d6934a50c0084b' into boehm-demers-weiser-gc Conflicts: libguile/gc-card.c libguile/gc.c libguile/gc.h libguile/ports.c 2008-09-10 Ludovic Courtes Fixed warnings due to unused stuff. * libguile/gc.c (scm_cells_allocated, scm_last_cells_allocated, scm_gc_cells_collected, scm_gc_cells_collected_1, scm_gc_malloc_collected, scm_gc_time_taken, t_before_gc, scm_gc_mark_time_taken, scm_gc_times, scm_gc_cells_swept, scm_gc_cells_marked_acc, scm_gc_cells_swept_acc, scm_gc_cell_yield_percentage, scm_gc_malloc_yield_percentage): Removed. * libguile/gc.h: Updated accordingly. * libguile/gdbint.c (port_mark_p, stream_mark_p, string_mark_p, unmark_port, remark_port): Removed. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-4 2008-09-10 Ludovic Courtès Merge commit '7337d56d5714227865aeca2b40b6bd97cce296d2' into boehm-demers-weiser-gc Conflicts: libguile/struct.c 2008-09-10 Ludovic Courtes scm_gc_malloc: Handle zero-octet allocations. * libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to `GC_MALLOC ()' when SIZE is zero. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2 2008-09-10 Ludovic Courtès Merge commit '032913739218c756f673bfb9c8f66ef9f8f02330' into boehm-demers-weiser-gc Conflicts: libguile/gc.c libguile/srcprop.c libguile/srcprop.h 2008-09-10 Ludovic Court`es Reverted inappropriate merge in `gc.c'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-53 2008-09-10 Ludovic Courtès Merge commit 'f30e1bdf97ae8b2b2918da585f887a4d3a23a347' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/coop-pthreads.c libguile/gc-freelist.c libguile/gc-segment.c libguile/gc.c libguile/private-gc.h test-suite/tests/environments.nottest 2008-09-10 Ludovic Courtes Use thread-local allocation (significant perf. improvement!); added the `boehm-gc.h' header. * libguile/Makefile.am (modinclude_HEADERS): Added `boehm-gc.h'. * libguile/coop-defs.h: Use "libguile/boehm-gc.h" instead of . * libguile/coop-threads.h: Likewise. * libguile/coop.c: Likewise. * libguile/gc.c: Likewise. (scm_storage_prehistory): Invoke `GC_init ()'. * libguile/guardians.c: Use "libguile/boehm-gc.h" instead of . * libguile/inline.h: Likewise. (scm_double_cell): Use `GC_MALLOC' instead of `GC_malloc'. * libguile/pthread-threads.h: Use "libguile/boehm-gc.h" instead of . * libguile/smob.c: Likewise. * libguile/smob.h: Likewise. * libguile/struct.c: Likewise. * libguile/threads.c: Likewise. * libguile/weaks.c: Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-51 2008-09-10 Ludovic Courtes Removed `scm_gc_registered_roots' and `scm_permobjs'. * libguile/gc.c (scm_permanent_object): Use `scm_gc_protect_object ()'. (scm_gc_register_root): Do nothing. (scm_init_storage): Removed initialization of `scm_permobjs' and `scm_gc_register_roots'. * libguile/root.h (scm_permobjs): Removed. (scm_gc_registered_roots): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-50 2008-09-10 Ludovic Courtes Expand heap size at startup time. * libguile/gc.c (scm_storage_prehistory): Invoke `GC_expand_hp ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-49 2008-09-10 Ludovic Courtes Turn "all interior pointers" off (slight performance gain). * libguile/gc.c (scm_storage_prehistory): Set `GC_all_interior_pointers' to 0. Register `scm_tc3_cons' and `scm_tc3_closure' as valid displacements. * libguile/struct.c (scm_alloc_struct): Register additional displacements. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-48 2008-09-10 Ludovic Courtes Implemented `gc-stats' using `libgc' information. * libguile/gc.c (protected_obj_count): Made `static'. (scm_heap_size): Mapped to `heap-size' rather than `cell-heap-size'. (scm_heap_free_size): New. (scm_heap_total_allocated): New. (scm_gc_stats): Rewritten. Return the (little) information available from `libgc'. (scm_gc_disable): New. (scm_gc_enable): New. (scm_storage_prehistory): Don't call `GC_add_roots ()' with SCM_SYS_PROTECTS. Use `GC_is_visible ()' to check whether SCM_SYS_PROTECTS is visible. * libguile/gc.h (scm_gc_enable): New declaration. (scm_gc_disable): New declaration. (scm_gc_for_alloc): Removed. (scm_gc_for_newcell): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-46 2008-09-10 Ludovic Courtes Have source properties only use regular GC mechanisms. * libguile/srcprop.c: Include "libguile/gc.h". (srcprops_chunklist): Removed. (srcprops_freelist): Removed. (srcprops_free): Removed. (scm_make_srcprops): Use `scm_gc_malloc ()' rather than SRCPROPS_FREELIST et al. (scm_init_srcprop): Don't call `scm_set_smob_free ()'. (scm_finish_srcprop): Do nothing. * libguile/srcprop.h (SRCPROPS_CHUNKSIZE): Removed. (scm_t_srcprops_chunk): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-45 2008-09-10 Ludovic Courtes Fixed symbols so that interned symbols are only weakly referenced. * libguile/symbols.c (lookup_interned_symbol): When a deleted weak pair is encountered, remove it and update the hashtable's item count. Also, check the hash table threshold and trigger a rehashing if needed. (scm_i_c_mem2symbol): Allocate CELL using `scm_weak_car_pair ()' rather than `scm_cons ()'. (scm_i_mem2symbol): Likewise. (scm_symbols_prehistory): Don't invoke `scm_permanent_object ()' for SYMBOLS. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-44 2008-09-10 Ludovic Courtes Re-fixed the hash table element counting in `scm_i_rehash ()'. * libguile/hashtab.c (scm_i_rehash): Don't invoke `SCM_HASHTABLE_DECREMENT ()' when a weak pair is encountered in the source bucket. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-43 2008-09-10 Ludovic Courtes Fixed `guardians.test' so that it does not use symbols. * test-suite/tests/guardians.test: Use strings instead of symbols for `g3-garbage' et al. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-42 2008-09-10 Ludovic Courtes Allow guardians to be GC'd before the objects they guard. * libguile/guardians.c (finalize_guarded): While traversing GUARDIANS_LIST, check for deleted weak-car pairs. (scm_i_guard): Instantiate GUARDIANS_FOR_OBJ using `scm_weak_car_pair ()' rather than `scm_cons ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-41 2008-09-10 Ludovic Courtes Minor weak hashtables fixes. * libguile/hashtab.c (scm_fixup_weak_alist): Cosmetic change. (scm_i_rehash): Call `SCM_HASHTABLE_DECREMENT ()' when a deleted weak pair is encountered. (scm_internal_hash_fold): Call `SCM_HASHTABLE_DECREMENT ()' instead of a complicated `SCM_SET_HASHTABLE_N_ITEMS ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-40 2008-09-10 Ludovic Courtes Moved weak pair code into `weaks.[ch]'. * libguile/hashtab.c: Don't include and . Updated users of weak (wcar_cell_descr): Removed. (wcdr_cell_descr): Removed. (scm_weak_car_cell): Removed. (scm_weak_cdr_cell): Removed. (scm_doubly_weak_cell): Removed. (SCM_WEAK_CELL_*_DELETED_P): Removed. (SCM_WEAK_CELL_WORD): Removed. (SCM_WEAK_CELL_C[AD]R): Removed. (scm_hashtab_prehistory): Don't initialize weak pairs. * libguile/init.c (scm_i_init_guile): Invoke `scm_weaks_prehistory ()' before `scm_hashtab_prehistory ()' in order to initialize weak pairs. * libguile/weaks.c: Include and . (wc[ad]r_cell_descr): New. (scm_weak_c[ad]r_pair): New. (scm_doubly_weak_pair): New. (scm_weaks_prehistory): New. * libguile/weaks.h (scm_weak_c[ad]r_pair): New declaration. (scm_doubly_weak_pair): New declaration. (SCM_WEAK_PAIR_WORD_DELETED_P): New. (SCM_WEAK_PAIR_CAR_DELETED_P): New. (SCM_WEAK_PAIR_CDR_DELETED_P): New. (SCM_WEAK_PAIR_DELETED_P): New. (SCM_WEAK_PAIR_WORD): New. (SCM_WEAK_PAIR_CAR): New. (SCM_WEAK_PAIR_CDR): New. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-39 2008-09-10 Ludovic Courtes Implemented rehashing of weak hash tables. * libguile/hashtab.c (weak_hashtables): Removed. (SCM_WEAK_CELL_DELETED_P): New macro. (START_WEAK_BUCKET_FIXUP): Added the HASHFN argument. Invoke `scm_i_rehash ()' when pairs have been removed. (END_WEAK_BUCKET_FIXUP): Added the HASHFN argument. (make_hash_table): Use `SCM_NEWSMOB2 ()' instead of `SCM_NEWSMOB3 ()' -- last argument used to be WEAK_HASHTABLES. (scm_i_rehash): Handle weak hash tables. (to_rehash): Removed. (scm_internal_hash_fold): Use `SCM_WEAK_CELL_DELETED_P ()' rather than hand-written equivalent code. (rehash_after_gc): Removed. (scm_hashtab_prehistory): Don't add it as an after-gc hook. * libguile/hashtab.h (SCM_HASHTABLE_NEXT): Removed. (SCM_HASHTABLE_NEXTLOC): Removed. (SCM_SET_HASHTABLE_NEXT): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-38 2008-09-10 Ludovic Courtes Implemented port finalization. * libguile/ports.c (register_finalizer_for_port): New. (finalize_port): New. (scm_new_port_table_entry): Call `register_finalizer_for_port ()' before returning the new port. (scm_ports_prehistory): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for SCM_I_PORT_TABLE. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-37 2008-09-10 Ludovic Courtes Use `scm_gc_malloc_pointerless' in various places (improves performance). * libguile/fports.c (scm_fport_buffer_add): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for the read/write buffers. * libguile/numbers.c (scm_c_make_rectangular): Likewise. * libguile/ports.c (scm_ungetc): Likewise. * libguile/random.c (scm_i_copy_rstate): Likewise. (scm_c_make_rstate): Likewise. * libguile/regex-posix.c (scm_make_regexp): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-36 2008-09-10 Ludovic Courtes Removed the now-useless `scm_struct_free_*' functions. * libguile/struct.c (scm_alloc_struct): Set the `scm_struct_i_free' element to 0 instead of `scm_struct_free_standard'. (scm_struct_free_0): Removed. (scm_struct_free_light): Removed. (scm_struct_free_standard): Removed. (scm_struct_free_entity): Removed. * libguile/struct.h (scm_struct_free_0): Removed. (scm_struct_free_light): Removed. (scm_struct_free_standard): Removed. (scm_struct_free_entity): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-35 2008-09-10 Ludovic Courtes Removed unnecessary uses of class destructors. * libguile/goops.c (scm_sys_inherit_magic_x): Don't invoke `SCM_SET_CLASS_DESTRUCTOR' for legacy destructors that are no longer needed (e.g., `scm_struct_free_entity ()', etc.). * libguile/objects.c (scm_init_objects): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-34 2008-09-09 Andy Wingo really newline on eof * module/system/repl/repl.scm (next-char): Another newline-on-eof case. fix program disassembly for meta-in-a-thunk * module/system/vm/disasm.scm (disassemble-program): Fix for recent meta-in-a-thunk change. 2008-09-09 Andy Wingo run the vm repl instead of the scm-style-repl * ice-9/boot-9.scm (@, @@): Note that these don't work with the compiler. Damn. (top-repl): Run the VM repl. Whooo! * module/system/repl/repl.scm (start-repl): Catch 'quit, as the scm-style-repl does. Newline after input EOF's, so that we don't leave the user's shell messed up. 2008-09-09 Andy Wingo add repl option to interpret rather than compile * module/language/scheme/spec.scm (scheme): Specify an evaluator, `eval'. * module/system/repl/common.scm (repl-default-options): Add option, `interp', specifying that, if possible, the repl should interpret its expressions rather than compile them. Defaults to #f. 2008-09-09 Andy Wingo rework late binding resolution to be simpler and more efficient * libguile/programs.h (struct scm_program): * libguile/programs.c (scm_c_make_program): Record the current module when making a program. This replaces the per-late binding recorded module in the generated code, which should be more efficient, both in terms of garbage, and in not calling resolve-module. (program-module): New accessor. * module/system/vm/program.scm: Add program-module to exports. * libguile/vm-i-loader.c (link-later): Remove this instruction, since now the entry in the object table is just a symbol, and can be loaded with load-symbol. * libguile/vm-i-system.c (late-variable-ref, late-variable-set): Rework so as to look up in the module of the current program. The logic could be condensed quite a bit if scm_module_lookup () knew what to do with mod==#f. * module/system/vm/assemble.scm (dump-object!): Dump just as load-symbol, as mentioned in the note on link-later. * module/system/il/ghil.scm: Update comment to reflect the new reality. 2008-09-09 Andy Wingo final de-:prefixification * scripts/compile: Don't (read-set! keywords 'prefix) here either. 2008-09-09 Andy Wingo use #:keywords in module/*.scm, not :keywords * module/system/base/syntax.scm (keywords): Don't enable :keywords, it breaks code that may assume that ':foo is a symbol, like boot-9. * module/*.scm: Don't use :keywords, use #:keywords. The user can decide if she wants #:keywords in their .guile, and :keywords might make us compile modules differently. 2008-09-08 Andy Wingo lazily load meta info, for less consage * module/system/vm/assemble.scm (make-meta, codegen): Hide the "meta" information -- the names of the bindings, source info, procedure properties, etc -- behind a lambda. This way, loading up a program conses less, because the metadata stays as mmap'd code until it is needed. * libguile/vm-i-loader.c (load-program): Adjust load-program to expect the metadata to be a program. * module/system/vm/program.scm (program-bindings, program-sources) (program-properties): Adjust to new meta format. 2008-09-07 Andy Wingo compile boot-9. woop! * ice-9/Makefile.am (SOURCES, NOCOMP_SOURCES): Compile boot-9.scm. Wooooo! This makes some things harder to debug, and program loading needs to cons much less, but I think it makes sense to compile boot-9 by default if for no other reason than to catch bugs earlier. macro-transformer recognizes compiled macros * libguile/macros.c (macro-transformer): Recognize compiled as well as interpreted transformer procedures. print compiled macros correctly * libguile/macros.c (macro_print): Print macros whose code is a program as non-primitive. (Already, primitive-macro? would return #f.) allow boot-9.go load if available * libguile/init.c (scm_load_startup_files): Don't specify the .scm suffix, so as to allow loading a boot-9.go if appropriate. remove define-syntax-macro from boot-9.scm * ice-9/boot-9.scm (defmacro:syntax-transformer, define-syntax-macro): Removed these, as I could not see anywhere they were being used, and they use the unnecessary procedure->syntax procedure. take procedure->memoizing-macro off of probation * module/language/scheme/translate.scm (%forbidden-primitives): Take procedure->memoizing-macro off probation; although it's not a good idea, there is a fair amount of existing code that uses it that can be compiled fine. So allow it in that case. make thunk? understand programs * libguile/procs.c (thunk?): Return #t for thunk programs. reorder module system boot time * ice-9/boot-9.scm: Postpone module system boot until (%app modules) is defined, so that resolve-module will work. This might not actually be necessary given the previous tomfoolery in resolve-module, but it doesn't seem like a bad change. 2008-09-07 Andy Wingo module-variable accesses pre-module-obarray if module is #f * libguile/modules.c (module-variable): If module is #f, access the pre-modules-array. This is so that nested-ref can work before the module system is booted, I think. Of course all of these dependency lines during bootstrap are just to make sure the system can be booted properly, either interpreted or compiled, so there's no one right way: there are many ways that could work. 2008-09-07 Andy Wingo prevent (resolve-module '(guile)) recursion * ice-9/boot-9.scm (resolve-module): Change so that resolving '(guile) does not require any module lookups. This is so that while within a call to (resolve-module '(guile)), we don't recurse when looking up the location for e.g. `append'. I can imagine other ways to get around this, but this one seems OK. make late-variable-{ref,set} work before module system boot * libguile/vm-i-system.c (late-variable-ref, late-variable-set): If the module system isn't booted, do a simple scm_lookup. In the -ref case, actually cache the variable location (doh!). better diagnostics on quasiquote errors * module/system/il/compile.scm (constant?, codegen): Add some diagnostics so that we can get decent error reporting if we accidentally unquote an unreadable value into the compiled output. 2008-09-07 Andy Wingo allow multiple modules in one compilation unit * module/system/il/ghil.scm (, ): Refactor so that all environments point (eventually) at one toplevel environment. Instead of having potentially multiple toplevel environments, each noting the module against which its bindings are resolved, have each binding in the toplevel record what module it should be resolved in. Should fix compilation units that define multiple modules. (ghil-lookup, ghil-define): Reworked to not be destructive. Module variables now have the module name as their "env", and are keyed as `(MODNAME . SYM)' in the var table. (call-with-ghil-environment): Reindented. * module/system/il/inline.scm (try-inline-with-env): Adapt to env/toplevel changes. * module/system/vm/assemble.scm (dump-object!): A vlink-later now holds the module name, not the module itself. * module/system/il/compile.scm (make-glil-var): The "env" of a "module" var is now the module name, not the module. * module/language/scheme/translate.scm (primitive-syntax-table): Update the way we test for toplevel environments. Reindent the lambda translator. (lookup-transformer, trans): lookup-transformer now has 2 args, not 3. (translate): Update the way we make toplevel environments. 2008-09-07 Andy Wingo improve backtraces * module/system/vm/frame.scm (frame-call-representation): Show more of lists. (program-name): Avoid a traceback if (frame-address link) is #f. Not sure when this can happen, but it does, and since this is already in the backtrace function, there be badness there. update .gitignore files * .gitignore: * libguile/.gitignore: Update 2008-09-05 Ludovic Courtes Added support for the free function of structures. * libguile/struct.c (struct_finalizer_trampoline): New. (scm_struct_gc_init): Removed. (scm_i_structs_to_free): Removed. (scm_free_structs): Removed. (scm_make_struct): Register a finalizer for the new struct if need be. (scm_struct_prehistory): Cleared. * libguile/struct.h (scm_i_structs_to_free): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-33 2008-09-05 Ludovic Courtes Use the SMOB API in `coop-pthreads.c' rather than low-level primitives. * libguile/coop-pthreads.c: Include "smob.h". (make_thread): Use `SCM_NEWSMOB' rather than `scm_cell'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-32 2008-09-05 Ludovic Courtes Fixed a warning in `symbols.c'. * libguile/symbols.c (lookup_interned_symbol): When checking for `NULL', use `SCM2PTR' rather than `SCM_UNPACK' (this fixes a warning). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-31 2008-09-05 Ludovic Courtes Fixed the SMOB mark procedure so that it handles free-list objects. * libguile/smob.c (smob_mark): Check the 7-bit type tag and ignore those whose type tag is not that of a SMOB in order to cleanly handle free-list objects (this fixes a bug which showed up on SPARC64). Also, don't mark & push ADDR itself. (scm_gc_mark): Moved the definition and undefinition of `CURRENT_MARK_PTR' and `CURRENT_MARK_LIMIT' here. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-30 2008-09-05 Ludovic Courtes Fixed use of finalizers for guardians and SMOBs (undoes patches 23-24). * libguile/gc.c (finalizer_trampoline): Removed. (scm_gc_register_finalizer): Removed (undoes patches 23 and 24). * libguile/gc.h (scm_gc_register_finalizer): Removed. * libguile/guardians.c (finalize_guarded): Undid patch 23. Added support for "proxied finalizers". (scm_i_guard): Likewise. * libguile/smob.c (scm_i_finalize_smob): Adapted to `GC_finalization_proc'. * libguile/smob.h: Include . (SCM_NEWSMOB): Use `GC_REGISTER_FINALIZER_NO_ORDER' instead of `scm_gc_register_finalizer ()'. (SCM_NEWSMOB3): Likewise. (scm_i_finalize_smob): Updated. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-29 2008-09-05 Ludovic Courtes Removed a lot of now-useless SMOB mark/free functions. * libguile/arbiters.c (scm_init_arbiters): Don't invoke `scm_set_smob_mark'. * libguile/async.c (async_gc_mark): Removed. (scm_init_async): Don't invoke `scm_set_smob_mark'. * libguile/coop-pthreads.c (thread_mark): Removed. (create_thread): Use `scm_gc_malloc' instead of `scm_malloc' when allocating `launch_data'. (mutex_mark): Removed. (scm_threads_init): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/debug.c (scm_init_debug): Don't invoke `scm_set_smob_mark'. * libguile/dynl.c (dynl_obj_mark): Removed. (scm_init_dynamic_linking): Don't invoke `scm_set_smob_mark'. * libguile/dynwind.c (winder_mark): Removed. (scm_init_dynwind): Don't invoke `scm_set_smob_mark'. * libguile/environments.c (environment_mark): Removed. (environment_free): Removed. (observer_mark): Removed. (core_environments_mark): Removed. (core_environments_finalize): Removed. (leaf_environment_mark): Removed. (leaf_environment_free): Removed. (leaf_environment_funcs): Don't refer to the above funcs. (eval_environment_mark): Removed. (eval_environment_free): Removed. (eval_environment_funcs): Don't refer to the above funcs. (import_environment_mark): Removed. (import_environment_free): Removed. (import_environment_funcs): Don't refer to the above funcs. (export_environment_mark): Removed. (export_environment_free): Removed. (export_environment_funcs): Don't refer to the above funcs. (scm_environments_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/environments.h (scm_environment_funcs)[mark]: Removed. [free]: Removed. * libguile/eval.c (promise_mark): Removed. (promise_free): Removed. (scm_init_eval): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/fluids.c (fluid_free): Removed. (scm_fluids_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/futures.c (future_mark): Removed. (scm_init_futures): Don't invoke `scm_set_smob_mark'. * libguile/hashtab.c (hashtable_free): Removed. (scm_hashtab_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/hooks.c (scm_init_hooks): Don't invoke `scm_set_smob_mark'. * libguile/keywords.c (scm_init_keywords): Don't invoke `scm_set_smob_mark'. * libguile/macros.c (scm_init_macros): Don't invoke `scm_set_smob_mark'. * libguile/modules.c (scm_init_modules): Don't invoke `scm_set_smob_mark'. * libguile/print.c (scm_init_print): Don't invoke `scm_set_smob_mark'. * libguile/random.c (scm_i_copy_rstate): Use `scm_gc_malloc' instead of `scm_malloc'. (scm_c_make_rstate): Likewise. (rstate_free): Removed. (scm_init_random): Don't invoke `scm_set_smob_free'. * libguile/srcprop.c (srcprops_mark): Removed. (scm_init_srcprop): Don't invoke `srcprops_mark'. * libguile/srfi-14.c (charset_free): Removed. (scm_init_srfi_14): Don't invoke `scm_set_smob_free'. * libguile/srfi-4.c (uvec_mark): Removed. (uvec_free): Removed. (scm_init_srfi_4): Don't invoke `scm_set_smob_free' and `scm_set_smob_mark'. * libguile/threads.c (thread_mark): Removed. (fat_mutex_mark): Removed. (fat_cond_mark): Removed. (scm_init_threads): Dont invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/unif.c (bitvector_free): Removed. (array_mark): Removed. (array_free): Removed. (scm_init_unif): Don't invoke `scm_set_smob_free' and `scm_set_smob_mark'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-28 2008-09-05 Ludovic Courtes Fixed the undocumented `scm_make_smob ()' function. * libguile/smob.c (scm_make_smob): Use `SCM_RETURN_NEWSMOB ()' instead of `scm_cell ()' when instantiating the SMOB. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-27 2008-09-05 Ludovic Courtes Added support for SMOBs free function (via finalizers). * libguile/smob.c (scm_i_finalize_smob): New. * libguile/smob.h (SCM_NEWSMOB): Register `scm_i_finalize_smob ()' as a finalizer for Z if its SMOB type has a free function. (SCM_NEWSMOB3): Likewise. (scm_i_finalize_smob): New declaration. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-26 2008-09-05 Ludovic Courtes Removed the free function from the malloc-object SMOB type. * libguile/mallocs.c (malloc_free): Removed. (scm_init_mallocs): Don't invoke `scm_set_smob_free ()' because the memory allocated by `scm_gc_malloc ()' will automatically be freed. Furthermore, `malloc_free ()' used to invoke `free ()' instead of `scm_gc_free ()' which is incorrect. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-25 2008-09-05 Ludovic Courtes Fixed `scm_gc_register_finalizer ()' to avoid bootstrap problem. * libguile/gc.c (finalizer_trampoline): Don't use `scm_call_2 ()' to invoke the finalizer: directly call the C function instead. (scm_gc_register_finalizer): Don't create a real subr with `scm_c_make_gsubr ()': simply convert the C function pointer to an `SCM' object instead. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-24 2008-09-05 Ludovic Courtes Generalized BGC's finalizer mechanism. Use it in `guardians.c'. * libguile/gc.c (finalizer_trampoline): New. (scm_gc_register_finalizer): New. * libguile/gc.h (scm_gc_register_finalizer): New declaration. * libguile/guardians.c (finalize_guarded): Updated to the new prototype. (scm_i_guard): Use `scm_gc_register_finalizer ()' instead of `GC_REGISTER_FINALIZER_NO_ORDER ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-23 2008-09-05 Ludovic Courtes Added support for SMOB custom mark procedures. * libguile/gc.c (scm_gc_mark): Removed. (scm_gc_mark_dependencies): Removed. (scm_mark_locations): Removed. * libguile/gc.h (scm_gc_mark_dependencies): Removed. (scm_mark_locations): Removed. * libguile/inline.h (scm_cell): Use `GC_MALLOC ()' instead of `GC_malloc ()'. * libguile/smob.c (smob_freelist): New. (smob_gc_kind): New. (smob_mark): New. (scm_gc_mark): New. (scm_i_new_smob_with_mark_proc): New. (scm_smob_prehistory): Initialize `smob_freelist' and `smob_gc_kind'. * libguile/smob.h (scm_i_new_smob_with_mark_proc): New declaration. (SCM_NEWSMOB): Use it if a mark procedure is available. (SCM_NEWSMOB2): Likewise. (SCM_NEWSMOB3): Likewise. * libguile/threads.c (guilify_self_1): Initialize the `current_mark_stack_*' fields. * libguile/threads.h (scm_i_thread)[current_mark_stack_ptr]: New field. [current_mark_stack_limit]: New field. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-22 2008-09-05 Ludovic Courtes Removed the mark/free functions of continuations and threads. * libguile/continuations.c (continuation_mark): Removed. (continuation_free): Removed. (scm_init_continuations): Don't use them. * libguile/coop-pthreads.c (scm_threads_mark_stacks): Removed (was unused). * libguile/threads.c (scm_threads_mark_stacks): Likewise. * libguile/threads.h (scm_threads_mark_stacks): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-21 2008-09-05 Ludovic Courtes Removed useless files; beautified `libguile/Makefile.am'. * libguile/Makefile.am: Beautified backslashification (complements `patch-1'). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-20 2008-09-05 Ludovic Courtes Disabled the `environments' unit test. * test-suite/Makefile.am (SCM_TESTS): Removed `tests/environments.test'. * test-suite/tests/environments.nottest: Disabled. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-19 2008-09-05 Ludovic Courtes procs/weaks/hashtab: Removed a bit of useless mark/free code. * libguile/hashtab.c (UNMARKED_CELL_P): Removed. (scm_i_scan_weak_hashtables): Removed. * libguile/hashtab.h (scm_i_scan_weak_hashtables): Removed. * libguile/procs.c (scm_mark_subr_table): Removed. * libguile/procs.h (scm_mark_subr_table): Removed. * libguile/weaks.c (UNMARKED_CELL_P): Removed. (scm_i_remove_weaks): Removed. (scm_i_remove_weaks_from_weak_vectors): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-18 2008-09-05 Ludovic Courtes Tiny updates in `environments.c'. * libguile/environments.c (scm_make_environment): Use `SCM_RETURN_NEWSMOB' instead of `scm_cell'. (core_environments_observe): Use `SCM_NEWSMOB3' instead of `scm_double_cell'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-17 2008-09-05 Ludovic Courtes Fixes in weak hash tables handling, notably in `hash-fold'. * libguile/hashtab.c (scm_i_rehash): Return immediately if TABLE is weak. (scm_hash_fn_create_handle_x): Explicitly mention that we don't support weak alist vectors. (scm_internal_hash_fold): Handle weak pairs within buckets. * libguile/modules.c (scm_module_reverse_lookup): Handle weak alists (currently, don't do anything if a NULL pair is met). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-16 2008-09-05 Ludovic Courtes Fixed a typo/bug in `make-doubly-weak-alist-vector'. * libguile/weaks.c (scm_make_doubly_weak_alist_vector): Fixed typo (endless recursive call). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-15 2008-09-05 Ludovic Courtes Fixed printing of weak vectors. * libguile/print.c (iprin1): When displaying a weak vector, access elements via `scm_c_vector_ref ()', not via the macro. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-14 2008-09-05 Ludovic Courtes Fixed `list->weak-vector'. * libguile/vectors.c (scm_i_allocate_weak_vector): Removed. (MAKE_WEAK_VECTOR): New macro. (allocate_weak_vector): New. (scm_i_make_weak_vector): New. (scm_i_make_weak_vector_from_list): New. * libguile/vectors.h: Updated. * libguile/weaks.c (scm_make_weak_vector): Use `scm_i_make_weak_vector ()'. (scm_weak_vector): Use `scm_i_make_weak_vector_from_list ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-13 2008-09-05 Ludovic Courtes Fixed weak alist vectors by having them use weak hash tables instead. * libguile/weaks.c (scm_make_weak_key_alist_vector): Use `scm_make_weak_key_hash_table ()'. (scm_make_weak_value_alist_vector): Use `scm_make_weak_value_hash_table ()'. (scm_make_doubly_weak_alist_vector): Use `scm_make_doubly_weak_hash_table ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-12 2008-09-05 Ludovic Courtes First stab at the guardian implementation. Works fine at first glance! * libguile/guardians.c: Overhauled. Removed the `tconc' structure. Much, much, simpler. (finalize_guarded): New function. * libguile/init.c (scm_i_init_guile): Call `scm_init_guardians ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-11 2008-09-05 Ludovic Court`es Tell `libgc' that we're using POSIX threads. This fixes Guile on PPC. * libguile/coop-defs.h: If `GUILE_PTHREAD_COMPAT' is defined, then define `GC_THREADS' and include after . * libguile/coop-pthreads.h: Likewise. * libguile/pthread-threads.h: Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-10 2008-09-05 Ludovic Courtes Fixed `scm_fixup_weak_alist ()'; update weak hash table size as needed. * libguile/hashtab.c (scm_fixup_weak_alist): Added a REMOVED_ITEMS parameter. Fixed a bug in the case where PREV is `SCM_EOL'. (IS_WEAK_THING): New macro. (START_WEAK_BUCKET_FIXUP): New macro. (END_WEAK_BUCKET_FIXUP): New macro. (scm_hash_fn_get_handle)[buckets]: New variable. Use the above macros. (scm_hash_fn_create_handle_x): Likewise. (scm_hash_fn_remove_x): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-9 2008-09-05 Ludovic Courtes Fixed the weak cell implementation (for weak hash tables). * libguile/hashtab.c (wcar_cell_descr): New. (wcdr_cell_descr): New. (scm_weak_car_cell): Use `GC_malloc_explicitly_typed ()' instead of `scm_gc_malloc_pointerless ()'. (scm_weak_cdr_cell): Likewise. (SCM_WEAK_CELL_WORD_DELETED_P): Use `SCM_CELL_OBJECT' instead of `SCM_CELL_WORD'. (scm_hash_fn_get_handle): Call `GC_disable ()' before calling `scm_fixup_weak_alist ()' and `GC_enable ()' afterwards. (scm_hash_fn_create_handle_x): Likewise. (scm_hash_fn_remove_x): Likewise. (scm_hashtab_prehistory): Initialize WCAR_CELL_DESCR and WCDR_CELL_DESCR. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-8 2008-09-05 Ludovic Courtes First stab at implementing weak hash tables and vectors. Unable to run the REPL. * libguile/hashtab.c (scm_weak_car_cell): New. (scm_weak_cdr_cell): New. (scm_doubly_weak_cell): New. (SCM_WEAK_CELL_WORD_DELETED_P): New. (SCM_WEAK_CELL_WORD): New. (scm_fixup_weak_alist): New. (make_hash_table): Always use non-weak vectors. Allocate `scm_t_hashtable' objects as pointerless. (scm_i_rehash): Always make NEW_BUCKETS a non-weak vector. (scm_hash_fn_get_handle): Call `scm_fixup_weak_alist ()' on weak buckets before calling ASSOC_FN. (scm_hash_fn_remove_x): Likewise. (scm_hash_fn_create_handle_x): Likewise. Also, use `scm_.*weak.*cell ()' for HANDLE when needed. * libguile/symbols.c (lookup_interned_symbol): Check for nullified pairs. * libguile/vectors.c (scm_vector_elements): Abort on weak vectors. (scm_vector_writable_elements): Likewise. (scm_c_vector_ref): Check whether the referenced element has been nullified. (scm_c_vector_set_x): Use `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'. (scm_i_allocate_weak_vector): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for the vector itself. * libguile/weaks.c (scm_make_weak_key_alist_vector): Use `scm_make_vector ()' instead of `scm_i_allocate_weak_vector ()'. (scm_make_weak_value_alist_vector): Likewise. (scm_make_doubly_weak_alist_vector): Likewise. (weak_vectors): Removed. (scm_i_init_weak_vectors_for_gc): Removed. (scm_i_mark_weak_vector): Removed. (scm_i_mark_weak_vector_non_weaks): Removed. (scm_i_mark_weak_vectors_non_weaks): Removed. (scm_i_remove_weaks_from_weak_vectors): Commented out. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-7 2008-09-05 Ludovic Courtes Fixed GC initialization and static roots. * libguile/gc.c (scm_storage_prehistory): Call `GC_INIT ()'. Invoke `GC_add_roots ()' as well. (scm_init_gc): Removed call to `GC_init ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-6 2008-09-05 Ludovic Courtes Added `scm_gc_malloc_pointerless ()', equivalent to `GC_MALLOC_ATOMIC ()'. * libguile/gc-malloc.c (scm_gc_register_collectable_memory): Tidied. (scm_gc_unregister_collectable_memory): Likewise. (scm_gc_malloc_pointerless): New. * libguile/gc.h (scm_gc_malloc_pointer_less): New declaration. * libguile/strings.c (make_stringbuf): Use it. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-5 2008-09-05 Ludovic Courtes Fixed garbage collection of ports: basics work (no SMOBs, no guardians, no WHT). * libguile/gc.c (scm_init_storage): Do not initialize SCM_I_PORT_TABLE here: this is done in `scm_ports_prehistory ()'. This fixes the bug mentioned in the previous patch log. * libguile/ports.c (scm_new_port_table_entry): Slightly clarified the code. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-4 2008-09-05 Ludovic Courtes First ``working'' Guile! Crashes in `flush-all-ports' (relates to SCM_I_PORT_TABLE). * libguile/gc.c (scm_gc_stats): Fixed so that it returns a relevant result instead of just `SCM_EOL'. * libguile/ports.c: Include `assert.h'. Don't include `malloc.h'. (scm_make_port_type): Use `scm_gc_realloc ()' instead of `realloc ()'. (scm_new_port_table_entry): Likewise. (scm_flush): Added an assertion on the port number. (scm_ports_prehistory): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-3 2008-09-05 Ludovic Courtes Small fixes. Gets to the REPL and `abort ()'s soon after. * libguile/inline.h (scm_cell): Re-added comment about the assignment order of CAR/CDR. * libguile/srcprop.c (scm_make_srcprops): Use `scm_gc_malloc ()' instead of `malloc' + `scm_gc_register_collectable_memory ()'. * libguile/threads.c (guilify_self_1): Likewise. (guilify_self_2): Likewise. * libguile/strings.c (make_stringbuf): Use `GC_MALLOC_ATOMIC ()' instead of `scm_gc_malloc ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-2 2008-09-05 Ludovic Courtes Merge from lcourtes@laas.fr--2005-mobile Patches applied: * lcourtes@laas.fr--2005-mobile/guile-core--boehm-gc--1.9 (base, patch 1) - tag of lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--base-0 - Initial hack for Boehm's GC support: nothing works. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-1 2008-09-02 Andy Wingo superstition with no important effect * module/system/vm/assemble.scm (dump-object!): Some superstition, use bit arithmetic instead of int arithmetic. Makes me happier. 2008-09-02 Andy Wingo make primitive-load-path load compiled files if available * libguile/load.h: Update scm_search_path prototype. * libguile/load.c: Include vm.h for load-compiled/vm. Not sure if this is bad wrt modularity. (scm_c_string_has_an_ext): New private helper. (scm_search_path): Add an extra optional arg, `require_exts'; if true, require that the returned file name have one of the given extensions. Changes the C API, but not the scheme API. (scm_sys_search_load_path): Adapt to scm_search_path API change. (primitive-load-path): Here is the craziness: load a compiled file if found and newer than the corresponding (or not) source file. (scm_init_load): Define %load-compiled-extensions as the list of extensions denoting compiled files; defaults to '(".go"). 2008-09-02 Andy Wingo move up some initializations in the vm * libguile/vm.c: Move 'vm-run, 'vm-error, 'debug sym initialization up to the bootstrap phase, so they are ready if load-compiled/vm is called before (system vm vm) is loaded. turn define-option-interface into a defmacro * ice-9/boot-9.scm (define-option-interface): Turn into a defmacro instead of an mmacro. disable start-stack in compiled code * module/language/scheme/translate.scm (primitive-syntax-table): Disable semantics of start-stack in compiled code. I think start-stack semantics aren't bad, but they don't have vm-based implementations at this point. remove the-environment, the-root-environment, environment-module * ice-9/boot-9.scm (the-environment, the-root-environment) (environment-module): Remove these representation of the interpreter's idea of the environment, because they are not valid in the compiled case, and are not part of the scheme spec anyway. avoid local-eval in record constructors and accessors * ice-9/boot-9.scm (record-constructor, record-accessor) (record-modifier): Avoid local-eval when possible, because it uses the interpreter's representation of environments; and when we need to eval, use primitive-eval instead. Slight semantic change in that this evaluates relative to the current module rather than the root module, but not really a biggie. Should make this compilable in the future, somehow. nits picked on boot-9.scm * ice-9/boot-9.scm (defmacro): Indentation fix. (begin-deprecated): Don't cons in the `begin' macro itself, only the symbol `begin'. enter into the (guile) module when compiling boot-9.scm * ice-9/boot-9.scm: Before doing very much, put us into the (guile) module when compiling. This avoids some circularity in the module boot process, whereby symbols are seen to resolve to the (guile-user) module, whereas in fact they originally pertain to the (guile) module. Fix compilation #ifndef STACK_CHECKING. * libguile/debug.c (scm_debug_options): Fix compilation #ifndef STACK_CHECKING. fix Makefile.am in module/language * module/language/Makefile.am: Actually recurse into scheme/. ditch the 8-bit compiled form of program parameters * libguile/vm-i-loader.c (load-program): * module/system/vm/assemble.scm (dump-object!): There are cases in which we use the 16-bit representation for program params (nargs, nexts, etc), but the actual 16-bit number actually fits into 8 bits -- which is then misinterpreted by the loader as the 8-bit form. So ditch the 8-bit form entirely (it was never much of an optimization), and just use the 16-bit form. Make sure to clear out all your .go files before recompiling this one! fix a bug loading functions with 8 or more arguments * libguile/vm-i-loader.c: A combination of superstition and a bugfix: make sure that we treat bits as being of a type as wide as we think it is, and, more importantly, allow for programs with 8 <= nargs < 16. 2008-09-02 Andy Wingo fix nested quasiquotes (yeepers) * module/language/scheme/translate.scm (primitive-syntax-table) (trans-quasiquote): Fix handling of nested quasiquotes. * testsuite/Makefile.am (vm_test_files): * testsuite/t-quasiquote.scm: Add a quasiquote test case. 2008-08-28 Andy Wingo shamefully disable some more gc asserts * libguile/gc-freelist.c: Disable some more asserts. I have no idea why they're hitting, however. 2008-08-28 Andy Wingo move guilec and guile-disasm to be guile-tools scripts * .gitignore: Some touchups. * configure.in: * src/.cvsignore: * src/Makefile.am: * Makefile.am: No more src/. * scripts/compile: * scripts/disassemble: Moved here from src/ and changed into guile-tools scripts. * scripts/Makefile.am: Add the new scriptes. * guilec.mk: Adapt to new way of invoking the compiler. 2008-08-26 Andy Wingo fix guile-disasm * src/guile-disasm.in: Adapt to the split-up of (system vm core). Detabify. Patch by C. K. Jester-Young gmail.com>. 2008-08-26 Andy Wingo m4 quoting foo in labels-as-values.m4. * m4/labels-as-values.m4: More m4 quoting love. Patch from C. K. Jester-Young gmail.com>. 2008-08-26 Andy Wingo fix casting-pointers-to-ints bug * libguile/vm.c: Cast pointers to intptr_t, not int. Patch from C. K. Jester-Young gmail.com>. 2008-08-26 Andy Wingo fetch an inum's bits into a scm_bits_t, not an int * libguile/vm-i-scheme.c (FUNC1): Remove, cause it's not used. (FUNC2): Don't assume an inum can fit into an int, use scm_bits_t instead. In reality though we should probably do use different checks, i.e. for multiplication probably we overflow. (That would be a bug.) Based on a patch by C. K. Jester-Young gmail.com>. 2008-08-26 Andy Wingo suppress autoconf warning * guile-tools.in: Suppress ``WARNING: $ac_file_inputs seems to ignore the --datarootdir setting'' message. Patch from C. K. Jester-Young gmail.com> 2008-08-26 Andy Wingo disable gc statistics asserts * libguile/gc.c: Disable the statistics asserts; see http://thread.gmane.org/gmane.lisp.guile.devel/7505 merge from guile master Had to fix up .gitignore for some conflicts. start compiling ice-9 * ice-9/Makefile.am: Integrate with guilec.mk, and start compiling sources. Have to figure out what to do with procedure->memoized-macro though, to get boot-9.scm compiling. 2008-08-25 Andy Wingo module compilation fixen, post-integration Thanks to Dale Smith. * guilec.mk: Rework to expect the includer to define $(modpath), then make $(moddir) from that. * module/language/Makefile.am: * module/language/scheme/Makefile.am: * module/system/base/Makefile.am: * module/system/il/Makefile.am: * module/system/repl/Makefile.am: * module/system/vm/Makefile.am: Define modpath instead. * src/guilec.in: Don't import (system vm bootstrap), it is no more. 2008-08-22 Andy Wingo merge guile-vm into libguile itself * ice-9/boot-9.scm: Only define load-compiled as #f if it's not already defined, which won't normally be the case. * libguile/guile-vm.c: Removed, there's no more guile-vm binary. * libguile/frames.c: (with change frame? -> heap-frame?) * 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: (was bootstrap.h) * libguile/vm-engine.c: (was vm_engine.c) * libguile/vm-engine.h: (was vm_engine.h) * libguile/vm-expand.h: (was vm_expand.h) * libguile/vm-i-loader.c: (was vm_loader.c) * libguile/vm-i-scheme.c: (was vm_scheme.c) * libguile/vm-i-system.c: (was vm_system.c) * libguile/vm.c: * libguile/vm.h: These files moved here from src/, as guile-vm is now a part of libguile. * libguile/init.c: Bootstrap the VM. Yay! * libguile/Makefile.am: The necessary chicanery here. * module/system/vm/Makefile.am: * module/system/vm/bootstrap.scm: * module/system/vm/frame.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: * pre-inst-guile-env.in: Add builddirs to the load path; add module/ to the path in the empty-$GUILE_LOAD_PATH case as well. * src/Makefile.am: Moved out everything except guilec and guile-disasm, which probably should be moved to the scripts directory? * testsuite/Makefile.am: Update to find guile-vm in the right place. * module/system/vm/Makefile.am: * module/system/vm/bootstrap.scm: Removed bootstrap.scm, scm_init_guile handles the bootstrapping for us. * module/system/vm/frame.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: Call the init functions in libguile; should fix at some point to avoid the dlopen? 2008-08-22 Andy Wingo make pre-inst-guile use pre-inst-guile-env * pre-inst-guile-env.in: * pre-inst-guile.in: Change so that pre-inst-guile uses pre-inst-guile-env. Fixed inconsistency regarding $subdirs_with_ltlibs. 2008-08-21 Andy Wingo chmod -x guilec.in. * src/guilec.in: Chmod -x. 2008-08-20 Andy Wingo fix some compilation warnings, in anticipation of moving to libguile/ * src/Makefile.am: Use standard guile CFLAGS, which has -Werror and -Wmissing-prototypes. * src/frames.h: * src/instructions.h: * src/objcodes.h: * src/programs.h: * src/vm.h: * src/vm.c: Fix warnings, mostly about prototypes. * src/vm_system.c: Fix a tricky x-is-not-initialized error. Thanks, GCC! 2008-08-20 Andy Wingo remove unused "envs" code from guile-vm * src/Makefile.am: * src/envs.c: * src/envs.h: Remove the envs code, which was historically used to implement modules. But since we use Guile's modules, these aren't necessary. * src/vm.c: * src/vm_loader.c: * module/system/vm/assemble.scm: Remove code bits that trafficked in yon deprecation. 2008-08-11 Andy Wingo make ,stats work * module/system/repl/command.scm (display-time-stat, display-mips-stat): Always convert to float. * module/system/vm/frame.scm (print-frame): Write the args, don't display them. * module/system/repl/command.scm (statistics): gc-sweep-time is no more. 2008-08-11 Andy Wingo ease-of-use improvement to ,m; catch read errors at the repl * module/system/repl/command.scm (module): Accept e.g. `,m ice-9 popen' in addition to `,m (ice-9 popen)'. * module/system/repl/repl.scm (start-repl): Call read with a backtrace handler too. 2008-08-11 Andy Wingo fix bug in compilation of `and' and `or'; more robust underflow detection. * module/system/il/compile.scm (codegen): Rewrite handling of `and' and `or' ghil compilation, because it was broken if drop was #t. Tricky bug, this one! Took me days to track down! * module/system/repl/repl.scm: Export call-with-backtrace, which probably should go in some other file. * src/vm.c (scm_vm_save_stack): Handle the fp==0 case for errors before we have a frame. * src/vm_engine.h (NEW_FRAME, FREE_FRAME): Stricter underflow checking, raising the stack base to the return address, in an attempt to prevent inadvertant stack smashing (the symptom of the and/or miscompilation bug). (CHECK_IP): A check that the current IP is within the bounds of the current program. Not normally compiled in. Perhaps it should be? * src/vm_system.c (halt): Set vp->ip to NULL. Paranoia, I know. (return): Call CHECK_IP(), if such a thing is compiled in. * testsuite/Makefile.am (vm_test_files): * testsuite/t-catch.scm: * testsuite/t-map.scm: * testsuite/t-or.scm: New tests. 2008-08-09 Andy Wingo backtraces on meta-commands too * module/system/repl/repl.scm (call-with-backtrace): New helper. (start-repl): Use the helper, for normal expressions *and* for meta-commands. warn and load source file if newer than compile file * ice-9/boot-9.scm (try-module-autoload): Warn if the compiled file is older than the source file, and in that case load the source file. don't truncate .go files, do an atomic rename to prevent SIGBUS * module/system/base/compile.scm (call-with-output-file/atomic): New proc, outputs to a tempfile then does an atomic rename. Prevents SIGBUS if a compiled file is truncated and rewritten, as the file's objcode is mmap'd in. (compile-file): Use the new helper. 2008-08-09 Andy Wingo fix source location reporting for compiled code * module/system/repl/repl.scm (default-catch-handler): Cosmetic improvements on VM error backtraces. * module/system/vm/frame.scm (print-frame): Cosmetic improvements. (frame-line-number): source:line operates on the handle, not the cdr. (print-frame-chain-as-backtrace): Cosmetic improvements. 2008-08-08 Andy Wingo heapify the bootstrap program * src/vm_engine.c (vm_run): * src/programs.c (scm_c_make_program): If the holder is #f, malloc *and* copy the bytecode. * module/system/vm/frame.scm (bootstrap-frame?): Now that we actually heapify the bootstrap program, we can check for `halt' in the bytecode. 2008-08-08 Andy Wingo More relevant VM backtrace * module/system/repl/repl.scm: Remove a useless print in the backtrace handler. * module/system/vm/debug.scm (vm-backtrace): s/reverse!/reverse/ * module/system/vm/frame.scm (bootstrap-frame?): A heuristic to see if a frame is a bootstrap frame, the one allocated on the stack in vm_engine.c; need to have a better solution for this. (make-frame-chain): Don't include bootstrap frames, they add no information. (print-frame-chain-as-backtrace): Remove a pk. * src/vm_engine.c (vm_run): Add a fixme about the bootstrap prograp. 2008-08-08 Andy Wingo improve source loc info in nonlocal exits and backtraces * module/system/il/compile.scm (codegen): The currently-executing instruction is actually the one right before the instruction pointer; so for purposes of assv to find a source location for an ip, put the source after the code, as it was before. * module/system/vm/debug.scm (vm-backtrace): Move more code to frame.scm. * module/system/vm/frame.scm (make-frame-chain): Include all frames, even the bootstrap one. For a reentrant backtrace we'll have boostrap programs anyway. Probably should check for objcode[2] == scm_op_halt, to not show those frames in the trace. (frame-line-number, frame-file): New helpers. (print-frame): Print out the line number too. (frame-call-representation): Code from print-frame-call moved here. (print-frame-chain-as-backtrace): A backtrace printer, yays. (program-name): Check link validity before calling frame-address on it. * module/system/vm/program.scm (source:addr, source:line, source:column) (source:file): New accessors for the elements of program-sources. * module/system/vm/vm.scm (vm:last-ip): New export. (vm-last-frame-chain): Use vm:last-ip in making the frame chain. * src/vm.h (struct scm_vm): * src/vm.c (make_vm, scm_vm_last_ip, scm_vm_save_stack): Save the last instruction pointer when saving the stack. Really though, we should be saving all of the stack data on a spaghetti stack. * src/vm_system.c (late-variable-ref): Pointless s/REGISTER/BEFORE_GC/. 2008-08-08 Andy Wingo fix bug in variable-set instruction; ,x prints out program metadata * module/system/vm/disasm.scm (disassemble-program, disassemble-meta): Disassemble program meta information too, if it's there. * src/vm_system.c (variable-set): Don't try to proxy name information; maybe we can do this later, but the code as it was was calling SCM_CAR on a variable, which is for the lose. 2008-08-07 Andy Wingo fix stack corruption on vm-save-stack; more robust with nonlocal exits * module/system/repl/command.scm: Coerce rationals to floats. * module/system/vm/program.scm (program-documentation): Fix a typo, doh! * src/vm.c (vm_reset_stack, struct vm_unwind_data): Add unwind handler to reset vp->sp, vp->fp, and vp->this_frame when performing a nonlocal exit from a vm_run. (vm_heapify_frames_1): Don't repack the stack, it causes stack corruption. I think we need spaghetti stacks to handle continuations, not separate heap frames. I don't think call/cc is working now. (vm-save-stack): Don't call heapify_frames, that modifies the stack that we're copying. Instead call its helper, heapify_1. * src/vm_engine.c (vm_run): Set up the vm_reset_stack unwind handler. * src/vm_engine.h (IP_REG, SP_REG, FP_REG): If we got through all of the checks without having these macros defined, define them as empty. Happens on x86-64. * src/vm_system.c (halt): End the dynwind before we return from the VM. * src/vm_scheme.c (REL): Sync the regs before calling scm_lt_p et al, cause they can do a nonlocal exit. 2008-08-07 Andy Wingo vm backtrace improvements * module/system/repl/repl.scm (default-pre-unwind-handler): Save the VM stack in addition to the interpreter stack. At some point these functions should know about each other, I guess. (default-catch-handler): Show the VM stack too. Needs a bit of work. * module/system/vm/frame.scm: Export make-frame-chain. * module/system/vm/vm.scm: Export vm-save-stack. * src/vm.c (scm_vm_save_stack): New function, heapifies the current stack, saving it to vm->last_frame. * src/vm_engine.c (vm_run:vm_error): Don't heapify frames here, because nonlocal exits avoid this code entirely. Instead rely on the user saving the stack with a pre-unwind handler, as the repl does. 2008-08-07 Andy Wingo build fixes * benchmark/measure.scm: Update for module changes. * module/system/vm/Makefile.am: Update the set of modules needing compilation. * src/guile-vm.c: Bootstrap the VM, now that we have a function for it. * testsuite/Makefile.am: * testsuite/run-vm-tests.scm: Update to fix make check, broken since we merged with Guile. 2008-08-07 Andy Wingo big reorg of scheme modules -- e.g. programs.c -> (system vm program) This reorganization kills the ugly module-export-all hacks in bootstrap.scm and core.scm. In fact, it gets rid of core.scm entirely, breaking out its functionality into separate files. * module/system/vm/trace.scm: * module/system/vm/profile.scm: * module/system/vm/disasm.scm: * module/system/vm/debug.scm: * module/system/vm/conv.scm: * module/system/vm/assemble.scm: * module/system/repl/repl.scm: * module/system/repl/common.scm: * module/system/base/compile.scm: * module/system/repl/command.scm: Update for changes, and fix a bug in procedure-documentation. * module/system/vm/bootstrap.scm: Just call scm_bootstrap_vm, which handles setting load-compiled for us. * module/system/vm/core.scm: Removed, functionality folded into other modules. * module/system/vm/frame.scm: Export the C frame procedures here; also move scheme functions from core.scm here. * module/system/vm/instruction.scm: New file, exports procedures from instructions.c. * module/system/vm/objcode.scm: New file, exports procedures from objcodes.c. * module/system/vm/program.scm: New file, exports procedures from programs.c, and some scheme functions originally from core.scm. * module/system/vm/vm.scm: New file, from vm.c and core.scm. * src/Makefile.am (libguile_vm_la_SOURCES): Add bootstrap.h. * src/bootstrap.h: New file, prototypes scm_bootstrap_vm (), which the scm_init_* functions call. * src/frames.h: * src/frames.c (scm_init_frames): * src/frames.c (scm_bootstrap_frames): * src/vm.h: * src/instructions.h: * src/instructions.c (scm_init_instructions): * src/instructions.c (scm_bootstrap_instructions): * src/objcodes.h: * src/objcodes.c (scm_bootstrap_objcodes): * src/objcodes.c (scm_init_objcodes): * src/programs.h: * src/programs.c (scm_bootstrap_programs): * src/programs.c (scm_init_programs): * src/vm.c (scm_bootstrap_vm): * src/vm.c (scm_init_vm): Call scm_bootstrap_vm() before doing anything in an init function. Bootstrap_vm will call bootstrap_instructions(), etc to initialize types, then set load-compiled to point to load-compiled/vm. * src/vm.c (scm_load_compiled_with_vm): Code to load .go files, if they're present. 2008-08-06 Andy Wingo sync registers before calling c functions, really * src/vm_loader.c: * src/vm_scheme.c: Use SYNC_REGISTER, although it's the same as SYNC_BEFORE_GC. A style issue? * src/vm_system.c (call, tail-call): Explicitly do a SYNC_REGISTER, not relying on POP_LIST to do it for us, because POP_LIST won't do it if there are 0 arguments. The way that this manifested itself to me was badness after the second (read) call in a repl session. I wish I understood more about this problem. 2008-08-05 Andy Wingo save vm's state before calling out to c procedures * .gitignore: Ignore .go files. * src/vm_loader.c: * src/vm_scheme.c: * src/vm_system.c: Sync the VM's state before calling out to C procedures that might cons or cause a nonlocal exit. 2008-08-05 Andy Wingo disable trampoline "optimizations" * src/vm_system.c: Disable those trampoline "optimizations", as they actually slowed down benchmark/measure.scm '(fibo 30)'. They were edifying, in that now I have an appreciation of the need for SYNC_ALL(). 2008-08-05 Andy Wingo re-enable computed goto; fix ,help in the repl; subr dispatch optimizations * m4/labels-as-values.m4: New file, checks for computed goto. * configure.in: Use AC_C_LABELS_AS_VALUES. * module/system/repl/command.scm (procedure-documentation): Extend the core's procedure-documentation in an ad-hoc way, so that ,help works. * module/system/vm/core.scm (program-properties): New function. (program-documentation): New function. * src/vm_engine.h (DROP, DROPN): Decrement sp before checking for underflow. * src/vm_system.c (call, tail-call): Add some optimized dispatch for some C functions, so that we can avoid consing and the interpreter if possible. However currently it seems that I'm always getting the scm_call_* trampolines back. 2008-08-03 Andy Wingo Add docstring support * module/language/scheme/translate.scm (translate): Adapt to lambda having a `meta' slot now. (primitive-syntax-table, parse-lambda-meta): Parse out a docstring from lambda forms, putting in the 's meta slot. * module/system/il/compile.scm (optimize, codegen): Passthrough for the `meta' slot to the object. * module/system/il/ghil.scm (): Add meta slot. * module/system/il/glil.scm (): Add meta slot. (unparse): Unparse meta. * module/system/vm/assemble.scm (preprocess): Pass through the meta slot. (codegen): So, set the bytespec's meta slot as a list: bindings, source info, then the tail is the meta-info, which should be an alist. Currently the only defined key is `documentation', but `name' could come in the future. * module/system/vm/core.scm (program-sources): Sources are now in the cadr... (program-property): And here we have access to the cddr. 2008-08-03 Andy Wingo fix recording of source locations * module/language/scheme/translate.scm (translate, trans) (make-pmatch-transformers): When recursing into subexpressions, get the appropriate source location information. (location): Include the source filename in the location information. * module/system/il/compile.scm (codegen): Record source locations in more cases. (This information ends up being part of the procedure metadata, not the actual codepath.) * module/system/il/glil.scm (unparse): Don't destructure the source locations (it's a vector now). 2008-08-02 Andy Wingo only pass symbols to module-ref & c * module/language/scheme/translate.scm: Make sure that we're actually passing symbols to module-ref et al. add compile-toplevel and evaluate conditions to eval-case * ice-9/boot-9.scm (eval-case): Define two more conditions: compile-toplevel and evaluate, as common lisp and chez scheme do. (defmacro, define-option-interface, define-macro, define-syntax-macro) (define-module, use-modules, use-syntax, define-public) (defmacro-public, export, re-export): Add `compile-toplevel' to all uses of eval-case. make has-suffix? use string-suffix? * ice-9/boot-9.scm (has-suffix?): Use the core / srfi-13's string-suffix?. Support loading of compiled syncase macros * ice-9/syncase.scm (current-eval-closure): New procedure. (env->eval-closure): Don't default to the root module: if we have no environment, we default to the current module via the logic in current-eval-closure. This is because psyntax's compilation mode doesn't know about guile modules, and thus won't dump the code to twiddle the current eval closure. (putprop, getprop, guile-macro): Use `current-eval-closure'. At the end, leave the expansion-eval-closure set to #f. support thunks as prompts, as readline does. * ice-9/boot-9.scm (repl-reader): Support thunks as prompts. make readline's `repl-reader' impl check the current-reader fluid * guile-readline/ice-9/readline.scm (activate-readline): Use the current binding of the current-reader fluid, if it is available. 2008-08-02 Andy Wingo Fixes to make guile-vm compile in guile source tree * INSTALL: Updated. * m4/gnulib-cache.m4: Regenerated. * Makefile.am: Spelling fix. * guilec.mk: * src/Makefile.am: * src/vm.c: Update to actually work inside a guile source tree. * libguile/Makefile.am: Don't error on warnings in the flex-generated c-tokenize function. 2008-08-02 Andy Wingo merge guile-vm to guile An attempt to pull in the original history from guile-vm into guile itself. 2008-05-25 Andy Wingo Updated loop disassembly * benchmark/lib.scm: Update loop disassembly, with inlining. Neat! add inline macros for zero? and 1- * module/system/il/inline.scm (zero?, 1-): New inlines. Neat :) The loop benchmark speedup is now up to 5x. 2008-05-25 Andy Wingo Speed up the self-tail-recursive case (1x->2x) * benchmark/lib.scm: Add a comment, update the loop disassembly. Loop is now faster in the VM, thankfully. * src/vm_engine.h (CACHE_PROGRAM): Only release and regrab the object array handle if the program changed. That is to say, optimize the self-tail-recursive case. But perhaps the thing to optimize here are the procedure calls themselves. Worth looking at in the future. 2008-05-25 Andy Wingo enable inlining; speed! * module/system/il/inline.scm: New module, implements generic inlining of scheme functions. It even does the right thing regarding (define arity:nopt caddr) and such. So now there are many more inlines: the arithmetics, `apply', the caddr family, etc. This makes the benchmarks *much* faster. * module/language/scheme/translate.scm (trans): Remove the %scheme-primitives code in favor of the generic (scheme il inline) code. Adds inlining for +, -, =, etc. * src/vm.c (vm_puts): Fix to work. * module/system/base/compile.scm (system): Export load/compile also. * module/system/il/compile.scm (optimize): Further debitrotting, but I haven't tried this function yet. It seems that was what is. * module/system/il/ghil.scm (*core-primitives*, *macro-module*) (ghil-primitive-macro?, ghil-macro-expander, ghil-primitive?): Remove these unused things. * module/system/il/macros.scm: Removed, replaced with inline.scm. * module/system/vm/assemble.scm (stack->bytes): Before, the final serialization code did an (apply u8vector (apply append (map u8vector->list ...))). Aside from the misspelling of append-map, this ends up pushing all elements of the u8vector on the stack -- assuredly not what you want. But besides even that, I think that pushing more than 32k arguments on the stack brings out some other bug that I think was hidden before, because now we actually use the `apply' VM instruction. Further testing is needed here, I think. Fixed the code to be more efficient, which fixes the manifestation of this particular bug: a failure to self-compile after inlining was enabled. * module/system/vm/bootstrap.scm: New module, serves to bootstrap boot-9's `load-compiled'. That way when we load (system vm core), we're loading compiled code already. * module/system/vm/core.scm: Use (system vm bootstrap). * src/guilec.in: Use the bootstrap code, so that we really are compiling with an entirely compiled compiler. * module/system/repl/repl.scm (default-catch-handler): An attempt at making the repl print a backtrace; more work needed here. * module/system/vm/frame.scm (make-frame-chain): Fix some misspellings -- I think, anyway. 2008-05-20 Andy Wingo update news * NEWS: Update news for 0.7 release 2008-05-20 Andy Wingo distcheck works now * guilec.mk: New file, to be included when building .go files. * module/language/scheme/Makefile.am: * module/system/base/Makefile.am: * module/system/il/Makefile.am: * module/system/repl/Makefile.am: * module/system/vm/Makefile.am: Use guilec.mk. * module/system/base/compile.scm (compiled-file-name): Work on the basename of a file, so that we always create files in the directory where we run. Perhaps should add a -o option to guilec in the future. * Makefile.am: Actually recurse into module/ in a normal build. 2008-05-20 Andy Wingo include local copy of guile.m4 * acinclude.m4: Add guile.m4 to this, because I really can't be arsed with aclocal. * autogen.sh: More better vanilla. 2008-05-20 Andy Wingo autotooling, version bump to 0.7 * acconfig.h: Removed. * acinclude.m4: Use the extended AC_DEFINE for HAVE_LABELS_AS_VALUES, so as to remove the need for acconfig.h. * autogen.sh: Use autoreconf. * configure.in: Update info, don't warn about non-gnu make, bump version to 0.7. * doc/texinfo.tex: Automagically updated. (Should this be in VCS?) 2008-05-20 Andy Wingo fix distcheck * src/Makefile.am (AM_CFLAGS, libguile_vm_la_LDFLAGS): Don't build with -pg. (There are better profilers out there.) (CLEANFILES): Add guilev and guile-disasm. * testsuite/Makefile.am (GUILE_VM): s/srcdir/builddir/. 2008-05-20 Andy Wingo properly include config.h in source files, not headers * src/Makefile.am: Add $(DEFAULT_INCLUDES) to a couple of our custom rules so we pick up the -I for config.h. * src/*.[ch]: Include the config.h in the C files, not in the headers. 2008-05-20 Andy Wingo guile-vm is completely self-compiling now! * module/language/scheme/translate.scm (*the-compile-toplevel-symbol*): Reset to compile-toplevel, which requires a patch to guile. * module/system/base/compile.scm (compile-file): Some foo so that we load up the scheme language before call-with-output-file. Fixes compilation of (language scheme) modules. * module/system/base/language.scm (define-language): Don't unquote in make-language; refer to it by name instead, and export it. * module/system/repl/Makefile.am (vm_DATA): Don't compile describe.scm, because we really can't deal with goops yet. * module/system/repl/repl.scm (compile-toplevel): If we're compiling, put in a stub definition of start-stack, which is closely tied to the interpreter. * src/vm_loader.c (load-program): Fix a very tricky corruption bug! 2008-05-19 Andy Wingo fix syntax error in describe.scm * module/system/repl/describe.scm (format-documentation): Remove bad string syntax. This file doesn't compile though, due to define-macro being a procedure->syntax macro. 2008-05-19 Andy Wingo fix immediate linkage, some other fixes to allow vm/ to compile * module/language/scheme/translate.scm (lookup-transformer): Allow for undefined variables when doing the transformation -- it's possible that they come from a module definition's forward declaration. * module/system/repl/command.scm (import): Make into legal Scheme, caught by the compiler :-) * module/system/vm/assemble.scm (): Remove the module field. Immediate bindings will now always be relative to the current module. Fixes some mess about process-define-module not being defined when loading modules, probably because we destructively modified the ghil-env. (codegen, dump-object!): Don't dump a module name. * src/vm_loader.c (link-now): Just use scm_lookup. 2008-05-19 Andy Wingo bind all module-level variables lazily comments in ghil-lookup are pertinent. * module/system/il/compile.scm (make-glil-var): Require that ghil vars have environments. Remove the 'unresolved case -- we'll treat all module-level variables as late bound. * module/system/il/ghil.scm (ghil-lookup): Treat all module level vars as late bound. * module/system/vm/assemble.scm: Instead of vlink and vlate-bound, have vlink-now and vlink-later. (codegen): Add a bunch of crap to get the various cases right. (object-assoc, dump-object!): Handle the new cases, remove the old cases. * src/vm_loader.c (link-now, link-later): Change from link and lazy-bind. Include the module in which the link is to be done, so that callers from other modules get the right behavior. * src/vm_system.c (late-variable-ref, late-variable-set): Instead of a sym, the unbound representation is a module name / symbol pair. * testsuite/run-vm-tests.scm (run-vm-tests): Remove some debugging. 2008-05-19 Andy Wingo Add instructions for doing very late binding Fixes the mutually-recursive toplevel definitions case. This could be fixed by rewriting bodies as letrecs, as r6 does, but that's not really repl-compatible. * module/system/il/ghil.scm (ghil-lookup): Ok, if we can't locate a variable, mark it as unresolved. * module/system/il/compile.scm (make-glil-var): Compile unresolved variables as objects. * module/system/il/glil.scm: Add definition. * module/system/vm/assemble.scm (codegen): And, finally, when we see a object, allocate a slot for it in the object vector, setting it to a symbol. Add a new pair of instructions to resolve that symbol to a variable at the last minute. * src/vm_loader.c (load-number): Bugfix: the radix argument should be SCM_UNDEFINED in order to default to 10. (late-bind): Add an unresolved symbol to the object vector. Could be replaced with load-symbol I guess. * src/vm_system.c (late-variable-ref, late-variable-set): New instructions to do late symbol binding. * testsuite/Makefile.am (vm_test_files): * testsuite/t-mutual-toplevel-defines.scm: New test, failing for some reason involving the core even? and odd? definitions. 2008-05-19 Andy Wingo compile all of base/; some arbitrary changes; more "fixes" to `link' * module/language/scheme/translate.scm (lookup-transformer): When expanding syncase macros, use the eval closure from the ghil-env. Probably doesn't make any difference whatsoever. * module/system/base/Makefile.am (SOURCES): Compile pmatch.scm, now that it works :-)) * module/system/base/compile.scm (compile-in): Compile inside a save-module-excursion, so that side effects of evaluation don't leak out. * module/system/base/pmatch.scm: Change from :use-syntax/:export-syntax to simply :use-modules/:export. Also probably has no effect. * module/system/il/ghil.scm (fix-ghil-mod!): Suppress warnings resulting from compilation of define-module. * src/vm_loader.c (link): So, referencing variables defined but not exported from the current module didn't work. Fixed that, but it's hacky. There are still some uncaught cases. 2008-05-19 Andy Wingo syncase macros compiling! * module/system/base/compile.scm: Also import load-objcode from (system vm core). * module/language/scheme/translate.scm (lookup-transformer): Use sc-expand3 in compilation mode when compiling macros. Yay, syncase macros compile! 2008-05-15 Andy Wingo rudimentary syncase support; some dash symbol syncase removal * module/system/vm/assemble.scm (dump-object!): * src/vm_loader.c (VM_DEFINE_LOADER): Use scm_from_locale_keywordn, not the krazy dash symbol stuff. * module/language/scheme/translate.scm (lookup-transformer): Add a special case for syncase macros. 2008-05-15 Andy Wingo avoid zealous unquotation * module/system/base/syntax.scm (define-record): Again, don't unquote in actual objects, because this is uncompilable. Ah well. At least now all of base/ is compiling. * module/system/vm/assemble.scm (dump-object!): More debug info. 2008-05-15 Andy Wingo fix else in cond, letrec env corruption, syntax.scm compile, define-module side effects * module/language/scheme/translate.scm (primitive-syntax-table): Translate the `else' clause of a cond as (begin ...). We used to use trans-body, which processes internal defines, which are not legal syntax here. * module/system/base/syntax.scm (define-record): Unfortunately, we can't unquote in the actual procedure for `%compute-initargs', because that doesn't work with compilation. So reference %compute-initargs by name, and export it. * module/system/il/ghil.scm (apopq!): Gaaaaar. The order of the arguments to assq-remove! was reversed, which was the badness, causing corruption to the env after calling call-with-ghil-bindings. Grrrrrr. (fix-ghil-mod!, ghil-lookup, ghil-define): As amply commented in the code, deal with compile-time side effects to the current module by lazily noticing and patching up the compile-time environment. A hacky solution until such a time as we special-case something for `define-module'. 2008-05-15 Andy Wingo `link' instruction links to symbols by module * module/system/il/compile.scm (make-glil-var): Only dump the module if we actually have one. * module/system/il/ghil.scm (ghil-define): Make sure that ghil-var-env is a ghil-env. * src/vm_loader.c (link): * module/system/vm/assemble.scm (dump-object!): Rewrite `link' to take two Scheme arguments on the stack: the symbol, as before, and the module in which the symbol was found at compile time. This introduces some undesireable early binding, but it does let the vm load up modules, and (potentially) have multiple modules in one .go file. On a practical level, I can now compile modules and have their .go files load up the modules' dependencies as necessary. 2008-05-15 Andy Wingo remove some debugging info * module/system/vm/assemble.scm: remove a pk 2008-05-15 Andy Wingo push the module resolution info for variables down into glil * module/system/il/compile.scm (make-glil-var): Make the :mod of the glil-var actually a guile module, not a ghil-env. * module/system/il/ghil.scm (module-lookup, ghil-lookup): For module variables, encode the location where we found the variable in the ghil-var. 2008-05-15 Andy Wingo fix dumping of #:keywords * module/language/scheme/translate.scm (trans): * module/system/il/compile.scm (codegen): When making records where a value can be a keyword, make sure to use the keyword initialization form, so that the record initializer doesn't interpret the keyword as a slot name. * module/system/base/Makefile.am (vm_DATA): For now, don't compile pmatch. 2008-05-15 Andy Wingo allow interpretation of load-toplevel as compile-toplevel * module/language/scheme/translate.scm (*the-compile-toplevel-symbol*) (primitive-syntax-table): Existing eval-case invocations in boot-9.scm only have `load-toplevel', not `load-toplevel' and `compile-toplevel' as they should. Allow for interpreting `load-toplevel' as `compile-toplevel'. rework eval-case handling to be like cl's eval-when * module/language/scheme/translate.scm (trans): Remove the hacky case for the unspecified value, not needed any more. (primitive-syntax-table): Rework eval-case to understand compile-toplevel and evaluate contexts, as in common lisp's eval-when: http://www.lisp.org/HyperSpec/Body/speope_eval-when.html This is the Right Thing. 2008-05-14 Andy Wingo fix use-syntax / use-modules confusion -- fixes testsuites * testsuite/t-match.scm: * testsuite/t-records.scm: While the attempt to redefine use-syntax as being "use during compilation" was cute, it does not reflect the historical usage of use-syntax, nor does it correspond to existing code that includes other modules and uses them during compilation. So use-syntax has been replaced with use-modules. The test suites now pass. In the future, compilation phases should be done on whole modules, I think; r5rs-style computation does not have phases. 2008-05-14 Andy Wingo fix macro compilation via hooking into eval-case * module/language/scheme/translate.scm (eval-at-compile-time) (&compile-time-module, expand-macro): Remove this attempt at dealing with macros. Instead, we're going to rely on macros being first-class, and just catch eval-case at the bottom. (lookup-transformer): Lookup all syntax transformers in the module's eval closure. We catch the primitive-macros, compiling them to ghil, and expand the rest. (lookup-transformer): Fold in trans-pair here. Add a hacky case for the unspecified value; the problem shows up when compiling e.g. (define-macro (plus! x) `(set! ,x (1+ x))), as a fallout from eval-case. (make-pmatch-transformers, primitive-syntax-table): Define the primitive syntax transformers as a data-driven table instead of a function. There's a bit of syntax, too. Eval-case was rewritten to use pmatch. * module/system/base/compile.scm (scheme): Define as a thunk instead of a value, so as to allow (language scheme translate) to be imported in the repl. Still, a hack. 2008-05-14 Andy Wingo (void) -> (begin) * module/language/scheme/translate.scm (expand-macro, trans-pair): Remove support for the scheme form, '(void). Replace it by (begin). What was Keisuke thinking? :) remove x.foo.bar -> (slot x 'foo 'bar) compile-time translation * module/language/scheme/translate.scm (trans): Remove compile-time dot expansion. 2008-05-13 Andy Wingo fix env script * env: Fix env script to find $top_srcdir correctly 2008-05-13 Andy Wingo Update Makefile.am's; remove slib import * Makefile.am: * module/Makefile.am: * module/language/scheme/Makefile.am: * module/system/Makefile.am: * module/system/base/Makefile.am: * module/system/il/Makefile.am: * module/system/repl/Makefile.am: * module/system/vm/Makefile.am: Cleaned up to be more complete, if not completely working. * module/guile/slib.scm: * module/slib/: Removed the slib import; it's a bit out of place here, and bitrotten at that. 2008-05-12 Andy Wingo add env script * env: New file, run as ./env guile catch errors in the repl, with poor backtraces * module/system/repl/repl.scm (default-pre-unwind-handler) (default-catch-handler): New procedures, to do some error handling in the repl. (start-repl): Catch errors in the repl loop. 2008-05-12 Andy Wingo replace cenv with things in and fluids; remove the `use' meta-command * module/system/base/compile.scm (): No more cenv, it was a useless data structure. * module/system/repl/command.scm (*command-table*): Remove `use', it's the same as `import'. Otherwise in this file, adapt to the repl having direct pointers to the vm and the language, and to the module being in the current-module fluid. * module/system/repl/repl.scm (prompting-meta-read): * module/system/repl/common.scm (): The repl now has a direct pointer to the vm and language. Adapt accordingly. 2008-05-12 Andy Wingo fixes so that typing asdfadfasff in the repl doesn't error Before: > ,c (set! x 3) 0 (make-int8 3) ;; 3 2 (link "x") 5 (variable-set) > ,c (define x 3) 0 (make-int8 3) ;; 3 2 (link "x") 5 (variable-set) After: > ,c (define x 3) 0 (make-int8 3) ;; 3 2 (define "x") 5 (variable-set) * src/vm_loader.c (link): `link' now errors if the variable is undefined. This corresponds with desired behavior, for both `ref' and `set' operations, for scheme. It's not what elisp wants, though. Perhaps elisp linking needs another instruction. (define): New instruction, the same as calling scm_define(), basically. * module/language/scheme/translate.scm (trans-pair): Don't try to look up an existing variable definition when translating `define'; instead use the special-purpose lookup from ghil.scm's `ghil-define'. * module/system/il/compile.scm (codegen): Compile to a different kind of variable access from `set!', specifically via passing 'define as the op to `make-glil-var'. * module/system/il/ghil.scm (ghil-lookup): Don't add to the module table when compiling variable sets via `set!'. (ghil-define): New procedure, for looking up variables for `define'. * module/system/vm/assemble.scm (): New record: a new instruction type. (codegen): Compile `define' module vars into . (dump-object!): == `define'. 2008-05-11 Andy Wingo only allow `define' at toplevel * module/language/scheme/translate.scm (trans-pair): Add a guard to only allow `define' at the top level; other defines are already filtered out via trans-body. * module/system/il/ghil.scm (ghil-env-toplevel?): Export, and fix. 2008-05-11 Andy Wingo remove define-private * module/language/scheme/translate.scm: Remove define-private. explicitly list exports instead of using define-public * module/system/base/compile.scm: * module/system/il/ghil.scm: * module/system/repl/describe.scm: * module/system/vm/core.scm: * module/system/vm/frame.scm: * module/system/vm/trace.scm: Explicitly list exports in the module declaration instead of using define-public. 2008-05-11 Andy Wingo ? -> foo?; some exports cleanups * module/system/base/compile.scm: Export cenv? also. * module/system/base/syntax.scm: Clean up vestiges of the old structure code. Make accessors defined as foo? instead of ?. * module/system/il/glil.scm: * module/system/il/ghil.scm: Remove -1 accessors, since we have named accessors. 2008-05-11 Andy Wingo pmatchify a cond for prettiness * module/language/scheme/translate.scm: pmatchify, it's prettier. fix to meta-reader's optional port argument * module/system/repl/repl.scm (meta-reader): Make the generated read procedure accept a port argument. 2008-05-09 Andy Wingo ice-9 history integration * module/system/repl/repl.scm (start-repl): (ice-9 history) integration via the before-eval-hook and the before-print-hook. 2008-05-09 Andy Wingo readline integration for guile-vm * module/system/repl/common.scm (repl-prompt): Return a string instead of outputting to the port, for better readline integration. * module/system/repl/repl.scm (meta-reader, prompting-meta-read) (start-repl): Integrate with (ice-9 readline) via the current-reader fluid and the repl-reader function, both from boot-9.scm. 2008-05-09 Andy Wingo more exports cleanups * module/system/repl/common.scm: Declare exports in the module declaration. 2008-05-09 Andy Wingo multiple-values help for the repl; exports cleanups * module/system/repl/command.scm (system): Declare exports in the module declaration. * module/system/repl/repl.scm (start-repl): If the evaluation returns multiple values, print them separately. 2008-05-04 Andy Wingo Replace ice-9 match's structures with guile's records * module/system/base/syntax.scm (define-record): Rebase to implement on top of Guile's records, which are the substrate of srfi-9's records. (%compute-initargs): Rename from %make-struct, just return the list of values. (get-slot, set-slot!, slot): Removed, no longer used. (record-case): Allow slots of the form (MYNAME SLOTNAME), which binds SLOTNAME to MYNAME (instead of SLOTNAME to SLOTNAME). (record-case, record?): No more ice-9 match! * module/system/il/compile.scm (codegen): Tweaks so that the new record code works. * module/system/il/ghil.scm: Fix some slot references. * module/system/vm/assemble.scm (preprocess, codegen): Remove calls to `slot'. (codegen): Fix some slot references. 2008-05-04 Andy Wingo Removed dot-expander syntax foo * module/system/base/syntax.scm (expand-dot!, expand-symbol, syntax): Removed, we don't use this syntax any more. 2008-05-04 Andy Wingo finish dedottifying * module/system/base/compile.scm: Dedottify. * module/system/base/language.scm: Export language accessors. * module/system/repl/common.scm: Dedottify. It's ugly, I know. 2008-05-04 Andy Wingo more dedottification, almost done * module/system/repl/common.scm: * module/system/base/compile.scm: Export some more things. * module/system/repl/command.scm: Dedottify. 2008-05-04 Andy Wingo Dedottify some more * module/system/il/compile.scm: Dedottify. * module/system/il/ghil.scm: Export some more thingies. 2008-05-04 Andy Wingo procedures-with-setters, debitrot `optimize', dedottification * module/system/base/syntax.scm (define-record): Define the accessors as procedures-with-setters, not just as getters. * module/system/il/compile.scm (optimize): This function was bitrotten since the addition of source locations in cb4cca12e719edfef1740f238d9187c21c8e1e35. Untested attempts to de-bitrot it. Dedottify as well. * module/system/il/ghil.scm: * module/system/il/glil.scm (unparse): * module/system/vm/debug.scm (debugger-repl): Ongoing dedottification. 2008-05-04 Andy Wingo fix errors in (language scheme translate) introduced in pmatchification * module/language/scheme/translate.scm (trans-pair): Fix some errors introduced in pmatchification. Start the process of de-dottification. * module/system/vm/assemble.scm: De-dottify. 2008-05-04 Andy Wingo Define named accessors for legacy record types * module/system/base/syntax.scm (define-record): Define named accessors, to prepare the code for srfi-9 records switchover. * module/system/il/ghil.scm: * module/system/il/glil.scm: Export a bunch of named accessors. 2008-05-04 Andy Wingo Refactor (language scheme translate) to use pmatch * module/language/scheme/translate.scm: Refactor use of `match' to use `pmatch'. Relatively straightforward. * module/system/base/pmatch.scm (ppat): Fix some copy-n-paste bugs: the _ rule, the quote rule. 2008-05-03 Andy Wingo more pmatchification * module/system/il/ghil.scm: No need for a match * module/system/repl/command.scm: Pmatchify * module/system/vm/disasm.scm: Pmatchify. 2008-05-03 Andy Wingo bugfix to make-cenv * module/system/base/compile.scm (make-cenv): Fix make-cenv. 2008-05-03 Andy Wingo start using pmatch instead of match * module/system/base/Makefile.am: Add pmatch.scm. * module/system/base/pmatch.scm: New file, taken from Dan Friedman's alpha-kanren paper. Implements a less magical match syntax, pmatch. * module/system/vm/assemble.scm: No more need for (ice-9 match). * module/system/vm/conv.scm (code-pack, code->object): Change to use pmatch. 2008-05-03 Andy Wingo s/match-lambda\*/case-lambda/g * module/system/il/macros.scm: Use case-lambda from srfi-16 rather than match-lambda*. 2008-05-03 Andy Wingo convert a couple more modules to record-case * module/system/base/syntax.scm (record-case): Capture the match macro. * module/system/il/glil.scm: * module/system/il/compile.scm: Convert to record-case. 2008-05-03 Andy Wingo unify variant types and records; also make-foo instead of * module/system/base/syntax.scm (define-record): Rework to separate the type and its constructor. Now (define-record ( bar)) will create `make-foo' as the constructor, not `'. Also the constructor now takes either keyword or positional arguments, so that it can be used as the implementation of variant types as well. (|): Map directly to define-record instead of rolling our own thing. * module/language/scheme/translate.scm: * module/system/base/language.scm: * module/system/il/compile.scm: * module/system/il/ghil.scm: * module/system/il/glil.scm: * module/system/repl/common.scm: * module/system/vm/assemble.scm: * module/system/vm/debug.scm: Change instances of record creation to use the make-foo procedures instead of . Adjust module exports as necessary. 2008-05-03 Andy Wingo Convert assemble.scm to use record-case. * module/system/base/syntax.scm (record?): Temporarily export this thing, so that code will remain correct when I change to srfi-9 records. * module/system/vm/assemble.scm: Convert to use record-case. 2008-05-03 Andy Wingo fix to (system base syntax)'s syntax * module/system/base/syntax.scm: Fix define-module rebase record-case on `match' * module/system/base/syntax.scm (record-case): Rebase on `match', for transition purposes. pull in srfi-9, implement record-case * module/system/base/syntax.scm: Pull in srfi-9. Define a record-case macro that will replace (match foo (($ slot ...) body...)). 2008-05-02 Andy Wingo clean up some syntax imports and exports * module/system/base/syntax.scm (system): Don't re-export receive or and-let*; modules should explicitly import these if they want to. Don't export an empty stack-catch definition! * module/system/repl/command.scm (system): Pull in and-let*. * module/system/vm/disasm.scm (system): Don't import and-let*. 2008-05-02 Andy Wingo remove module.scm * module/system/base/module.scm: Removed module.scm, as it was unused (see 9419ff9ae91c93983972797e607e135ecd1233bb). 2008-05-02 Andy Wingo cleanups in syntax.scm * benchmark/lib.scm (fibo): Make fibo actually a fibonacci sequence. * module/system/base/syntax.scm (system): Forward-declare all exports. (expand-symbol, slot): Rewrite expand-symbol to expand to a non-recursive invocation of `slot', so that in the future when we get rid of this syntax, the replacement will be more palatable to the eyes. 2008-04-25 Ludovic Courtes Slowly improving support for macro compilation. * module/language/scheme/translate.scm (¤t-macros): Removed. (¤t-macro-module): Removed. (&compile-time-module): New. (eval-at-compile-time): New. (translate): Initialize `&compile-time-module'. (expand-macro)[use-syntax]: New case. [begin let...]: Don't expand these built-in macros. [else]: Rewrote the macro detection and invocation logic. Invoke macro transformers in the current compile-time module. (trans): Let `expand-macro' raise an exception if needed. (trans-pair)[defmacro define-macro]: Evaluate the macro definition in the compile-time module. * testsuite/t-match.scm: Use `use-syntax' instead of `use-modules' for `(ice-9 match)' and `(srfi srfi-9)'. * testsuite/t-records.scm: Likewise. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-15 2008-04-25 Ludovic Court`es Fixed `autogen.sh' and removed `module' from the list of dirs to build. * autogen.sh: Fixed (call `libtoolize'). * Makefile.am (SUBDIRS): Removed `module' which doesn't build right now. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-16 2008-04-25 Ludovic Courtes Improved macro handling; started documenting the issue. * doc/guile-vm.texi (Compiling Scheme Code): New node. * module/language/scheme/translate.scm (¤t-macro-module): New. (translate): Evaluate macros in `¤t-macro-module'. (trans-pair): Likewise. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-13 2008-04-25 Ludovic Courtes Fixed the exception handler of `guilec'. * src/guilec.in: Fixed the exception handler. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-12 2008-04-25 Ludovic Courtes Encode the length of constant lists/vectors on 2 octets instead of 1. * module/system/vm/assemble.scm (dump-object!): New sub-procedure `too-long'. For `list' and `vector', encode the length on 2 octets instead of 1 and report an error if a list/vector is longer than 65535. * module/system/vm/disasm.scm (original-value): New sub-procedure `list-or-vector?'; when true, return the number of elements for that list/vector. * src/vm_system.c (list): Fetch the length as a two-octet integer. (vector): Likewise. * testsuite/t-basic-contructs.scm: New. * testsuite/Makefile.am (vm_test_files): Added the above file. * module/system/vm/core.scm (load-compiled): Added a bit of documentation. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-11 2008-04-25 Ludovic Courtes Renamed the library from `libguilevm' to `libguile-vm'. * src/Makefile.am (lib_LTLIBRARIES): Renamed to `libguilevm.la' to `libguile-vm.la'. * module/system/vm/core.scm: Dynamic-link "libguile-vm" instead of "libguilevm.so". git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-10 2008-04-25 Ludovic Courtes Added support for `defmacro' and `define-macro' in the compiler. * module/language/scheme/translate.scm: Use `(srfi srfi-39)'. (¤t-macros): New top-level. (expand-macro): New. (scheme-primitives): Renamed `%scheme-primitives'. (%forbidden-primitives): New. (trans): Use `expand-macro' instead of `macroexpand'. (trans-pair): Handle `define-macro' and `defmacro'. * module/system/base/compile.scm (call-with-compile-error-catch): Handle non-pair LOC. * testsuite/t-macros2.scm: New test case. * testsuite/Makefile.am (vm_test_files): Updated. * testsuite/t-macros.scm: Test `read-options'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-9 2008-04-25 Ludovic Courtes Fixed an "unbound variable" in `(system vm conv)'. * module/system/vm/conv.scm: Autoload `(system vm core)' also when `opcode->instruction' is hit. This fixes an "unbound variable" problem. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-8 2008-04-25 Ludovic Courtes Fixed error handling; detect and report macro expansion errors. * module/language/scheme/translate.scm (trans): Catch exceptions thrown by `macroexpand' and throw a syntax error. (trans-pair): Catch calls to `procedure->memoizing-macro' and raise a syntax error. * module/system/base/compile.scm (call-with-compile-error-catch): Made a macro (a procedure doesn't do the job). (compile-file): Uncommented call to `call-with-compile-error-catch'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-7 2008-04-25 Ludovic Courtes Tried compiling more code; augmented the doc. * module/language/Makefile.am: New. * module/language/scheme/Makefile.am: New. * configure.in: Produce these two new Makefiles. * doc/guile-vm.texi: Documented `compile-file', `compiled-file-name', and `compile-in'. * module/system/base/compile.scm: Cosmetic changes. * module/system/base/language.scm: Likewise. * module/system/il/Makefile.am: Tried (and failed) to compile more things. * module/system/vm/Makefile.am: All source files in here can now be compiled without harming further compilation. * module/system/vm/assemble.scm: Select only specific bindings from `(system vm core)'. (dump-object!): Show a more meaningful error message. * module/system/vm/conv.scm: Select only specific bindings from `(system vm core)'. * module/system/vm/debug.scm: Likewise. * module/system/vm/frame.scm: Changed the header. Use a renamer for `(system vm core)'. * src/guilec.in: Added options, via `getopt-long'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-6 2008-04-25 Ludovic Courtes Fixed a Scheme translation bug; cleaned compilation with GCC 4. * module/language/scheme/translate.scm (trans-pair): In the `set!' case, when a procedure-with-setter is passed, call `trans:pair' with an actual pair. This fixes a long-lasting bug which prevented compilation of `set!' statements with procedures-with-setter (this showed up when compiling `(system vm assemble)'). * module/system/base/compile.scm: Added `objcode->u8vector' to the `#:select' clause. * module/system/base/syntax.scm: Cosmetic changes. * module/system/vm/assemble.scm (preprocess): Removed debugging statements. * src/frames.c: Cosmetic changes. * src/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): New. * src/objcodes.c: Use `scm_t_uint8' instead of `char' when relevant. * src/vm.c (vm_heapify_frames_1): Use `SCM_FRAME_SET_DYNAMIC_LINK ()'. * src/vm_loader.c: Added casts to mute GCC 4 warnings. * testsuite/run-vm-tests.scm (*scheme*): Renamed to `%scheme'. (run-test-from-file): Renamed to `compile/run-test-from-file'. (run-vm-tests): Run each test using both the VM and the interpreter; compare the results. * testsuite/t-proc-with-setter.scm: Try out `get/set'. * doc/Makefile.am (info_TEXINFOS): New. * doc/guile-vm.texi: Added index entries and indices. * doc/texinfo.tex: New file. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-5 2008-04-25 Ludovic Court`es Minor binding name clash tweak. * module/system/base/compile.scm: Only import `the-vm' and `vm-load' from `(system vm core)'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-10 2008-04-25 Ludovic Courtes Started documenting the compiler. * doc/guile-vm.texi: Documented the compiler (node `The Compiler'). Removed a number of things that might have been relevant to Guile-VM 0.0. * module/system/il/compile.scm (optimize): Commented out the case using `'. * src/vm_engine.c (vm_run)[objects_handle]: New variable. Before leaving the function, release OBJECTS_HANDLE. * src/vm_engine.h (CACHE_PROGRAM): Use `scm_vector_writable_elements' instead of `scm_vector_elements'; don't release the handle right away. * src/vm_loader.c (load-program): New commented out piece of code dealing with simple vectors. * src/vm_system.c (object-ref): Added the type of OBJNUM. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-3 2008-04-25 Ludovic Courtes * src/objcodes.c (make_objcode_by_mmap): Fixed the error type when the object file is too small. * doc/guile-vm.texi: Documented `make-closure'. Improved the documentation of `load-program'. * testsuite: New directory. * configure.in: Added `testsuite/Makefile' to `AC_OUTPUT'. * Makefile.am (SUBDIRS): Added `testsuite'. * src/vm_engine.h (VM_CHECK_OBJECT): New option. (CHECK_OBJECT): New macro. * src/vm_system.c (object-ref): Use VM_CHECK_OBJECT. * module/system/vm/assemble.scm (preprocess): Commented out the debugging code. * benchmark/lib.scm (do-loop): New procedure. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-2 2008-04-25 Ludovic Courtes Removed a few more deprecated function calls; documented closures. * src/Makefile.am (.c.x): Fixed the rule. * src/envs.c: Use `scm_hash_get_handle ()' instead of `scm_sym2ovcell_soft ()' and `scm_hash_create_handle_x ()' instead of `scm_intern_symbol ()'. * src/objcodes.c (bytecode->objcode): Don't use `SCM_VALIDATE_INUM', use `SCM_VALIDATE_NUMBER' instead. (make_objcode_by_mmap): Check whether the file is smaller than the magic cookies; check whether the magic cookies are there. * src/frames.c (frame-local-ref): Likewise, but use `SCM_MAKE_VALIDATE'. (frame-local-set!): Likewise. * src/instructions.c (opcode->instruction): Likewise. * src/programs.c (program-external-set!): New function. * src/guile-disasm.in: New file. * src/Makefile.am: Produce `guile-disasm'. * doc/guile-vm.texi: Documented `external-ref', `external-set', `local-ref' and `local-set'. * module/system/vm/disasm.scm (disassemble-bytecode): Fixed the way `load-program' is represented. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-1 2008-04-25 Ludovic Court`es Playing with the procedure call mechanism. * src/objcodes.c (do-pair): New experiment. * src/vm_engine.h (ALIGN_AS_NON_IMMEDIATE): New macro. (POP_LIST_ON_STACK): New experimental macro. * src/vm_engine.c (call): In the procedure call case, I tried using the above macro. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-8 2008-04-25 Ludovic Court`es Fixed a stack leak. Now observing actual performance. * src/*.[ch]: Replaced `scm_mem2symbol' by `scm_from_locale_symboln' and `scm_ulong2num' by `scm_from_ulong'. * src/vm_system.c (tail-call): Fixed stack leak (SP lacked decrement by one more Scheme object in the tail-recursive case). * benchmark/measure.scm (measure): Make sure we are using the compiled procedure (i.e. a program object) when measuring. This yields better results than before. :-) * doc/guile-vm.texi: Augmented the instruction set documentation with branch instructions, `call' and `tail-call'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-7 2008-04-25 Ludovic Court`es Improved the VM's efficiency. The VM is as fast as the interpreter. :-( * benchmark/lib.scm: New file. * benchmark/measure.scm: New file. * README: Added useful pointers to various threads. * doc/guile-vm.texi: Fixed the description of `load-program' (it now expects _immediate_ integers). * src/*.[ch]: Use immediate integers whereever possible, as in the original code. For `CONS', use `scm_cell' rather than `scm_cons'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-6 2008-04-25 Ludovic Court`es Got the VM up and running! Augmented the documentation. * src/*.[ch]: Replaced the remaining `SCM_MAKINUM', and changed `SCM_VELTS' into `scm_vector_elements ()'. * src/vm_loader.c (link): Fixed so that it pushed a variable object on the stack. * src/vm_system.c (variable-ref): Fixed so that it uses `scm_variable_ref ()' and friends. * module/system/vm/assemble.scm (dump-object!): Fixed the string case. * src/vm_engine.h (CONS): Use `scm_cons' instead of `SCM_NEWCELL'. * doc/guile-vm.texi: Added actual instruction definitions, explanations of the program invocation mechanism, programs' object tables, etc., in the `Instruction Set' chapter. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-5 2008-04-25 Ludovic Court`es Fixed the compiler, got the disassembler working. * doc/guile-vm.texi: Texified and cleaned up. * src/vm.c: Use `scm_from_locale_string ()' instead of `scm_makfrom0str ()'. * src/vm_engine.c: Likewise. * src/programs.c (scm_program_bytecode): Return a u8vector instead of a string. * module/system/vm/conv.scm (make-byte-decoder): Fixed a few things wrt. to the string to u8vector transition. * src/objcodes.c (bytecode->objcode): Fixed a bug where the last 10 bytes of the bytecode where ignored. * module/system/vm/assemble.scm (dump-object!): Don't convert everything to a u8vector, keep strings where it makes sense. * module/system/vm/conv.scm (code->bytes): Accordingly, convert strings to u8vectors when needed. (make-byte-decoder): Accordingly too, when decoding instructions, return variable-length instructions' argument as strings except for `load-program'. * module/system/vm/disasm.scm: Export `disassemble-bytecode'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-4 2008-04-25 Ludovic Court`es Updated the assembly process so that `u8vectors' are used. Compilation works. * module/system/vm/conv.scm (encode-length): Use u8vectors. (code->bytes): Likewise. * module/system/vm/assemble.scm (codegen): Use u8vectors instead of strings. * src/objcodes.c (objcode->string): Removed. (objcode->u8vector): New function. * module/system/base/compile.scm (compile-file): Use `objcode->u8vector' and `uniform-vector-write'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-3 2008-04-25 Ludovic Court`es Translation from Scheme to GHIL, and compilation to GLIL work. * src/*.c: Removed calls to `scm_must_malloc', `SCM_MUST_MALLOC' and `scm_must_free'. Same for `SCM_INUMP', `SCM_INUM', `SCM_STRING_CHARS', and the likes. * module/system/base/syntax.scm: Do not import `(ice-9 match)' and do not re-export `match', do not export `syntax-error' which was not defined here. * module/system/base/compile.scm (call-with-compile-error-catch): Use the `catch' form instead of `try'. * src/instructions.c: Use `scm_from_char ()' instead of the deprecated macro `SCM_MAKINUM ()'. * src/instructions.h (scm_instruction): Made `npop' a signed char. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-2 2008-04-25 Ludovic Court`es Updated the C code base so that it compiles with Guile 1.7.2. * src/*.[ch]: Introduced changes so that it compiles with Guile 1.7.2. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-1 2001-05-02 Keisuke Nishida *** empty log message *** 2001-04-25 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-23 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-22 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-20 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-19 Keisuke Nishida *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-16 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-15 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-14 Keisuke Nishida SLIB init file for Guile. Import SLIB 2d1. 2001-04-13 Keisuke Nishida *** empty log message *** 2001-04-12 Keisuke Nishida *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-11 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-10 Keisuke Nishida *** empty log message *** *** empty log message *** 2001-04-09 Keisuke Nishida *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-08 Keisuke Nishida *** empty log message *** apply *** empty log message *** 2001-04-07 Keisuke Nishida *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-06 Keisuke Nishida *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-05 Keisuke Nishida *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-04 Keisuke Nishida Quick documentation. Don't use module.scm. *** empty log message *** Better current module system support. Don't load modules explicitly at initialization. Current module support hack. Current module support hack. 2001-04-03 Keisuke Nishida *** empty log message *** 2001-04-01 Keisuke Nishida New files. *** empty log message *** New VM. *** empty log message *** 2000-10-06 Keisuke Nishida *** empty log message *** Use `values\' and `call-with-values\'. 2000-09-29 Keisuke Nishida *** empty log message *** Create *.i from *.c and include them. 2000-09-28 Keisuke Nishida *** empty log message *** Indirect threaded. Performance is the same as before. Wow\! 2000-09-22 Keisuke Nishida ChangeLog * src/vm.c: SCM_CHARS -> SCM_SYMBOL_CHARS. *** empty log message *** * src/vm_system.c (call): Call return-hook before reinstating a continuation. (tail_call): Call return-hook before a proper tail call. 2000-09-20 Keisuke Nishida *** empty log message *** * src/vm_system.c (br_if_not_null): Set ac = SCM_BOOL_F if not null. *** empty log message *** * src/vm_number.c (FUNC2): New macro. (add2, sub2): Use FUNC2. (remainder): New instruction. * vm/bytecomp.scm (translate-ref): Combined translate-local-ref, translate-external-ref, and translate-top-level-ref. (translate-set): Combined translate-local-set, translate-external-set, and translate-top-level-ref. Set a name to the object. (translate-and, translate-or): Bug fixed. * vm/shell.scm (vm-frame->call): Updated. * src/vm_system.c (name): New instruction. (savet): Don't set name. * src/vm.c (scm_name_property): New variable. (scm_name, scm_set_name_x): New procedures. (scm_smob_print_with_name, init_name_property): New functions. (print_program, scm_program_name): Removed. (init_program_type, init_vm_type): Use scm_smob_print_with_name. (scm_init_vm): Call init_name_property. *** empty log message *** * src/vm_scheme.c (cons): Bug fixed. * src/vm_system.c (br_if_null): Set ac = SCM_BOOL_T if null. 2000-09-11 Keisuke Nishida *** empty log message *** * autogen.sh: Run aclocal with check where guile.m4 is installed. *** empty log message *** * src/vm_system.c (push_list): New instruction. * src/vm_engine.c (VM_NAME): Don\'t validate VM and PROGRAM. * src/vm.c (scm_vm_apply): New procedure. (apply_program): New function. (init_program_type): Set the apply function for the program type. * src/vm.c (lookup_variable): Use scm_eval_closure_lookup. 2000-09-04 Keisuke Nishida *** empty log message *** * src/vm_system.c (tail_call): Use SCM_TICK at the beginning. 2000-09-02 Keisuke Nishida *** empty log message *** * src/vm_engine.c (VM_NAME): Renamed the variable `an\' to `nargs\'. Removed the variables `a2\' and `a3\'. * src/vm_engine.h (VM_SETUP_ARGS2, VM_SETUP_ARGS3): Setup local variables. (VM_SETUP_ARGS4): Removed. * src/vm_system.c, src/vm_scheme.c, src/vm_number.c: Updated. 2000-08-25 Keisuke Nishida *** empty log message *** * src/vm.c (lookup_variable): New function. (scm_make_bytecode): Call lookup_variable for top-level variables. * src/vm_engine.h (VM_VARIABLE_REF, VM_VARIABLE_SET): New macros. * src/vm_system.c (TOPLEVEL_VAR, TOPLEVEL_VAR_SET): Removed. Use VM_VARIABLE_REF and VM_VARIABLE_SET instead. 2000-08-22 Keisuke Nishida *** empty log message *** Use frame-external-link. Create external frames dynamically. (compile-file): Output "(use-modules (vm vm))". (make-code): Check argument types. (make-code:and, make-code:or): Pass env to make-code. (translate-and, translate-or): Don't branch on the last expression. types.scm (env-variable-address): Reverted the last change. Add guile-compile. Initial import. Initial revision