[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Ash + telnetd: telnet client hangs after exit
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2007-10-17 10:26:11
Message-ID: 200710171126.11319.vda.linux () googlemail ! com
[Download RAW message or body]

On Wednesday 17 October 2007 10:19, Ralf Friedl wrote:
> Denys Vlasenko wrote:
> > ...
> > function                                             old     new   delta
> > telnetd_main                                        1355    1350      -5
> > make_new_session                                     532     521     -11
> > free_session                                         118     101     -17
> > ------------------------------------------------------------------------------
> > (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-33)             Total: -33 bytes
> >    text    data     bss     dec     hex filename
> >  676328    2538   12104  690970   a8b1a busybox_old
> >  676295    2538   12104  690937   a8af9 busybox_unstripped
> >
> > Please review attached (or see current svn).
> It seems fine.
> 
> I'm surprised that your changes to telnetd_main removed only 5 bytes. 
> The compiler seems to be quite clever already.

Sadly, no.

        movl    $0, 56(%eax)    #, <variable>.nblock
        movl    $0, 64(%eax)    #, <variable>.numZ
        movl    $0, 68(%eax)    #, <variable>.state_out_pos
        movl    $-1, 80(%eax)   #, <variable>.blockCRC
        xorl    %edx, %edx      # i

If only gcc realized that by zeroing edx first, it could have used
movl %edx,(mem), and save 12 bytes...

Another example:

isempty_RL:
-       movl    $1, %edx        #, D.7967
+       movb    $1, %dl         #, D.7967 -- three bytes shorter
        cmpl    $255, 48(%eax)  #, <variable>.state_in_ch
        ja      .L215   #,
-       xorl    %edx, %edx      # D.7967 -- not needed (2 bytes)
        cmpl    $0, 52(%eax)    #, <variable>.state_in_len
        setle   %dl     #, D.7967
.L215:
-       movl    %edx, %eax      # D.7967, <result>
+       movzbl  %dl, %eax       # D.7967, <result> -- one byte longer
        ret

And so on and so forth...
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic