Skip to content

Commit 264a753

Browse files
Update roadmap with accurate cross-platform analysis and LSP consolidation plan
Replace vague 'macOS/Windows syscalls' checklist with detailed analysis: syscalls are 100% manual inline assembly (not LLVM-handled), hardcoded to Linux x86-64 ABI. Document 5-phase approach from target detection through Windows NTAPI support. Add LSP consolidation section noting ~1,500 LOC of duplication across 8 type inference implementations. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent d65848b commit 264a753

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

docs/ROADMAP.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,44 @@ vec.iter().map(fn).filter(fn).collect()
4949
Currently only specialized methods work (sum, product, min, max).
5050

5151
### 3. Cross-Platform Support
52-
- [ ] macOS syscalls
53-
- [ ] Windows syscalls
5452

55-
### 4. Remaining Type System Cleanup
53+
**Current state:** Syscalls are 100% manual — the compiler generates inline x86-64
54+
assembly (`syscall` instruction with rax/rdi/rsi/rdx/r10/r8/r9 register convention).
55+
LLVM provides zero platform abstraction for this. Every stdlib file using I/O,
56+
networking, threading, or memory-mapping depends on Linux x86-64 syscall numbers
57+
hardcoded in `stdlib/sys/syscall.zen`.
58+
59+
**What needs to change per platform:**
60+
61+
| Platform | Syscall Numbers | Registers | Instruction | Effort |
62+
|----------|----------------|-----------|-------------|--------|
63+
| Linux ARM64 | Different | x0-x7 | `svc #0` | Medium |
64+
| macOS x86-64 | Different (exit=1 not 60) | Same | `syscall` | Medium |
65+
| macOS ARM64 | Different | x0-x7 | `svc #0x80` | Medium-high |
66+
| Windows | N/A — uses NTAPI | Completely different | No `syscall` | Very high |
67+
68+
**Phased approach:**
69+
70+
- [ ] **Phase 1: Target detection** — Query LLVM target triple, route to platform-specific codegen in `build_syscall()`
71+
- [ ] **Phase 2: Linux ARM64** — Easiest win. Same syscall concept, different ABI. Create `syscall_aarch64.zen` with ARM64 numbers, modify `build_syscall()` for `svc #0` + x0-x7 registers
72+
- [ ] **Phase 3: macOS** — Create `syscall_macos.zen`. Note: Apple discourages raw syscalls (numbers change between versions), long-term should FFI to libSystem
73+
- [ ] **Phase 4: Windows** — Architectural change. No raw syscalls — needs NTAPI via FFI (`ntdll.dll`/`kernel32.dll`). Essentially a separate I/O backend
74+
- [ ] **Phase 5: Stdlib abstraction layer** — Platform-independent I/O/threading/memory API in stdlib that dispatches to OS-specific implementations
75+
76+
**Files affected:** `src/codegen/llvm/stdlib_codegen/compiler.rs` (build_syscall), `src/intrinsics.rs`, `stdlib/sys/syscall.zen`, and every stdlib file using `compiler.syscall*()` (~15 files across io/, sys/, concurrency/, memory/)
77+
78+
### 4. LSP Consolidation
79+
80+
The LSP is 16,399 LOC across 55 files — reasonable for a full-featured LSP with
81+
compiler integration (rust-analyzer is 150K, gopls 50K), but has ~1,500 LOC of
82+
consolidation opportunities:
83+
84+
- [ ] **Consolidate type inference** — 8 separate files duplicate Expression-matching logic (~500 LOC savings)
85+
- [ ] **Merge hover submodules** — 9 files → 4 files (~250 LOC savings)
86+
- [ ] **Merge document_store submodules** — 9 files → 4 files (~250 LOC savings)
87+
- [ ] **Error handling macros** — Replace 50+ verbose lock/parse patterns (~150 LOC savings)
88+
89+
### 5. Remaining Type System Cleanup
5690
- Replace remaining string-based type checks (~10 locations)
5791
- Create TypeAliasRegistry for StaticString/String normalization
5892
- Implement generic type substitution in stdlib method resolution

0 commit comments

Comments
 (0)