chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] "argvector" chicken (was: ABI woes)


From: felix . winkelmann
Subject: [Chicken-hackers] "argvector" chicken (was: ABI woes)
Date: Tue, 21 Jul 2015 20:35:00 +0200

> Scripsit address@hidden:
>
> > The new approach passes all arguments in a stack-allocated C_word array.
>
> I would expect this to deeply suck on systems that have lots of registers
> and whose C compilers routinely pass arguments in registers.  In particular,
>
> > not significantly slower
>
> is pretty surprising on x86_64, where the first six arguments are passed in
> registers, since registers are usually much faster than main memory, and the
> cache doesn't help much with these argvectors unless they are shared between
> call sites (which you imply they currently are not).

CPS calls are surprisingly expensive in general in CHICKEN, and timing often
gives inconsistent results. I assume that the continuous growth of the stack
and/or the memory usage pattern in CHICKEN-generated CPS code totally drowns
any performance advantage than register-passed arguments would give.

I think it's leaf-routines where register-args give a performance boost - long
numerically intensive code with many (but shallow) function calls. Deeply
nested calls, or calls that never return on the other hand are what is
expensive - they touch more memory, make callee-saved registers and all that
elaborate effort of saving/restoring/spilling actually more expensive than
necessary.

C, as it is compiled, is not optimized for CPS. More or less registers
make no difference.


felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]