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

List:       busybox
Subject:    Re: [PATCH 2/3] Revert "ash: fix a SEGV case in an invalid heredoc" xxx
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2015-10-30 18:56:17
Message-ID: CAK1hOcOs-hDKpj85hnZ0POUtQ0Lj5QDfm-67sBcP=w9Jk2LJyg () mail ! gmail ! com
[Download RAW message or body]

On Thu, Oct 29, 2015 at 2:04 PM, Ron Yorston <rmy@pobox.com> wrote:
> Natanael Copa wrote:
>>I also figured that we can save a few bytes with:
>>
>>-                       tokpushback = 1;
>>+                       tokpushback++;
>>
>>But I don't know if that can cause surprises due to overflows.
>
> dash uses the increment; Denys switched to using the assignment for
> Busybox ash (commit bcceb0c).  I was just following him.

On x86, increment is a shorter instruction for 32-bit variables.
First, INC does not need immediate, and second,
x86 has no MOV instruction with sign-extended 8-bit immediate
(it has such forms for ALU ops). Therefore "MOV immediate to memory"
is a rather long instruction.

On most other CPUs it's probably not shorter.

It is always faster to do a store.

And in the case of ash.c, the optimization is not worth
the logic obfuscation.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

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