[SLOF] [PATCH] libc: The arguments of puts() can be marked as "const"

Alexey Kardashevskiy aik at ozlabs.ru
Thu Jul 13 12:42:32 AEST 2017


On 12/07/17 22:41, Segher Boessenkool wrote:
> On Wed, Jul 12, 2017 at 06:53:38AM +0200, Thomas Huth wrote:
>> That's kind of ugly. Why not simply:
>>
>> diff --git a/slof/paflof.c b/slof/paflof.c
>> index 50b4adf..ea3c145 100644
>> --- a/slof/paflof.c
>> +++ b/slof/paflof.c
>> @@ -81,8 +81,8 @@ long engine(int mode, long param_1, long param_2)
>>                 LAST_ELEMENT(xt_FORTH_X2d_WORDLIST).a = xt_LASTWORD;
>>
>>                 // stack-pointers
>> -               dp = the_data_stack - 1;
>> -               rp = handler_stack - 1;
>> +               dp = the_data_stack;
>> +               rp = handler_stack;
>>
>>                 // return-address for "evaluate" personality
>>                 dummy.a = &&over;
> 
> Paflof originally had options to cache 0, 1, or 2 top-of-stack elements.
> Now it is always 1; it is usually fastest (2 is theoretically a tiny
> bit better, but a bit worse in practice).


Sorry I am missing the connection between this 1-cell-cache and the size of
the stack :)


> 
> There also was a user-space version.  It set up the stacks with unmapped
> guard pages, so it could trap stack underflows (and overflows).  If you
> run in translation-off mode you of course cannot do such things.
> 
> (Your patch is incomplete btw, there are five or six or so places that
> need changes).
> 
> I would just add a cast to shut up the warning, and not lose the
> optimisations (or ignore the warning).
> 
> 
> Segher
> 


-- 
Alexey


More information about the SLOF mailing list