Yuri
2010-Jun-24 00:05 UTC
[LLVMdev] How to set JIT stack depth allocated for the process?
I need to know how deep is the stack allocated for the process (total for all functions)? How to set this size? Yuri
Eli Friedman
2010-Jun-24 00:15 UTC
[LLVMdev] How to set JIT stack depth allocated for the process?
On Wed, Jun 23, 2010 at 5:05 PM, Yuri <yuri at rawbw.com> wrote:> I need to know how deep is the stack allocated for the process (total > for all functions)? > How to set this size?You'll need some platform-specific code; LLVM doesn't touch anything related to the size of the stack. -Eli
Duncan Sands
2010-Jun-24 07:40 UTC
[LLVMdev] How to set JIT stack depth allocated for the process?
Hi Yuri,> I need to know how deep is the stack allocated for the process (total > for all functions)? > How to set this size?the linux kernel has a script, checkstack.pl, which tries to compute how much stack each function uses, maybe that will give you some ideas. This is mostly useful for the kernel since (for user programs) on linux the stack does not have a fixed size: if it isn't big enough then it is magically extended [*]. Of course once it has used up all of your machines memory then you are dead! That said, if you are using multiple threads, each thread (except for the first one) gets a fixed stack size, even on linux and similar operating systems. Ciao, Duncan. [*] Unless the user has a stack size limit, for example because of "ulimit -s". PS: In theory it should be possible to estimate the total stack usage from the LLVM IR by looking at the call graph, AllocaInst's, calls to alloca, number of function parameters etc. But I don't think anyone did this.
Reasonably Related Threads
- [LLVMdev] Why gdb can't determine stack of code run in JIT?
- [LLVMdev] [patch] New feature: debug info for function memory ranges (-jit-emit-debug-function-range)
- [LLVMdev] Why exceptions don't work in JIT?
- [LLVMdev] [patch] New feature: debug info for function memory ranges (-jit-emit-debug-function-range)
- [LLVMdev] [patch] New feature: debug info in add2line format (--jit-emit-debug-addr2line)