summaryrefslogtreecommitdiff
path: root/module/language/tree-il.scm
AgeCommit message (Collapse)AuthorFilesLines
2023-06-19Use tree-il-srcv instead of tree-il-srcAndy Wingo1-1/+2
This prevents eager conversion to alists.
2022-02-07psyntax: Pass source vectors to tree-il constructors.Ludovic Courtès1-3/+16
Avoiding systematic conversion from source vectors to property alists saves 20% on the final heap size of a process doing: (compile-file FILE #:optimization-level 1) where FILE is large. * module/language/tree-il.scm (tree-il-src/ensure-alist): New procedure with setter. Export as 'tree-il-src'. * module/ice-9/psyntax.scm (build-void, build-call) (build-conditional, build-lexical-reference, build-lexical-assignment) (build-global-reference, build-global-assignment) (build-global-definition, build-simple-lambda, build-case-lambda) (build-lambda-case, build-primcall, build-primref) (build-data, build-sequence, build-let, build-named-let) (build-letrec, expand-body): Remove (sourcev->alist src) calls. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): Use 'tree-il-src' instead of accessing the 'src' slot directly. * module/system/vm/assembler.scm (link-debug): Adjust so PC can be followed by a vector or an alist.
2020-05-13Add with-lexicals helper; fix bug in (equal? #t (foo) #t)Andy Wingo1-1/+16
* module/language/tree-il.scm (with-lexicals): New public helper. * .dir-locals.el (with-lexicals): Add indentation rule. * module/language/tree-il/compile-bytecode.scm (canonicalize): Use with-lexicals. * module/language/tree-il/compile-cps.scm (canonicalize): Use with-lexicals from tree-il. * module/language/tree-il/primitives.scm (chained-comparison-expander): Remove duplicate expander definitions for <, <=, and so on. * module/language/tree-il/primitives.scm (maybe-simplify-to-eq): Avoid inadvertent code duplication by using with-lexicals. (expand-chained-comparisons): Likewise. (call-with-prompt): Simplify to use with-lexicals.
2019-08-18Add "mod" field to tree-il toplevel ref, set, defineAndy Wingo1-19/+19
Add "mod" field to <toplevel-ref>, <toplevel-set>, and <toplevel-define>, indicating the expander's idea of what the current module is when a toplevel variable is accessed or created. This will help in later optimizations. * libguile/expand.c (TOPLEVEL_REF, TOPLEVEL_SET, TOPLEVEL_DEFINE) (expand, expand_define, expand_set_x, convert_assignment): * libguile/expand.h (SCM_EXPANDED_TOPLEVEL_REF_FIELD_NAMES): (SCM_MAKE_EXPANDED_TOPLEVEL_REF, SCM_EXPANDED_TOPLEVEL_SET_FIELD_NAMES): (SCM_MAKE_EXPANDED_TOPLEVEL_SET, SCM_EXPANDED_TOPLEVEL_DEFINE_FIELD_NAMES): (SCM_MAKE_EXPANDED_TOPLEVEL_DEFINE): * module/ice-9/compile-psyntax.scm (translate-literal-syntax-objects): * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: * module/language/tree-il.scm: * module/language/tree-il.scm (parse-tree-il, make-tree-il-folder): (pre-post-order): * module/language/tree-il/analyze.scm (goops-toplevel-definition): (macro-use-before-definition-analysis, proc-ref?, format-analysis): * module/language/tree-il/compile-cps.scm (convert): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/fix-letrec.scm (free-variables): * module/language/tree-il/peval.scm (peval): * test-suite/tests/tree-il.test: Adapt uses.
2018-01-22Use make-struct/simple in tree-ilAndy Wingo1-2/+2
* module/language/tree-il.scm (borrow-core-vtables): Use make-struct/simple.
2017-12-27Refactor list->seq to make return arity apparentAndy Wingo1-3/+6
* module/language/tree-il.scm (list->seq): Change to let tail of seq indicate number of values.
2017-09-20Use make-struct/no-tail instead of make-structAndy Wingo1-2/+2
* 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.
2014-03-31Less copying in tree-il pre-order / post-order.Andy Wingo1-67/+138
* 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.
2013-07-06<prompt> body and handler are lambdas; add escape-only? fieldAndy Wingo1-9/+12
* module/language/tree-il.scm (<prompt>): 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 <prompt> change.
2013-06-28Remove with-fluids; replaced by with-fluid* and inlined push-fluid primopsAndy Wingo1-16/+0
* 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 <dynlet>. 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-27replace <dynset> with primcalls to fluid-set!Andy Wingo1-14/+0
* doc/ref/compiler.texi (Tree-IL): Remove mention of <dynset>. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynset. * module/language/tree-il.scm (<tree-il>, parse-tree-il): (unparse-tree-il, make-tree-il-folder, pre-post-order): Remove <dynset>. * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add fluid-set!. (flatten-lambda-case): Remove <dynset> case. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): Remove <dynset> cases. * module/language/tree-il/effects.scm (make-effects-analyzer): Remove <dynset> 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-27replace <dynref> with primcalls to fluid-refAndy Wingo1-13/+0
* doc/ref/compiler.texi (Tree-IL): Remove mention of <dynref>. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): Remove dynref. * module/language/tree-il.scm (<tree-il>, parse-tree-il): (unparse-tree-il, make-tree-il-folder, pre-post-order): Remove <dynref>. * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add fluid-ref. (flatten-lambda-case): Remove <dynref> case. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): Remove <dynref> cases. * module/language/tree-il/effects.scm (make-effects-analyzer): Remove <dynref> 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-27dynamic-wind in terms of wind and unwind; remove <dynwind>, @dynamic-windAndy Wingo1-17/+0
* doc/ref/compiler.texi: Remove mention of <dynwind>. * 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 <dynwind>. 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 <dywind> 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-16<dynwind> no longer has "pre" or "post" fieldsAndy Wingo1-17/+12
* module/language/tree-il.scm (<tree-il>): Remove pre and post fields from <dynwind>. A dynwind now assumes that in normal entry and exit, that the code runs the winders and unwinders using <seq> and <let-values> and such things. (parse-tree-il, unparse-tree-il, make-tree-il-folder, pre-post-order): Adapt <dynwind> 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-10Rewrite make-tree-il-folder to use the Wright matcher.Andy Wingo1-22/+23
* module/language/tree-il.scm (make-tree-il-folder): Rewrite to use the Wright matcher instead of record-case.
2013-06-10Rewrite unparse-tree-il to use the Wright matcher.Andy Wingo1-29/+33
* module/language/tree-il.scm (unparse-tree-il): Rewrite to use the Wright matcher.
2013-06-10Rewrite parse-tree-il to use the Wright matcher.Andy Wingo1-36/+35
* module/language/tree-il.scm (parse-tree-il): Rewrite to use match instead of pmatch. Remove pmatch import.
2013-06-10Implement tree-il-fold in terms of make-tree-il-folder.Andy Wingo1-81/+13
* 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 (<tree-analysis>, 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-10Rewrite tree-il pre-post-order in terms of (ice-9 match)Andy Wingo1-27/+28
* 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-10Pre-order tree-il rewrites are now non-destructiveAndy Wingo1-89/+3
* 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-10Tree-il post-order rewriter no longer destructiveAndy Wingo1-79/+76
* 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-03-28Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-6/+16
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-09allow case-lambda expressions with no clausesAndy Wingo1-6/+16
* 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.
2012-05-21Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+68
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
2012-05-15mvoe tree-il=? and tree-il-hash to tree-il.scmAndy Wingo1-1/+68
* 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-03-03Merge branch 'stable-2.0'Mark H Weaver1-161/+6
Conflicts: module/ice-9/psyntax-pp.scm module/language/tree-il.scm
2012-03-03tree-il->scheme improvementsMark H Weaver1-150/+5
* 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.
2011-11-09inline dynwind guards for normal control flowAndy Wingo1-18/+30
* 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-3/+3
Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2011-11-09fix <dynwind> serialization.Andy Wingo1-3/+3
* module/language/tree-il.scm (unparse-tree-il): Fix <dynwind> serialization.
2011-09-29Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-79/+77
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-28fix unparse-tree-il of <dynset>Andy Wingo1-1/+1
* module/language/tree-il.scm (unparse-tree-il): Fix printing of `dynset'.
2011-09-02more define-syntax-rule usageAndy Wingo1-75/+73
* 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-08-31Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+1
Conflicts: libguile/bytevectors.c libguile/bytevectors.h libguile/objcodes.c libguile/r6rs-ports.c libguile/strings.c libguile/vm.c
2011-08-04fix tree-il->scheme testAndy Wingo1-1/+1
* 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-06-18fix tree-il->scheme bug for seqAndy Wingo1-1/+2
* module/language/tree-il.scm (tree-il->scheme): Fix bug for `seq'. * module/ice-9/psyntax-pp.scm: Regenerate correctly.
2011-06-02sequence of expressions -> seq of head and tailAndy Wingo1-18/+40
* 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-02add <primcall> to tree-ilAndy Wingo1-0/+21
* 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-02rename <application> to <call>Andy Wingo1-17/+18
* doc/ref/compiler.texi (The Scheme Compiler): Update docs. * libguile/expand.h: * libguile/expand.c: * module/language/tree-il.scm: Rename <application> to <call>. 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-03-27tree-il->scheme fixAndy Wingo1-3/+4
* module/language/tree-il.scm (tree-il->scheme): Fix <prompt> to Scheme serialization.
2010-10-08Improve pretty-printing of tree-il objects.Ludovic Courtès1-1/+1
* module/language/tree-il.scm (print-tree-il): Print the AST with ~S instead of ~A.
2010-07-09Remove trailing whitespaceNo Itisnt1-62/+62
* module/language/tree-il.scm: Remove trailing whitespace
2010-06-17tree-il->scheme renders fix as letrec*Andy Wingo1-2/+4
* 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-17beginnings of letrec* support in the expanderAndy Wingo1-7/+12
* 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-11unparse the tag of a promptAndy Wingo1-1/+1
* module/language/tree-il.scm (unparse-tree-il): Properly unparse the tag of a prompt.
2010-05-20macroexpanded pretty-printerAndy Wingo1-1/+6
* module/language/tree-il.scm (print-tree-il): (borrow-core-vtables, <tree-il>): When tree-il loads, override the printers for macroexpanded structures.
2010-05-20tree-il->scheme for lambda* et alAndy Wingo1-9/+56
* module/language/tree-il.scm (tree-il->scheme): Fix lambda* / case-lambda / case-lambda* transformation.
2010-05-19tree-il on expanded-vtablesAndy Wingo1-18/+60
* module/language/tree-il.scm: In a somewhat daring move, inherit the "core" tree-il constructs from %expanded-vtables.
2010-05-02rename `vars' field in tree-il binding constructs to `gensyms'Andy Wingo1-37/+37
* module/language/tree-il.scm (<tree-il>): Rename `vars' fields of <let>, <letrec>, <fix>, and <lambda-case> to `gensyms'. For clarity, and to match <lexical-ref>. * 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-02-22abort always dispatches to VM bytecode, to detect same-invocation abortsAndy Wingo1-17/+22
* 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 (<tree-il>): Add a "tail" field to <abort>, for the (apply abort ...) case, or (@abort tag args). Should be #<const ()> 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.