After all the efforts to simplify Parrot's stack situation, it seems
to me like src/stack_common.c and src/stacks.c can be merged. After a
quick search, none of the functions from stack_common.c are used
anywhere except in stacks.c. Some functions from the former are
completely redundant. For instance,
src/stack_common.c:register_new_stack is only used as a tail call in
src/stacks.c:new_stack.

There are a few other simplifications that I think can be made also.
For instance, in calculating the size of a new Stack_Chunk_t, we use
the convoluted equation "size = sizeof(Stack_Entry_t) +
offsetof(Stack_Chunk_t, u.data)", which is much more easily written as
"size = sizeof(Stack_Chunk_t)". I assume, based on this complexity,
that the size of a stack chunk's payload was variable, but it appears
now that there is only one kind of stack, and one size of payload.

Merging these two files together, there are a lot of simplifications
that could easily be made. We wouldn't want to oversimplify if it was
our intention to add new stacks and new types of stacks in the future,
but there is a lot we could do without limiting our future options.

--Andrew Whitworth

Reply via email to