implemented a stack trace profiler

This commit is contained in:
Araq 2012-09-15 00:21:10 +02:00
commit 214c7a2ebd
11 changed files with 241 additions and 65 deletions

View file

@ -265,6 +265,10 @@ proc genWhileStmt(p: BProc, t: PNode) =
let label = assignLabel(p.blocks[p.breakIdx])
lineF(p, cpsStmts, "if (!$1) goto $2;$n", [rdLoc(a), label])
genStmts(p, t.sons[1])
if optProfiler in p.options:
# invoke at loop body exit:
lineCg(p, cpsStmts, "#nimProfile();$n")
endBlock(p)
dec(p.withinLoop)