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

You'll need some platform-specific code; LLVM doesn't touch anything
related to the size of the stack.

-Eli

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.