File: stackless_informal.dot

package info (click to toggle)
pypy3 7.3.11%2Bdfsg-2%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 201,024 kB
  • sloc: python: 1,950,308; ansic: 517,580; sh: 21,417; asm: 14,419; cpp: 4,263; makefile: 4,228; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 11; awk: 4
file content (28 lines) | stat: -rw-r--r-- 1,565 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
digraph mul_graph {
    node [shape="octagon", color="black", fillcolor="white", style="filled"];
    subgraph mul {
        mul [shape="box", label="def recmul(x, y):\l    if x == 0:\l        return 0\l    else:\l        z = x - 1\l        return recmul(z, y) + y\l", fillcolor="green"];
        mul_r [shape="ellipse", label="Are we resuming?", color="blue"];
        mul_0 [label="x == 0?"];
        mul_1 [shape="box", label="z = x - 1"];
        mul_chk [shape="ellipse", label="is the stack too big?", color="blue"]
        mul_2 [shape="box", label="return", fillcolor="green"];
        mul_3 [label="p = recmul(z, y)\n\nis the stack being unwound?"];
        mul_4 [shape="ellipse", label="store y and z on the heap\nstart unwinding the stack", color="blue"];
        mul_5 [shape="box", label="result = p + y"];
        mul_r3 [shape="ellipse", label="load saved variables y and z\lfrom the heap", color="blue"];
        mul_s3 [shape="ellipse", label="save y and z to the heap\lcontinue unwinding", color="blue"];
        mul -> mul_r [label="startblock"];
        mul_r -> mul_0 [label="No: x  y"];
        mul_r -> mul_r3 [label="Yes: (ignore input args)"];
        mul_r3 -> mul_3 [label="y  z"];
        mul_0 -> mul_1 [label="No: x  y"];
        mul_1 -> mul_chk [label="y  z"];
        mul_0 -> mul_2 [label="Yes: (0)"];
        mul_chk -> mul_3 [label="No: y  z"];
        mul_chk -> mul_4 [label="Yes: y  z"];
        mul_3 -> mul_5 [label="No: y  p"];
        mul_3 -> mul_s3 [label="Yes: y  z"];
        mul_5 -> mul_2 [label="result"];
    }
}