Commit 5eafe20
Session D.5: extract CLI to omnimcode-cli, wire OMC_HBIT_JIT=1
Move src/main.rs out of omnimcode-core (where it couldn't depend
on omnimcode-codegen without a workspace cycle) into a new
omnimcode-cli package that depends on both. The shipped binary
name is preserved (omnimcode-standalone) so scripts that invoke
it keep working.
What `OMC_HBIT_JIT=1` does now (with `--features llvm-jit`):
- Compile the parsed program to bytecode
- JIT-lower every user fn in dual-band mode; silently skip ones
the codegen can't yet handle (strings/dicts/cross-fn calls)
- Register a dispatch closure on the Interpreter that routes
matching user-fn calls through the native fn pointer
- Run the program tree-walk-as-usual; the dispatch hook
short-circuits to native for the JIT'd fns
Smoke test verifies: `OMC_HBIT_JIT=1 omnimcode-standalone f.omc`
correctly JITs `double`, `factorial` (recursive), `sum_to`
(while-loop with locals), and runs them at native speed (timing
in Session E).
Three release-build fixes were needed:
1. Workspace [profile.release] had `lto = "fat"` + `strip = true`.
That combination causes LLVM JIT to segfault during
JitContext::new because MCJIT does dlopen-style symbol lookup
against the binary, and aggressive LTO + stripping scrubs
those symbols. Changed to `lto = "off"`, `strip = "debuginfo"`,
`codegen-units = 16`. Mild release-perf hit, JIT works.
2. jit_module was interleaving lower-then-extract per fn. That
triggers JIT finalization on a partially-populated module and
FunctionNotFound on the next recursive reference. Switched to
two-phase: lower ALL eligible fns first, then extract fn
pointers from the now-complete module.
3. extract_raw_fn_ptr failures inside jit_module no longer
propagate via `?` (which aborted the whole JIT registry).
Per-fn errors now skip that fn and continue; tree-walk
handles the skipped fn.
Help text updated: `omc --help` now documents `OMC_HBIT_JIT=1`
and `OMC_HBIT_JIT_VERBOSE=1`.
Workspace state: 149 omnimcode-core unit tests pass, 19 codegen
tests pass, 18 OMC harmonic-lib tests pass, smoke test green
in both tree-walk and JIT modes with identical output.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 41992c2 commit 5eafe20
6 files changed
Lines changed: 175 additions & 19 deletions
File tree
- omnimcode-cli
- src
- omnimcode-codegen/src
- omnimcode-core
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
25 | 39 | | |
26 | 40 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
Lines changed: 98 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
100 | 194 | | |
101 | 195 | | |
102 | 196 | | |
| |||
504 | 598 | | |
505 | 599 | | |
506 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
507 | 604 | | |
508 | 605 | | |
509 | 606 | | |
| |||
649 | 746 | | |
650 | 747 | | |
651 | 748 | | |
| 749 | + | |
652 | 750 | | |
653 | 751 | | |
654 | 752 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 208 | + | |
212 | 209 | | |
213 | 210 | | |
214 | 211 | | |
| |||
222 | 219 | | |
223 | 220 | | |
224 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
225 | 234 | | |
226 | 235 | | |
227 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 12 | | |
17 | 13 | | |
18 | 14 | | |
| |||
0 commit comments