compiler: add -O0/-O2 flags, -v 1..4, whole-word JIT, lazy init, auto-inline control

- Add -O0 (no opts) and -O2 (no opts + no checks) CLI flags
- Add -v 1..4 verbosity: timing, per-function stats, debug dump, optimization diffs
- Whole-word JIT: compile Definition bodies to native x86-64 for CT VM
- Lazy CTMemory/JIT/ctype init (defer ctypes until first CT execution)
- Stack-effect comment parsing for stack-checks
- Peephole rules refactored to module-level dicts with O(1) lookup
- _emitted_start short-circuit (O(1) vs O(n) scan)
- Add --no-auto-inline to disable auto-inlining of small asm bodies
- Fix --ct-run-main to execute after linking (prevent SIGSEGV)
- Stdlib: small optimizations like swap + drop -> nip
This commit is contained in:
igor
2026-03-09 14:04:45 +01:00
parent 819e451512
commit 2a1ae2f774
3 changed files with 1820 additions and 767 deletions

View File

@@ -9,7 +9,7 @@ word alloc
-1 # fd
0 # offset
mmap
swap drop
nip
end
#free [*, addr | size] -> [*]
@@ -38,8 +38,7 @@ word memcpy
c!
swap
end
swap
nip
drop
r> dup -rot - swap
end