From 6142fa676731e158622ca7956c150c58bc57f1f2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 10:38:37 -0300 Subject: design: the graph of a function's blocks; two runs as a pair From the user. The disassembly's alternate form at a larger scale is the graph of its basic blocks: a block a box of rows with its offset, lines and visit count; execution flows down and a back edge is the one thing that climbs, in its loop's lane with the turn count; what the run never reached folds away. On the map it takes the disassembly's place; in the working frame a blocks lens draws its shape and the rows are its view. Verbs leave and turn carry the mark along an edge. Two runs of one program share a frame as a pair: the seam is the gutter, the source shared above, rows only one run has and values that differ marked at the seam. The scene it is made for sets a plain build against an ASan one in a stack overflow: the frame beside its shadow bytes, the store beside its check, and the step where they part. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/25-blocks-lens.svg | 464 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 464 insertions(+) create mode 100644 design/mock/25-blocks-lens.svg (limited to 'design/mock/25-blocks-lens.svg') diff --git a/design/mock/25-blocks-lens.svg b/design/mock/25-blocks-lens.svg new file mode 100644 index 0000000..3504f8e --- /dev/null +++ b/design/mock/25-blocks-lens.svg @@ -0,0 +1,464 @@ + + + + + + +the blocks of sort +its blocks · the visits · the path + + + + + + + + + + + + + + + + + + +×5 + + +×5 + + ++0 +×1 + + ++17 +×6 + + ++1f +×5 + + ++5f +×11 + + ++65 +×11 + + ++9a +×5 + + ++9e +×6 + + ++aa + + + +disassembly +sort · +84 to +a1 +4011 +c7 +12 +lea +rcx, [rax*4] + +4011 +cf +lea +rax, [rip + 0x2e4a] + +4011 +d6 +mov +eax, [rcx + rax*1] +404034 +◂ +5 + +4011 +d9 +cmp +edx, eax +17 + : +5 + +zf + sf + of + + + +4011 +db +jg +401162 +taken + · reads zf sf of +4011 +dd +10 +add +[rbp - 8] + + + + +, 1 +4011 +e1 +mov +eax, [rbp - 8] + + + +sort.c +lines 1 to 21 of 22 +1 +int +a +[ +8 +] += +{ +4 +, +9 +, +17 +, +31 +, +12 +, +26 +, +5 +, +20 +} +; +2 +3 +void +swap +( +int +* +x +, +int +* +y +) +{ +4 +int +t += +* +x +; +5 +* +x += +* +y +; +6 +* +y += +t +; +7 +} +8 +9 +void +sort +( +int +n +) +{ +10 +for +( +int +i += +1 +; +i +< +n +; +i ++ ++ +) +{ +11 +int +j += +i +; + + +12 +while +( +j +> +0 +& +& +a +[ +j +- +1 +] +> +a +[ +j +] +) +{ + +13 +swap +( +& +a +[ +j +- +1 +] +, +& +a +[ +j +] +) +; + +14 +j +- +- +; +15 +} +16 +} +17 +} +18 +19 +int +main +( +void +) +{ +20 +sort +( +8 +) +; +21 +return +0 +; + + + +registers +stack +heap +code +data +rwx + +read-only +rax +5 + +rbx +0 +rcx +0x10 +16 +rdx +0x11 +17 + +rsi +404034 + + +0x1f0000001a +rdi +404030 + + +0x1a00000005 +rbp +7fffffffecf0 + + +7fffffffed00 + + +7fffffffedb0 + + +7fffffffee10 + + +0 +rsp +7fffffffecd8 + + +0x800000000 +r8 +7ffff7e19680 +r9 +7ffff7e1afa0 +r10 +7fffffffea60 + + +0 +r11 +7ffff7ffca90 + + +0x786843bb9f54c5c1 +r12 +7fffffffee38 + + +7fffffffefea + + +"./sort" +r13 +1 +r14 +7ffff7ffd000 + + +7ffff7ffe3c0 + + +0 +r15 +403e10 + + +4010e0 +__do_global_dtors_aux + + +rip +4011db +sort+152 +cf + +PF + +AF +zf +sf + +IF +df +of + + + +stack +six words from rsp · the frames they belong to +rsp + ++0 +7fffffffe +cd8 + + +0x800000000 ++8 +7fffffffe +ce0 + + +0 ++10 +i, j +7fffffffe +ce8 + + +0x400000006 +rbp + ++18 +saved rbp +7fffffffe +cf0 + + +7fffffffed00 + + + + + ++20 +7fffffffe +cf8 + + +4011ff +main+14 ++28 +7fffffffe +d00 + + +7fffffffedb0 + + +7fffffffee10 + + +0 + + + +sort(8) + + +moment 370 of 465 +The sixth pass, its third compare: 17 : 5, so jg goes back to the swap. +The swap has run 5 times so far; the outer loop has turned 5. + -- cgit v1.3