vx-lang / vx-lang/Vx

[Meta] Cross-module .vxlib surface: what survives flat-model serialization end to end

Open
#293 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen tracking
Dominant language
Rust
Stars
14
Forks
2
Avg merge
12h 42m
Merged PRs (30d)
61

Description

Tracks what can cross a .vxlib boundary — the serialized flat-model interface ({frozen registry + flat HIR bodies}) that a downstream compile consumes without parsing the library's source.

Sibling of epic hiraditya/Vx.1#224. hiraditya/Vx.1#224 asks "can the stdlib stop being part of the AST?"; this issue asks the more general "which language constructs survive serialization end to end?". The stdlib is the most demanding consumer of that surface, so hiraditya/Vx.1#224 depends on this being broad enough — but the surface matters independently for any precompiled Vx library.

Verified state

Audited against e912fc70. Every row was run, not read: the library was compiled to a .vxlib, its source deleted, and the consumer compiled and JITed against the artifact alone. Verified through both --link-interface and bare import auto-resolution (VX_STD_PATH).

Surface State Owner
Functions — call, params, return ✅ runs (double(21) → 42)
Structs — construct, field read, return by value ✅ runs (→ 7)
Consumer outside the flat subset ✅ clean diagnostic, no ICE
Methodsc.get() on an imported type Method 'get' not found — serialized but never consulted hiraditya/Vx#219
Genericsident<T>(1) ❌ signature crosses, cannot instantiate hiraditya/Vx.1#221
Enums — payload-free, imported enum_variants empty on deserialize + flat emit declines hiraditya/Vx.1#274
Enums — data-carrying ❌ blocked upstream of serialization hiraditya/Vx.1#233
Traits / trait impls ❌ no trait_impls table in the registry at all hiraditya/Vx.1#218

The protocol itself is sound — two surfaces are fully runnable, versioned, and fail-closed on a stale artifact. What is missing is breadth, not design.

Codec state

serialize_registry_interface / deserialize_registry_interface (src/metadata.rs) cover module_indices, layouts, fn_sigs, methods, bodies, structs. Magic + FNV format hash; Err on bad magic, version mismatch, or truncation — never a silent misread. Round-trip and driver-level tests pass (9/9).

Note the split between serialized and usable: methods round-trips correctly but resolution never queries it, and generic signatures transport but do not substitute. "In the artifact" and "works across the boundary" are different questions, and most remaining gaps are on the second.

Correctness / infrastructure defects

Independent of coverage, both found while auditing this surface:

  • #291fixed (af73b993). Two artifacts defining the same type name collided silently in merge_from, first-wins on the name-keyed tables, non-deterministically (5/10 identical runs failed). structs is now GID-keyed so same-named structs coexist; fn_sigs/methods/enum_variants poison an import-vs-import conflict. Re-verified: 200/200 check-level and 60/60 JIT runs across both import orders, including the same-arity/different-field-type case that would previously have misread silently.
  • #292fixed (df192f10). --emit-interface now reports per-table encoded/skipped counts.
  • #294 — follow-up to hiraditya/Vx.1#291: a poisoned name is reported as Undefined function rather than as an ambiguity. The poisoned_* tombstones are written and never read outside registry.rs, so no diagnostic can tell "never defined" from "defined twice". Diagnostics only; methods/enum_variants inherit it the moment hiraditya/Vx#219/#274 make them reachable.

Suggested order

  1. #291 and #292 are done. hiraditya/Vx.1#294 (the poisoned-name diagnostic) is cheap and worth doing before hiraditya/Vx#219/#274, since those make two more poisoned tables reachable and each would otherwise inherit the same misleading message.
  2. #219 — the method flip. Highest value-per-effort: the dual-run gate at src/hir/check/calls.rs:1249-1278 already asserts, across the whole suite, that the registry resolves every concrete non-generic method the AST does. The oracle is proven; only consuming it remains.
  3. #274 (enums) and #221 (generic monomorphization) — the substantive coverage work.
  4. #218 (trait_impls) — needed for trait-dispatch-heavy stdlib modules.
  5. #220's std.vxlib build step — deliberately last. It is mostly plumbing (nothing under stdlib/ is precompiled today and no build rule produces it), but a precompiled stdlib is only useful once methods/generics/traits cross, and only safe now that hiraditya/Vx.1#291 and hiraditya/Vx#292 have landed.

Related

  • Epic hiraditya/Vx.1#224 (stdlib decoupling) — the primary consumer of this surface.
  • hiraditya/Vx.1#197 / hiraditya/Vx.1#201 — the flat pipeline; the artifact is the same flat HIR the flat codegen consumes, so coverage here tracks flat-codegen coverage.
  • hiraditya/Vx.1#242, hiraditya/Vx.1#233 — flat-codegen surfaces (generic aggregates, tagged-union enums) that gate what can be serialized at all.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the suggested follow-up order, especially src/hir/check/calls.rs:1249-1278 and the registry interface code in src/metadata.rs. Run the existing dual-run and driver-level tests to understand the verified flat-model boundary. Done means the remaining listed surfaces work from a serialized .vxlib with the source removed, with diagnostics and coverage updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.