[SLOF] [PATCH] libc: The arguments of puts() can be marked as "const"
Segher Boessenkool
segher at kernel.crashing.org
Wed Jul 12 22:41:16 AEST 2017
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).
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
More information about the SLOF
mailing list