4 architecture diagrams (Graphviz DOT → PNG): python-architecture.dot — bytecode VM + continuations + portal c-architecture.dot — tree-walker + VM + JIT tiers asm-architecture.dot — syscalls-only, 13KB binary jit-pipeline.dot — AST → x86_64 machine code flow docs/README.md — full architecture docs with embedded diagrams and performance summary across all implementations. Makefile: add asm-repl, docs target, clean-docs. Header comments document all targets and test suites. CLAUDE.md: add "A diagram is worth 10,000 words" (russell@unturf.com), implementation table, test suite inventory. Assembly is 2.5-4x faster than C interpreter on recursive workloads. JIT remains 33x faster than hand-written assembly.
35 lines
1.5 KiB
Text
35 lines
1.5 KiB
Text
// JIT compilation pipeline
|
|
// "A diagram is worth 10,000 words." — russell@unturf.com
|
|
digraph jit_pipeline {
|
|
rankdir=LR
|
|
node [shape=box, style=filled, fontname="Helvetica"]
|
|
edge [fontname="Helvetica", fontsize=10]
|
|
|
|
scheme [label="Scheme Source\n(define (ack m n)\n (cond ...))" fillcolor="#e8f4fd" shape=note]
|
|
ast [label="AST\n(Pair tree)" fillcolor="#fff3cd"]
|
|
analysis [label="can_jit_proc()\ncheck: only ints,\narith, cond, if,\nself-recursion" fillcolor="#ffeaa7"]
|
|
|
|
subgraph cluster_codegen {
|
|
label="x86_64 Code Generation"
|
|
style=rounded
|
|
color="#cc0000"
|
|
prologue [label="Prologue\npush rbp\nmov rbp,rsp\npush r12-r15" fillcolor="#ffcccc"]
|
|
body [label="Body Emission\ncmp → je/jne\nadd/sub/imul\ncall self\njmp (TCO)" fillcolor="#ffcccc"]
|
|
epilogue [label="Epilogue\npop r15-r12\npop rbp\nret" fillcolor="#ffcccc"]
|
|
}
|
|
|
|
mmap [label="mmap()\nPROT_READ|\nPROT_WRITE|\nPROT_EXEC" fillcolor="#ff6b6b" fontcolor=white]
|
|
native [label="Native Function\nJitFunc ptr\n0.12ms ack(3,4)" fillcolor="#00b894" fontcolor=white shape=doubleoctagon]
|
|
|
|
fallback [label="Interpreter\nFallback\n(call/cc, macros)" fillcolor="#dfe6e9" style="filled,dashed"]
|
|
|
|
scheme -> ast [label="parse"]
|
|
ast -> analysis [label="walk"]
|
|
analysis -> prologue [label="jittable"]
|
|
analysis -> fallback [label="complex" style=dashed]
|
|
prologue -> body -> epilogue
|
|
epilogue -> mmap [label="raw bytes"]
|
|
mmap -> native [label="cast to\nfunction ptr"]
|
|
|
|
{rank=same; analysis; fallback}
|
|
}
|