A jump table at -O0 and a value table at -O1
Two columns. Left, grade in the lesson 33 fixture ledger-x86_64-O0.o: a bounds check, a leaq with a relocation against .rodata, a scaled load, an add and jmpq through rax; the table in .rela.rodata holds five relocations whose targets are 0x91, 0x88, 0x7f, 0x76 and 0x76, so the graph has 8 blocks and 11 edges. Right, _grade in the arm64 -O1 capture: a compare and b.hi, an adrp and add that form 0x1000007d0, and one ldr that returns one of the five values 1, 2, 3, 4, 4; the dossier has 3 blocks, 2 edges and an empty jump_tables list.
A · GRADE AT -O0, X86-64 OBJECT
B · _GRADE AT -O1, ARM64 EXECUTABLE
lesson 33 fixture ledger-x86_64-O0.o
capture 06-function-grade.json
5d: subl $0x4, %eax
60: ja 0x9a
66: leaq (%rip), %rcx
R_X86_64_PC32 .rodata-0x4
6d: movslq (%rcx,%rax,4), %rax
71: addq %rcx, %rax
74: jmpq *%rax
0x534: cmp w8, #0x4
0x538: b.hi 0x10000054c
0x53c: adrp x9, 0x100000000
0x540: add x9, x9, #0x7d0
0x544: ldr w0, [x9, w8, UXTW #0x2]
0x548: ret
0x54c: mov w0, #0x0
.rela.rodata: five relocations
targets 0x91 0x88 0x7f 0x76 0x76
__const at 0x1000007d0
u32 values 1 2 3 4 4 · file offset 2000
jmpq *%rax reaches 5 blocks
8 blocks and 11 edges with the table
ldr returns one value
3 blocks · 2 edges · jump_tables []