in reply to Re^7: What perl operations will consume C stack space?
in thread What perl operations will consume C stack space?
Okay, i was just thinking out loud. You know I won't offering any patches to the regex engine any time soon :)
It's quite easy to find out the base address and extent of the stack segment on x86, which combined with the current value of SP gets part of the equations. That's probably not true on all platforms though.
For simple, self recursive routines I've calculated the stack requirement of the routine at runtime by subtracting the address of the first auto from the last + a fudge factor for parameters & return address, but it means putting all autos at the top of the routine. Trying to apply that technique to mutually recursive functions get tricky, and for functions the size and complexity of S_regmatch() it's non-starter.
Everytime I look at subs that are basically one huge switch statement, I wonder of they couldn't be refactored into one of those GCC computed gotos that Parrot uses in one of it's dispatch loop varients.
|
|---|