Status of -fstack-usage?
Olivier Hainque
hainque@adacore.com
Thu Jan 19 17:37:00 GMT 2006
Hello,
Ioannis E. Venetis wrote:
> Having followed this thread and searched a little bit more, I understand
> that -fstack-usage will dump information into a file at compile time.
Right.
> However, I was wondering whether something similar would be possible at
> run-time.
>
> I am working on multithreaded libraries and I know that many
> multithreaded languages have compilers that calculate the required stack
> size and pass this information on to the associated library. This way,
> they can handle efficiently memory. However, this is a problem in
> standalone libraries. If we could have something like:
>
> stack_size = __builtin_stack_size(<function>)
>
> that returns the maximum required stack size for <function>,
> multithreaded libraries could take advantage of it at run-time, in order
> to allocate only the amount of required memory.
Interesting idea :)
> This is of course not a complete proposal for something, just asking if
> something like that would be possible at all.
Well, it depends :)
Would __builtin_stack_size (F) retrieve information about F's stack frame
only, or would it also recursively account for every other function that
F may call ?
Implementing the former is probably possible, though I'm not sure
exactly how useful it would be.
The latter would no doubt be much^a_lot harder.
More information about the Gcc
mailing list