From: Hidayet Tunc Simsek
Subject: [flet] inlining?
Date: 
Message-ID: <388CD8DE.493EC670@EECS.Berkeley.Edu>
Out of curiousity, when you have nested FLET's can you get inlining:

 (flet ((foo (x)
          1))
    (flet ((zot (x)
              (foo x)))
       (zot x)))


It'd be nice to inline FOO in ZOT.

Thanks,
Tunc

From: Pierre R. Mai
Subject: Re: [flet] inlining?
Date: 
Message-ID: <87ya9fknfd.fsf@orion.dent.isdn.cs.tu-berlin.de>
Hidayet Tunc Simsek <······@EECS.Berkeley.Edu> writes:

> Out of curiousity, when you have nested FLET's can you get inlining:
> 
>  (flet ((foo (x)
>           1))
>     (flet ((zot (x)
>               (foo x)))
>        (zot x)))
> 
> 
> It'd be nice to inline FOO in ZOT.

CMUCL normally does perform inlining of local functions:

(declaim (optimize (speed 3)))

(defun test-inline (n)
  (declare (type (unsigned-byte 8) n))
  (flet ((foo (x)
           (1+ x)))
    (flet ((zot (x)
             (foo x)))
      (zot n))))

* (disassemble 'test-inline)

48107590:       .ENTRY TEST-INLINE(n)        ; (FUNCTION ((UNSIGNED-BYTE 8))
                                                (INTEGER 1 256))
      A8:       POP   DWORD PTR [EBP-8]
      AB:       LEA   ESP, [EBP-32]

      AE:       CMP   ECX, 4
      B1:       JNE   L0
      B3:       TEST  DL, 3
      B6:       JNE   L1
      B8:       ADD   EDX, 4                 ; No-arg-parsing entry point
      BB:       MOV   ECX, [EBP-8]
      BE:       MOV   EAX, [EBP-4]
      C1:       ADD   ECX, 2
      C4:       MOV   ESP, EBP
      C6:       MOV   EBP, EAX
      C8:       JMP   ECX
      CA:       NOP
      CB:       NOP
      CC:       NOP
      CD:       NOP
      CE:       NOP
      CF:       NOP
      D0: L0:   BREAK 10                     ; Error trap
      D2:       BYTE  #x02
      D3:       BYTE  #x19                   ; INVALID-ARGUMENT-COUNT-ERROR
      D4:       BYTE  #x4D                   ; ECX
      D5: L1:   BREAK 10                     ; Error trap
      D7:       BYTE  #x02
      D8:       BYTE  #x0A                   ; OBJECT-NOT-FIXNUM-ERROR
      D9:       BYTE  #x8E                   ; EDX

Regs, Pierre.

-- 
Pierre Mai <····@acm.org>         PGP and GPG keys at your nearest Keyserver
  "One smaller motivation which, in part, stems from altruism is Microsoft-
   bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]
From: Barry Margolin
Subject: Re: [flet] inlining?
Date: 
Message-ID: <zw6j4.56$jJ2.983@burlma1-snr2>
In article <·················@EECS.Berkeley.Edu>,
Hidayet Tunc Simsek  <······@EECS.Berkeley.Edu> wrote:
>Out of curiousity, when you have nested FLET's can you get inlining:
>
> (flet ((foo (x)
>          1))
>    (flet ((zot (x)
>              (foo x)))
>       (zot x)))

You're supposed to request it with DECLARE:

(flet ((foo (x)
         1))
  (declare (inline foo))
  (flet ((zot (x)
           (foo x)))
    (declare (inline zot))
    (zot x)))

Note that INLINE is merely a request; an implementation is not required to
honor it.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.