Why google-perftools fails on the JITted code?

I am trying to run some code allocating a lot of memory and not releasing it in JIT under google-perftools. Just one function 'main' calling 'malloc'.
google-perftools fails to correctly read stack when malloc is called from inside the JITted code, and as a result perftools report is wrong: address of 'main' procedure appears shifted 0x3946e1d0->0x3946e1ed and is not aligned. And calling it procedure (runFunction) is skipped, but higher in stack methods are shown correctly.

This causes me to ask this question: when the code is run in JIT, are the stack frames (and prologs) different from when the code results from compiler? Is it still possible to read this stack correctly using the same procedure for both JITted and regular code?

Yuri

Now I see that JITted code doesn't have standard prolog, on x86 each procedure instead begins with 'sub $0x4,%esp'.

Is there an option to make JIT generate regular prologs?

Yuri

Now I see that JITted code doesn't have standard prolog, on x86 each
procedure instead begins with 'sub $0x4,%esp'.

Is there an option to make JIT generate regular prologs?

Try turning off frame pointer elimination. On the llc command line, this is -disable-fp-elim

-Chris

What does llc have to do with the JIT?

llc and lli use the same code generator. LLI takes the -disable-fp-elim flag also. If you have embedded this JIT in your own stuff (which wasn't specified) you need to use the same api that the -disable-fp-elim flag sets in these two tools.

-Chris

I think he meant lli.
Actually I use API instead and setting the flag equivalent to this option worked. Now google-perftools generates the correct profile.

Yuri