|
From: <sv...@va...> - 2009-08-11 19:21:38
|
Author: weidendo
Date: 2009-08-11 20:21:25 +0100 (Tue, 11 Aug 2009)
New Revision: 10780
Log:
Fix dumping of call cost in tail recursion optimization
When tail recursion optimization is detected (i.e. a jump to the
beginning of the function without creating a new stack frame),
Callgrind collects this as real call (ie. calculates inclusive
call costs), but forgot to dump the call information (the call
type is still left as a jump).
Fixed by also dump call information if inclusive cost is >0.
Modified:
trunk/callgrind/dump.c
Modified: trunk/callgrind/dump.c
===================================================================
--- trunk/callgrind/dump.c 2009-08-11 15:00:54 UTC (rev 10779)
+++ trunk/callgrind/dump.c 2009-08-11 19:21:25 UTC (rev 10780)
@@ -832,7 +832,8 @@
if (bb->jmp[jmp].instr == instr) {
jcc_count=0;
for(jcc=bbcc->jmp[jmp].jcc_list; jcc; jcc=jcc->next_from)
- if ((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0))
+ if (((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0)) ||
+ (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost )))
jcc_count++;
if (jcc_count>0) {
@@ -845,7 +846,8 @@
fprint_apos(fd, &(currCost->p), last, bbcc->cxt->fn[0]->file);
something_written = True;
for(jcc=bbcc->jmp[jmp].jcc_list; jcc; jcc=jcc->next_from) {
- if ((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0))
+ if (((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0)) ||
+ (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost )))
fprint_jcc(fd, jcc, &(currCost->p), last, ecounter);
}
}
|