stack overflow
Per Bothner
per@bothner.com
Mon Nov 1 08:58:00 GMT 1999
Godmar Back <gback@cs.utah.edu> writes:
> This seems as though you're going the hardware route...
I believe this was first added for one of Cygnus's Chill contracts -
where the customer only cared about a couple of targets.
> I take it then that you're convinced you can implement it
> portably.
I'm not convinced of anything.
I'm sure it can be implemented portably. I don't know about
portably *and* efficiently. I also don't know (remember) anything
about the Gcc implementation, and how general/robust it is.
One idea I've add is to for each procedure the compiler figures
out how much stack space it needs. For leaf procedures, it is easy.
For non-left procedures, you add in the space you need for
called leaf procedures. You insert dynamic check when you have
a cycle, or are calling an unknown method/procedure. Some checks
can perhaps be eliminated if you always leave some extra space
that will be enough for most procedures.
How to turn this vague idea into an algorithm is not clear.
It might make a good dissertation. It is presumably easier
if you can do global program analysis, but it is ijmportant to
support separate compilation - especially in a Java context.
If each function saves the amount of stack space it needs in
the object file, then maybe the linker can do the analysis.
That requires teh linker to add/remove code to do the actual
test, which might be difficult.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/
More information about the Java
mailing list