|
From: Josef W. <Jos...@gm...> - 2006-05-01 01:17:14
|
On Monday 01 May 2006 02:55, sv...@va... wrote:
> Callgrind: Improve self-hosting with outer callgrind tool
> ...
> The default behaviour is _bad_ for using callgrind with
> self-hosting. Valgrinds inner loop VG_(run_innerloop)
> jumps to generated code, and this code jumps back to
> the inner loop. Thus, every executed BB adds 2 calls
> to an ever increasing shadow call stack, leading to
> memory consumption increasing with runtime :-(
This explains the huge memory requirements of self-hosting
with outer callgrind. Using the new option should get rid of this.
Should I add a tip to use "--pop-on-jump" with callgrind in the
self-hosting section of README_DEVELOPERS?
I will not document it otherwise, because it makes callgrind quite
unstable (something to investigate).
Note that this does not change the embarrasing slow loading time
of resulting profile data files with KCachegrind, which currently
has time complexity quadratic to the maximum number of callers and
callees of a function (to be fixed with KCachegrind in KDE 3.5.3).
"run_thread_for_a_while" will have the same number of callees as
there are instrumented BBs. However, such call graphs are quite
unusual...
I noted that a lot of Valgrinds assembler functions like
VG_(run_innerloop) do not show up as function symbols with
self-hosting. This is because of missing ".type ..., @function" and
.size directives. I think this should be fixed. Attached
is such a fix for the x86 version of VG_(run_innerloop).
Josef
--- m_dispatch/dispatch-x86-linux.S (Revision 5868)
+++ m_dispatch/dispatch-x86-linux.S (Arbeitskopie)
@@ -51,6 +51,7 @@
*/
.text
.globl VG_(run_innerloop)
+.type VG_(run_innerloop), @function
VG_(run_innerloop):
/* 4(%esp) holds guest_state */
/* 8(%esp) holds do_profiling */
@@ -251,8 +252,8 @@
popl %ecx
popl %ebx
ret
+.size VG_(run_innerloop), .-VG_(run_innerloop)
|