[ANN] Sacla loop: a new loop implementation

From: Yuji Minejima (ggb01164_at_nifty.ne.jp)
Date: 09/28/04


Date: Tue, 28 Sep 2004 14:11:03 +0900

This is part of Sacla project.
http://homepage1.nifty.com/bmonkey/lisp/sacla/index-en.html

You can find the latest sacla loop at.
http://homepage1.nifty.com/bmonkey/lisp/sacla/lisp/loop.lisp

Some design goals of this loop implementation are
* understanding the loop facility by implementing it.
* being as portable as possible.
* producing a good expansion code for a relatively common compiler.
* adopting optimizations which boost the execution speed of idioms which
  are commonly used.
* code clarity (I guess I should refine the code more).

Some features which comes to mind are
* when the correct behavior is arguable, followes the behavior of CMUCL's
  or GNU CLISP's implementation.
* passes all loop tests in Paul Dietz's ANSI-TEST suite.
* tested to run on CMUCL and GNU CLISP. Probably runs on almost all the
  conforming implementation.
* destructuring on the result of multiple-value-list form is transformed
  to a multiple-value-setq form, reducing the amout of consing.
  e.g. (macroexpand '(loop for (a b c) = (multiple-value-list (foo))))
       => (BLOCK NIL
            (LET ((A NIL) (B NIL) (C NIL))
              (MACROLET ((LOOP-FINISH NIL '(GO #:LOOP-EPILOGUE-7002)))
                (TAGBODY
                   #:LOOP-BODY-7001
                   (MULTIPLE-VALUE-SETQ (A B C) (FOO))
                   (GO #:LOOP-BODY-7001)
                   #:LOOP-EPILOGUE-7002))))
* when compared to cmucl's loop, attains almost the same execution speed
  in cmucl. Some optimizations are omitted, in such cases the speed is
  slightly slow. pays more attention to canstant argument cases. The code
  size is about half long. (but cmucl's MIT code contains lots of
  historical code.)

Any comments are welcome.

Yuji.



Relevant Pages

  • Re: Misusing LOOP correctly?
    ... and for testing the code on CMUCL. ... but also belch loud complaints about "Deleting unreachable code": ... Does the LOOP spec allow me to rely on this behavior? ... But is LOOP required to initialize the `for' ...
    (comp.lang.lisp)
  • Re: How to deal with external libraries ??
    ... autoloading only works in cmucl with a patched asdf. ... LOOP:: a Domain Specific Language. ...
    (comp.lang.lisp)
  • INITIALLY clauses in loop
    ... INITIALLY clause in loop is actually run. ... (defun loop-test () ... Before the November shapshot of CMUCL, ...
    (comp.lang.lisp)
  • Re: Source for LOOP macro
    ... >a source implementation of LOOP? ... If something as big as the CMUCL version will do... ... Prev by Date: ...
    (comp.lang.lisp)