On Thu, Oct 24, 2002 at 04:47:05PM -0400, Josh Wilmes wrote:
> > > I've got a patch which switches this detection to happen at run-time
> > > instead of at build-time. This is going to be necessary for miniparrot
> > > (which has no "Configure" step) anyway.
> >
> > Have you checked how much this affects the performance of stack walking ?
>
> It shouldn't at all. It does the check once, when parrot starts up.
It will. If you read the following paragraph I explained why it will be slower,
and it has nothing to do with how often the check is performed.
STACK_DIR is a compile time constant, so the multiplies in the following code
are eliminated by the compiler if it does any optimization. By making
STACK_DIR a variable, the compiler is no longer able to do this and has to
generate code to do multiplies.
for (cur_var_ptr = lo_var_ptr;
(ptrdiff_t)(cur_var_ptr * PARROT_STACK_DIR) <
(ptrdiff_t)(hi_var_ptr * PARROT_STACK_DIR);
cur_var_ptr = (size_t)( (ptrdiff_t)cur_var_ptr +
PARROT_STACK_DIR * PARROT_PTR_ALIGNMENT )
--
Jason