Interpreting the trace tree drawer output

Here's a quick primer on how to interpret the output of the trace tree drawer in Tamarin-Tracing. Let's use the following .as example:

function f() {
var k = 0;
var j = 0;
var l = 0;

for (var i = 0; i < 100; ++i) {
if (i < 20) {
k = i;
}

if (i < 40) {
j = i;
} else
l = i;

}
}

f();


Which generates the following graph:

The blue nodes are the main traces, and the orange blocks are side exits
that were taken during execution of the trace. The numbers such as \4
represent the side exit id. Orange nodes that are labeled with an M eg.
"M2" are merge nodes, which are multiple branches merged into one
compiled piece of code.

The +numbers such as T6...f()+29, at the end of the node labels
represent the Forth IP. Prior to execution, Tamarin translates .abc to
Forth. This resulting Forth is actually executed and traced. You can see
the resulting Forth translation if you run Tamarin with the -Dverbose
flag. In the example, a small translation snippet is:

47:jump 102
+25 LITC1
+26 LBRT 0x47300f2
B0:
* +29 OP_label*
frame: Object? * * * *

The "47:jump 102" represents the ABC opcode from the source file. The
Forth that is being translated for this ABC opcode contains a + next to
the number. Therefore, the main trace in the tree drawer output
T6...f()+29, refers to the OP_label Forth opcode. Each of the +number
next to the nodes in the graph represent their location in the Forth code.

What you are seeing in this picture, is one main trace "T6". The side
exit "\4" has two guards that were actually executed, one of which jumps
back to T6, and the other jumps to another side exit "\13". The other
side exits jump to more side exits in the order that they were compiled,
which eventually hit a merge node "M2". The M2 merge node again side
exits to another merge node M3. M3 finally jumps back to T6.

Another way of looking at the traces is to run Tamarin with the -Dstats
flag, which gives you the same information in text form. It contains a
few more side exits and traces that were unsuccessful in generating
code. The trace tree drawer only shows traces/side exits which contain
compiled code.

* Picture and example used with permission from Zsolt Vilagos and Peter Siket