summaryrefslogtreecommitdiff
path: root/module/language/tree-il
AgeCommit message (Collapse)AuthorFilesLines
2012-03-05Merge branch 'bt/elisp'BT Templeton2-0/+10
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-03optimize dynamic-wind when we know winders are thunksAndy Wingo1-0/+24
* 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-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-9/+9
2012-03-02tweaks to -Wformat's gettext detectionAndy Wingo1-9/+9
* 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-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo4-32/+47
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" #<unspecified>) (#<unspecified>))) 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" #<unspecified>) (#<unspecified>))) 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" #<unspecified>) (#<unspecified>))) Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2012-03-02peval: inline applications of lambda to rest argsAndy Wingo1-10/+26
* 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-02tree-il: fix `canonicalize!' for promptsAndy Wingo1-5/+5
* 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.
2012-03-02more general treatment of call-with-promptAndy Wingo1-16/+15
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't limit the call-with-prompt to <prompt> transition to lambda expressions. Instead we can lexically bind the handler, and rely on peval to propagate a lambda expression.
2012-02-27Avoid failure when `format-analysis' stumbles upon unbound variables.Ludovic Courtès1-1/+2
* 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-23Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo1-30/+57
Conflicts: module/language/tree-il/analyze.scm
2012-02-20Optimize Equality PrimitivesNoah Lavine2-1/+21
* 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-19Have `-Wformat' recognize `ngettext' calls.Ludovic Courtès1-33/+43
* 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)[<down>](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-19Have `-Wformat' better recognize the `gettext' procedure.Ludovic Courtès1-7/+24
Fixes <http://bugs.gnu.org/10846>. Reported by Bruno Haible <bruno@clisp.org>. * 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-08Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+7
Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
2012-02-03add `nil?' primitiveBT Templeton2-0/+12
* 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-03Augment `-Wformat' analysis with support for `~:h'.Ludovic Courtès1-1/+7
* 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-01-30Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo3-8/+49
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
2012-01-30Merge commit '3d51e57cfb0404db568a6adfde2a346d3fd9907e'Andy Wingo2-5/+6
Conflicts: libguile/foreign.c libguile/hashtab.c module/ice-9/psyntax-pp.scm module/language/tree-il/compile-glil.scm
2012-01-26more readable gensymsAndy Wingo2-11/+11
* 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-26Fix typo in `-Wformat'.Ludovic Courtès1-1/+1
* module/language/tree-il/analyze.scm (format-analysis): Call `warning', not `warn'.
2012-01-26Add warnings for unsupported `simple-format' options.Ludovic Courtès1-3/+44
* module/language/tree-il/analyze.scm (format-analysis)[check-simple-format-args]: New procedure. Use it. Add support for applications of <module-ref>. * 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-25add another case in which to fold (values FOO) to FOO, for some FOOAndy Wingo1-2/+4
* 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.
2012-01-25fix values miscompilation in push context with RAAndy Wingo1-4/+3
* 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-10Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+1
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-10Merge commit 'f78a1ccede02ccad89d6c91a6b297f1f14a30907'Andy Wingo1-1/+2
2012-01-10Merge commit 'cc8afa2b361635953dfba7f10e4193b1f243a50f'Andy Wingo1-2/+2
Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il/peval.scm
2012-01-05Placate a number of `syntax-check' verifications.Ludovic Courtès1-1/+1
- "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files
2011-12-30Fix comment summarizing allocation tableMark H Weaver1-1/+2
* module/language/tree-il/analyze.scm (analyze-lexicals): Fix comment, which describes the compiler's allocation table, to match reality.
2011-12-21peval fix: (cons 1 #nil) is not (list 1)Andy Wingo1-1/+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-21peval minor tweakAndy Wingo1-1/+1
* 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-19Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-66/+73
Conflicts: libguile/feature.c m4/gnulib-cache.m4 module/ice-9/deprecated.scm module/language/tree-il/peval.scm
2011-12-19fix peval to preserve effects when folding (values) formsAndy Wingo1-67/+77
* 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-13Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+44
Conflicts: configure.ac
2011-12-06peval: Truncate multiple values when extending the environment.Ludovic Courtès1-1/+44
Reported by Cédric Cellier <rixed@happyleptic.org>. * 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-11-11Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-0/+22
2011-11-09when leaving a non-tail let, allow bound vals to be collectedAndy Wingo1-0/+22
* 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-09inline dynwind guards for normal control flowAndy Wingo5-67/+69
* module/language/tree-il.scm (<tree-il>): Add `pre' and `post' fields to <dynwind>, 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 <dynwind>, 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-09Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-13/+50
Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2011-11-09simplify primitives.scm for dynwindAndy Wingo1-30/+13
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove a dynwind hack, as we have a good inliner now.
2011-11-09peval: fix dynwind bug.Andy Wingo1-2/+33
* module/language/tree-il/peval.scm (peval): The <dynwind> 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 <dynwind> tests.
2011-11-09peval: don't copy assigned lexical bindingsAndy Wingo1-11/+17
* 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-04peval doesn't resolve primitivesAndy Wingo1-6/+1
* 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-04resolve-primitives! does not primitivize local definitionsAndy Wingo1-2/+15
* 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.
2011-10-28add string-length, string-ref, vector-length instructionsAndy Wingo1-0/+3
* 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-28add vector-length primitiveAndy Wingo1-2/+2
* module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Recognize vector-length as an effect-free primitive.
2011-10-28simplify primitives.scmAndy Wingo1-30/+13
* 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-27fix the peval merge and a testAndy Wingo1-3/+4
* 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-27Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo3-35/+43
Conflicts: GUILE-VERSION libguile/deprecated.c libguile/gc-malloc.c module/language/tree-il/peval.scm
2011-10-20fix misallocation of some <fix> proceduresAndy Wingo1-1/+1
* 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-10fold constants with accessorsAndy Wingo1-30/+36
* 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.