Ludovic Courtès [Tue, 27 Sep 2011 11:46:35 +0000 (13:46 +0200)]
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.
Ludovic Courtès [Tue, 27 Sep 2011 11:41:21 +0000 (13:41 +0200)]
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.
Andy Wingo [Mon, 26 Sep 2011 22:21:16 +0000 (00:21 +0200)]
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.
Andy Wingo [Mon, 26 Sep 2011 20:32:45 +0000 (22:32 +0200)]
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.
Andy Wingo [Mon, 26 Sep 2011 20:24:00 +0000 (22:24 +0200)]
remove unused peval helpers
* module/language/tree-il/optimize.scm (peval): Remove a couple unused
helpers.
Andy Wingo [Fri, 23 Sep 2011 10:43:04 +0000 (12:43 +0200)]
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.
Andy Wingo [Sun, 25 Sep 2011 00:54:34 +0000 (02:54 +0200)]
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.
Andy Wingo [Thu, 22 Sep 2011 22:29:14 +0000 (00:29 +0200)]
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 <counter> 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 <lexical-ref> 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 <lambda> applications to <let>, 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.
Andy Wingo [Thu, 22 Sep 2011 22:21:46 +0000 (00:21 +0200)]
prune unused letrec bindings
* module/language/tree-il/optimize.scm (peval): Prune unused `letrec'
bindings.
Andy Wingo [Thu, 22 Sep 2011 22:18:13 +0000 (00:18 +0200)]
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.
Andy Wingo [Thu, 22 Sep 2011 22:12:21 +0000 (00:12 +0200)]
add helpers for effort counters
* module/language/tree-il/optimize.scm (<counter>, 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.
Andy Wingo [Thu, 22 Sep 2011 22:05:27 +0000 (00:05 +0200)]
peval refactor
* module/language/tree-il/optimize.scm (peval): Add for-value, for-test,
for-effect, and for-tail helpers. Use them.
Andy Wingo [Thu, 22 Sep 2011 13:56:22 +0000 (15:56 +0200)]
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.
Andy Wingo [Thu, 22 Sep 2011 11:16:36 +0000 (13:16 +0200)]
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.
Andy Wingo [Wed, 21 Sep 2011 21:59:02 +0000 (23:59 +0200)]
peval: pre-analyze mutated or reffed-once lexicals
* module/language/tree-il/optimize.scm (<var>, 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).
Andy Wingo [Sat, 24 Sep 2011 16:57:59 +0000 (18:57 +0200)]
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 <toplevel-ref> is not constant, because it can
be mutated. A <dynref> 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.
Andy Wingo [Thu, 22 Sep 2011 10:06:21 +0000 (12:06 +0200)]
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 <const>. Fold pure
expressions to <void> in "effect" contexts. Adapt the <conditional>
and <sequence> tests to simply look for <const> or <void> expressions,
respectively.
Andy Wingo [Thu, 22 Sep 2011 09:23:06 +0000 (11:23 +0200)]
thread a context through peval
* module/language/tree-il/optimize.scm (peval): Thread a "context"
through the evaluator.
Andy Wingo [Sat, 24 Sep 2011 15:05:30 +0000 (17:05 +0200)]
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.
Andy Wingo [Sat, 24 Sep 2011 15:15:32 +0000 (17:15 +0200)]
peval: various bugfixes
* module/language/tree-il/optimize.scm (alpha-rename): Rename the
init
expressions of a <lambda-case>.
(peval): Coalesce the <let-values> clauses.
Fix pure-expression? matching of <lambda> clauses.
Loop over and maybe-unconst the inits of a <lambda-case>.
Andy Wingo [Thu, 22 Sep 2011 12:14:02 +0000 (14:14 +0200)]
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.
Andy Wingo [Thu, 22 Sep 2011 10:26:02 +0000 (12:26 +0200)]
minor peval style tweak
* module/language/tree-il/optimize.scm (peval): Minor refactor to
<lexical-ref> copy propagation.
Andy Wingo [Thu, 22 Sep 2011 15:43:36 +0000 (17:43 +0200)]
fix alpha-rename for kwargs
* module/language/tree-il/optimize.scm (alpha-rename): Fix
alpha-renaming of keyword arguments.
Ludovic Courtès [Wed, 21 Sep 2011 20:56:45 +0000 (22:56 +0200)]
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'.
Ludovic Courtès [Wed, 21 Sep 2011 13:17:56 +0000 (15:17 +0200)]
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*'.
Andy Wingo [Fri, 23 Sep 2011 16:02:05 +0000 (18:02 +0200)]
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.
Andy Wingo [Wed, 21 Sep 2011 06:50:45 +0000 (08:50 +0200)]
peval comment & reindentation
* module/language/tree-il/optimize.scm (peval): Add a comment regarding
failure modes, and reindent one clause.
Andy Wingo [Wed, 21 Sep 2011 06:49:36 +0000 (08:49 +0200)]
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.
Andy Wingo [Wed, 21 Sep 2011 06:46:44 +0000 (08:46 +0200)]
better pure-expression?
* module/language/tree-il/optimize.scm (peval): Allow dynref, fix, and
let-values to be pure expressions.
Andy Wingo [Wed, 21 Sep 2011 06:46:03 +0000 (08:46 +0200)]
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.
Andy Wingo [Wed, 21 Sep 2011 06:44:19 +0000 (08:44 +0200)]
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}#.
Andy Wingo [Wed, 21 Sep 2011 06:58:09 +0000 (08:58 +0200)]
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.
Andy Wingo [Wed, 21 Sep 2011 06:56:09 +0000 (08:56 +0200)]
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.)
Andy Wingo [Wed, 21 Sep 2011 06:53:06 +0000 (08:53 +0200)]
add singly-valued-primitive?
* module/language/tree-il/primitives.scm (singly-valued-primitive?): New
predicate, for primitives that return exactly one value.
Andy Wingo [Tue, 20 Sep 2011 00:59:53 +0000 (20:59 -0400)]
more optimize.scm factoring
* module/language/tree-il/optimize.scm (vlist-any): New helper.
(peval): Use it here.
Andy Wingo [Tue, 20 Sep 2011 00:49:50 +0000 (20:49 -0400)]
optimize.scm refactor
* module/language/tree-il/optimize.scm (let/ec, tree-il-any): New
helpers.
(code-contains-calls?): Use them here.
Daniel Llorens [Mon, 5 Sep 2011 09:09:08 +0000 (11:09 +0200)]
Fix compilation of untyped arrays of rank not 1
* module/language/glil/compile-assembly.scm: vector-fold2 expects vector.
Julian Graham [Sun, 18 Sep 2011 20:58:47 +0000 (16:58 -0400)]
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.
Ludovic Courtès [Sun, 18 Sep 2011 21:01:51 +0000 (23:01 +0200)]
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 <http://debbugs.gnu.org/9542>.
* test-suite/tests/tree-il.test ("partial evaluation"): Update 2 tests
that relied on the previous behavior. Add 1 another test.
Ludovic Courtès [Sun, 18 Sep 2011 20:34:40 +0000 (22:34 +0200)]
peval: Improve alpha-renaming test.
* test-suite/tests/tree-il.test ("partial evaluation")["inlined lambdas
are alpha-renamed"]: Rewrite.
Ludovic Courtès [Sun, 18 Sep 2011 19:41:25 +0000 (21:41 +0200)]
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.
Ludovic Courtès [Sat, 17 Sep 2011 14:53:23 +0000 (16:53 +0200)]
peval: Typo.
* module/language/tree-il/optimize.scm (peval)[maybe-unlambda]: Fix
typo in comment.
Ludovic Courtès [Sat, 17 Sep 2011 14:49:41 +0000 (16:49 +0200)]
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 <https://lists.gnu.org/archive/html/bug-guile/2011-09/msg00019.html>.
Ludovic Courtès [Tue, 13 Sep 2011 21:34:07 +0000 (23:34 +0200)]
peval: Use `resolve-primitives!'.
* module/language/tree-il/optimize.scm (peval): Add `cenv' optional
argument; caller updated.
Use `resolve-primitives!' to resolve <primitive-ref> expressions.
Ludovic Courtès [Tue, 13 Sep 2011 21:30:22 +0000 (23:30 +0200)]
peval: Clarify `pure-expression?'.
* module/language/tree-il/optimize.scm (peval)[pure-expression?]:
Clarify the comment.
Ludovic Courtès [Tue, 13 Sep 2011 16:54:01 +0000 (18:54 +0200)]
peval: Inline thunks.
* module/language/tree-il/optimize.scm (peval): Inline thunks.
* test-suite/tests/tree-il.test ("partial evaluation"): Add test.
Ludovic Courtès [Tue, 13 Sep 2011 16:25:09 +0000 (18:25 +0200)]
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 <https://lists.gnu.org/archive/html/bug-guile/2011-09/msg00019.html>.
* test-suite/tests/tree-il.test ("partial evaluation"): Add tests to
reproduce the bug.
Ludovic Courtès [Tue, 13 Sep 2011 12:31:18 +0000 (14:31 +0200)]
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.
Ludovic Courtès [Sat, 10 Sep 2011 22:41:23 +0000 (00:41 +0200)]
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.
Ludovic Courtès [Sat, 10 Sep 2011 22:00:39 +0000 (00:00 +0200)]
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 <let>, <letrec>, <toplevel-define>, and <lambda-case>.
* test-suite/tests/tree-il.test ("partial evaluation"): Add tests
for mutability preservation.
Ludovic Courtès [Sat, 10 Sep 2011 13:31:55 +0000 (15:31 +0200)]
doc: Fix typo regarding vhashes.
* doc/ref/api-compound.texi (VHashes): s/vlist-/alist-/.
Andy Wingo [Sat, 10 Sep 2011 18:38:25 +0000 (11:38 -0700)]
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.
Ian Price [Fri, 9 Sep 2011 19:02:34 +0000 (20:02 +0100)]
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.
Ian Price [Sat, 10 Sep 2011 02:02:32 +0000 (03:02 +0100)]
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.
Ludovic Courtès [Fri, 9 Sep 2011 07:06:30 +0000 (09:06 +0200)]
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'.
Ludovic Courtès [Thu, 8 Sep 2011 22:41:48 +0000 (00:41 +0200)]
Remove unused macro in `tree-il.test'.
* test-suite/tests/tree-il.test (assert-scheme->glil): Remove.
Ludovic Courtès [Thu, 8 Sep 2011 22:02:47 +0000 (00:02 +0200)]
doc: Use fashionable terminology for macros.
* doc/ref/api-macros.texi (Macros): Mention EDSLs.
Ludovic Courtès [Thu, 8 Sep 2011 22:02:17 +0000 (00:02 +0200)]
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.
Ludovic Courtès [Thu, 8 Sep 2011 21:53:31 +0000 (23:53 +0200)]
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.
Ludovic Courtès [Thu, 8 Sep 2011 22:05:34 +0000 (00:05 +0200)]
Add a partial evaluator for use in the compiler.
Thanks to William R. Cook for his excellent tutorial,
<http://softlang.uni-koblenz.de/dsl11/>.
* 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.
Ludovic Courtès [Mon, 5 Sep 2011 22:18:36 +0000 (00:18 +0200)]
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.
Ludovic Courtès [Sat, 3 Sep 2011 20:53:36 +0000 (22:53 +0200)]
Fix misdiagnoses of deprecated `+nan.[^0]' forms.
* libguile/numbers.c (mem2ureal): Check the result of `mem2uinteger'
against `SCM_INUM0', not 0.
(mem2uinteger): Add comment.
Ludovic Courtès [Sat, 3 Sep 2011 20:16:54 +0000 (22:16 +0200)]
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'.
Ludovic Courtès [Sat, 3 Sep 2011 19:39:51 +0000 (21:39 +0200)]
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.
Ludovic Courtès [Sat, 3 Sep 2011 19:36:49 +0000 (21:36 +0200)]
Remove Front-Cover and Back-Cover text from the manual.
* doc/ref/guile.texi: Remove Front-Cover and Back-Cover text.
Andy Wingo [Sat, 3 Sep 2011 16:37:51 +0000 (18:37 +0200)]
deprecate +nan.1
* libguile/numbers.c (mem2ureal): Deprecate nan values that are not
"+nan.0".
Andy Wingo [Fri, 2 Sep 2011 17:49:26 +0000 (19:49 +0200)]
fix srfi-67 compilation
* module/srfi/srfi-67/compare.scm: Fix define-syntax-rule conversion.
Andy Wingo [Fri, 2 Sep 2011 11:17:19 +0000 (13:17 +0200)]
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!.
Andy Wingo [Fri, 2 Sep 2011 09:42:44 +0000 (11:42 +0200)]
document define-syntax-rule
* doc/ref/api-macros.texi (Syntax Rules): Add define-syntax-rule.
Andy Wingo [Fri, 2 Sep 2011 09:36:14 +0000 (11:36 +0200)]
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.
Andy Wingo [Fri, 2 Sep 2011 09:34:00 +0000 (11:34 +0200)]
psyntax uses define-syntax-rule
* module/ice-9/psyntax.scm: Use define-syntax-rule.
* module/ice-9/psyntax-pp.scm: Regenerate.
Andy Wingo [Fri, 2 Sep 2011 09:28:11 +0000 (11:28 +0200)]
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.
Andy Wingo [Mon, 29 Aug 2011 20:20:39 +0000 (22:20 +0200)]
fix scm_gc_strdup invocation
* libguile/i18n.c (get_current_locale): Fix scm_gc_strdup invocation.
Andy Wingo [Mon, 29 Aug 2011 20:20:19 +0000 (22:20 +0200)]
texinfo: add paragraphindent
* module/texinfo.scm (texi-command-specs): Add paragraphindent.
Andy Wingo [Tue, 23 Aug 2011 16:00:02 +0000 (18:00 +0200)]
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.
Andy Wingo [Tue, 23 Aug 2011 10:47:51 +0000 (12:47 +0200)]
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.
Andy Wingo [Fri, 19 Aug 2011 10:04:46 +0000 (12:04 +0200)]
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.
Andy Wingo [Thu, 18 Aug 2011 10:56:14 +0000 (12:56 +0200)]
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!
Andy Wingo [Thu, 18 Aug 2011 09:54:20 +0000 (11:54 +0200)]
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.
Andy Wingo [Thu, 18 Aug 2011 09:13:34 +0000 (11:13 +0200)]
reword open-file docs
* doc/ref/api-io.texi (File Ports): Refactor open-file docs. Thanks to
Bake Timmons for the report.
Andy Wingo [Wed, 17 Aug 2011 21:54:58 +0000 (23:54 +0200)]
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.
Andy Wingo [Wed, 17 Aug 2011 21:24:20 +0000 (23:24 +0200)]
fix r6rs `map'
* module/rnrs/base.scm (map): Define a version of map that is safe for
multiple returns, though slower.
Andy Wingo [Wed, 17 Aug 2011 21:09:39 +0000 (23:09 +0200)]
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.
Andy Wingo [Wed, 17 Aug 2011 20:35:24 +0000 (22:35 +0200)]
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.
Andy Wingo [Wed, 17 Aug 2011 08:47:04 +0000 (10:47 +0200)]
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.
Andy Wingo [Tue, 16 Aug 2011 11:16:21 +0000 (13:16 +0200)]
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.
Andy Wingo [Fri, 12 Aug 2011 21:26:15 +0000 (23:26 +0200)]
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.
Andy Wingo [Thu, 4 Aug 2011 17:23:49 +0000 (19:23 +0200)]
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.
Andy Wingo [Thu, 4 Aug 2011 13:07:27 +0000 (15:07 +0200)]
(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.
Andy Wingo [Thu, 4 Aug 2011 10:53:07 +0000 (12:53 +0200)]
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.
Andy Wingo [Wed, 3 Aug 2011 10:36:55 +0000 (12:36 +0200)]
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.
Andy Wingo [Wed, 3 Aug 2011 09:46:56 +0000 (11:46 +0200)]
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.
Andy Wingo [Fri, 29 Jul 2011 07:17:47 +0000 (09:17 +0200)]
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.
Andy Wingo [Fri, 29 Jul 2011 07:14:04 +0000 (09:14 +0200)]
style fix in read.c
* libguile/read.c (scm_read_sexp): No need to assign to tmp here.
Andy Wingo [Fri, 29 Jul 2011 07:11:24 +0000 (09:11 +0200)]
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.
Andy Wingo [Thu, 28 Jul 2011 17:12:07 +0000 (19:12 +0200)]
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.
Andy Wingo [Thu, 28 Jul 2011 17:07:53 +0000 (19:07 +0200)]
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.
Andy Wingo [Thu, 28 Jul 2011 17:04:38 +0000 (19:04 +0200)]
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.
Andy Wingo [Thu, 28 Jul 2011 16:17:45 +0000 (18:17 +0200)]
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.
Andy Wingo [Thu, 28 Jul 2011 15:59:56 +0000 (17:59 +0200)]
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.