Commit 4022a61
committed
fix: register zyntax_box_* runtime symbols + correct LLVM Call::Symbol return type
When the SSA-lowering autobox / autounbox path for `Type::Any`
fields emits `Call::Symbol("zyntax_box_X")` or `..._get_X`, two
things had to be in place that weren't:
1. The runtime had to know those symbols. `ZyntaxRuntime::new`
already registers `__zyntax_effect_*` up front; mirror that
for the box helpers in a new `register_box_runtime_symbols`
in `effect_runtime.rs`. Each symbol goes to (a) the
Cranelift backend's runtime-symbol table via
`register_function_typed`, (b) the plugin-signatures table
(so the LLVMBackend's per-symbol boxing decisions see the
right param types), and (c) the BC interp's FFI table via
`register_zrtl_symbols`. Without (c) the interp tier panicked
with "unknown function 'zyntax_box_X'" the moment a hot path
resolved through it. Plus added the missing
`zyntax_box_get_{i32,f32,f64,bool}` runtime helpers in
`zrtl.rs` alongside the existing `_i64`.
2. The LLVMBackend's `Call::Symbol` path defaulted to
`void(args) → i32 0` whenever the symbol's signature wasn't
in `symbol_signatures` — and the interp_runtime LLVM install
path only forwarded the raw symbol pointers, not the
signatures. Two changes:
- `install_jit_with` now calls
`be.register_symbol_signatures(&box_infos)` so the LLVM
JIT sees the box helpers' real types.
- `LLVMBackend::compile_call`'s Symbol arm now respects
`sig_info.return_type` when present — picks an LLVM scalar
type matching the `TypeTag` category/size (mirrors
`type_tag_to_cranelift_type`). Without this, unboxing an
f64 still surfaced an "i32 0" placeholder that crashed
downstream FAdd / FSub.
`bench_any_field` round-trips an f64 through an `Any` field 1M
times under the LLVM tier and returns the correct `Int(1500000)`.
All other kernels unchanged.
Followup: explicit `X as Any` / `Any as T` cast plumbing is a
separate piece — wired the helpers but the typed-AST surfacing
of `cast.expr.ty` made it double-convert in the current shape.
The field-load autobox/autounbox already covers the
`let v: T = b.payload` ergonomic the user actually hits.1 parent efe009e commit 4022a61
6 files changed
Lines changed: 606 additions & 24 deletions
File tree
- crates
- compiler/src
- zyntax_embed/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3235 | 3235 | | |
3236 | 3236 | | |
3237 | 3237 | | |
3238 | | - | |
3239 | | - | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
| 3267 | + | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
3240 | 3284 | | |
3241 | 3285 | | |
3242 | 3286 | | |
3243 | 3287 | | |
3244 | 3288 | | |
3245 | 3289 | | |
3246 | | - | |
3247 | | - | |
3248 | | - | |
3249 | | - | |
3250 | | - | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
3251 | 3303 | | |
3252 | 3304 | | |
3253 | 3305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4470 | 4470 | | |
4471 | 4471 | | |
4472 | 4472 | | |
4473 | | - | |
| 4473 | + | |
4474 | 4474 | | |
4475 | 4475 | | |
4476 | 4476 | | |
| |||
4484 | 4484 | | |
4485 | 4485 | | |
4486 | 4486 | | |
4487 | | - | |
4488 | | - | |
4489 | | - | |
4490 | | - | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
| 4499 | + | |
| 4500 | + | |
| 4501 | + | |
| 4502 | + | |
| 4503 | + | |
4491 | 4504 | | |
4492 | 4505 | | |
4493 | 4506 | | |
| |||
7505 | 7518 | | |
7506 | 7519 | | |
7507 | 7520 | | |
7508 | | - | |
7509 | | - | |
7510 | | - | |
7511 | | - | |
7512 | 7521 | | |
7513 | 7522 | | |
7514 | 7523 | | |
| |||
7517 | 7526 | | |
7518 | 7527 | | |
7519 | 7528 | | |
7520 | | - | |
7521 | 7529 | | |
7522 | 7530 | | |
7523 | 7531 | | |
| |||
7526 | 7534 | | |
7527 | 7535 | | |
7528 | 7536 | | |
7529 | | - | |
7530 | | - | |
7531 | | - | |
| 7537 | + | |
| 7538 | + | |
| 7539 | + | |
| 7540 | + | |
| 7541 | + | |
| 7542 | + | |
| 7543 | + | |
| 7544 | + | |
| 7545 | + | |
| 7546 | + | |
| 7547 | + | |
| 7548 | + | |
| 7549 | + | |
| 7550 | + | |
| 7551 | + | |
| 7552 | + | |
7532 | 7553 | | |
7533 | | - | |
| 7554 | + | |
7534 | 7555 | | |
7535 | 7556 | | |
7536 | 7557 | | |
| |||
7543 | 7564 | | |
7544 | 7565 | | |
7545 | 7566 | | |
7546 | | - | |
| 7567 | + | |
7547 | 7568 | | |
7548 | 7569 | | |
7549 | 7570 | | |
7550 | 7571 | | |
7551 | 7572 | | |
7552 | 7573 | | |
7553 | | - | |
| 7574 | + | |
7554 | 7575 | | |
7555 | 7576 | | |
7556 | 7577 | | |
7557 | 7578 | | |
7558 | 7579 | | |
7559 | 7580 | | |
7560 | 7581 | | |
7561 | | - | |
| 7582 | + | |
7562 | 7583 | | |
7563 | 7584 | | |
7564 | 7585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1760 | 1760 | | |
1761 | 1761 | | |
1762 | 1762 | | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1763 | 1789 | | |
1764 | 1790 | | |
1765 | 1791 | | |
| |||
0 commit comments