[PATCH 2/3] Revert "ash: fix a SEGV case in an invalid heredoc" xxx

Denys Vlasenko vda.linux at googlemail.com
Fri Oct 30 18:56:17 UTC 2015


On Thu, Oct 29, 2015 at 2:04 PM, Ron Yorston <rmy at 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.


More information about the busybox mailing list