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.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^8: What perl operations will consume C stack space? by BrowserUk
in thread What perl operations will consume C stack space? by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.