guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: srfi-18 and the vm


From: Andy Wingo
Subject: Re: srfi-18 and the vm
Date: Sat, 23 May 2009 18:38:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Neil,

On Sat 23 May 2009 11:52, Neil Jerram <address@hidden> writes:

> Andy Wingo <address@hidden> writes:
>
>> With psyntax running a pre-analysis phase on all source code, we can do
>> away with lazy memoization entirely -- a neat hack, but it made eval.c
>> buggy and impenetrable. I'll write more about that in the future.
>
> Anticipating your "more in the future", do you mean that the
> pre-analysis does all the memoization in advance?

It does not now, but it could. All output from psyntax is created by
this set of procedures (internal to psyntax.scm):

    build-void
    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

In compile mode, these procedures create tree-il objects. In eval mode,
they create s-expressions, so that the expander can work before modules
are booted. (The mode is the second parameter to sc-expand; it's eval
mode by default, but the compiler sets it to compile mode.)

One should be able to memoize ilocs in from the result of the output, in
a second pass, given that there are so few forms. Of course some
memoization can happen lazily too, e.g. global lookup; but macros have
already been expanded out, so the evaluator doesn't have to know about
`cond' or `do' or anything else, and unmemoization becomes trivial.

The evaluator can be drastically simplified, which is good for
maintainance. It will probably be faster too. Then, later on, we can
implement and compile an evaluator in Scheme itself, so that we can tail
call between interpreted and compiled code.

(We're not limited to just 2 passes, even in the interpreter, of course;
once we have an inliner, it would probably be a good idea to run it on
code for interpretation, as well.)

What do you think?

Andy
-- 
http://wingolog.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]