Hi Noah,

Noah Lavine <noah.b.lav...@gmail.com> writes:
> I've been working on a patch to add a new sort of optimization to
> peval, and I think it's almost ready. It's based on some of the ideas
> in "Environment Analysis of Higher-Order Languages".

Nice! :)

> There's one glaring wart. The identity checking is activiated by calls
> to (toplevel 'eq?). Clearly, it should be activated by calls to the
> primitive 'eq? (and eqv? and equal?). The reason it's not is that my
> example above compiles to (call (toplevel-ref 'eq?) ...), and I don't
> know how to make it turn into a (primcall 'eq? ...).

The conversion from (toplevel-ref 'eq?) to (primcall 'eq?) is
done by 'resolve-primitives!' in (language tree-il primitives).
'expand-primitives!' is normally also called before 'peval'.
See 'optimize!' in (language tree-il optimize) for details.

I hope to take a deeper look at your patch later, but for now I wanted
to quickly answer your question :)

    Thanks!
      Mark

Reply via email to