This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Status of -fstack-usage?


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.

 



 
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]