This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tail sets


Hi,

I'm using a pattern matching macro that looks like:

(define-syntax mif
  (syntax-rules ()
    ((mif ((p . ps) value) then else)
     (let ((fail (lambda () else))
           (tmp value))
       (if (instance? tmp <pair>)
           (let ((tmp :: <pair> tmp))
             (mif (p tmp:car)
                  (mif (ps tmp:cdr)
                       then
                       (fail))
                  (fail)))
           (fail))))
    ((mif (var value) then else)
     (let ((var value)) then))))

The else branch is abstracted out to avoid code duplication and there
are three calls to (fail).  At least CMUCL recognizes that those three
calls have the same continuation and compiles the calls as direct
jumps.  It seems to me, that Kawa compiles them as ordinary calls (and
presumably has to allocate a closure).  Would it be hard to teach the
compiler to optimize situations like the above?  Alternatively, is
there something like TAGBODY/GO in Kawa?

I'm asking just out of curiosity, not because I need the optimization.

Helmut.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]