WIP: v0.19 advanced type system #1507

Draft
vyzo wants to merge 126 commits from v0.19-typed-gerbil into v0.19-staging
Owner
No description provided.
vyzo requested reviews from fare, jay 2026-09-21 22:05:33 +00:00
vyzo added 14 commits 2026-09-22 17:11:32 +00:00
Generated from source commit 1352ed3958 (source changes verified before committing).

Validated sequential rebootstrap, boot-clean, stage0, stage1, stdlib and tools with eight build cores. Post-rebuild: 21 focused control/return-inference/nullable cases passed, plus the separately compiled nine-case control suite. Tests used memory/time limits.
Generated from source commit f38c48bdb2 (source changes verified before committing).

Validated sequential rebootstrap, boot-clean, stage0, stage1, stdlib and tools with eight build cores. Post-rebuild: 32 focused cases passed, plus the separately compiled eleven-case sugar/interface suites. Tests used memory/time limits.
Generated from source revision e9962b1a12 using the accepted 15c8aa3f bootstrap. Validated sequential clean stage0/stage1/stdlib/tools rebuild, 36 focused cases, and 27 compiler regression cases.
vyzo added 100 commits 2026-09-30 21:37:09 +00:00
Generated from source revision 9a88919cf0 using the accepted 2f938b6a bootstrap. Validated clean stage0/stage1/stdlib/tools rebuild and all 76 focused/regression cases, including native direct-versus-IR round-trip fixtures. The new pass remains opt-in.
Generated from source revision 5c134fa79e using accepted bootstrap 784f1f87. Clean stage0/stage1/stdlib/tools validation and all 78 regression cases passed. The later test-only qualification cleanup passed the 15-case flow suite without rebuilding.
Generated from source revision 32408b9d49 using accepted bootstrap 001cba7b. Validated clean stage0/stage1/stdlib/tools rebuild and all 83 regression cases, including 5,184 differential AST/IR comparisons. Syntax rewriting remains opt-in; per-query analysis allocation remains a profiling follow-up.
Reject the structural-cache prototype: pinned optimizer-only measurements show no useful speedup. Keep the accepted compiler and bootstrap unchanged, document reproducible profiling and the annotation-pass hotspot, and retain two freshness/revalidation regressions. All 85 focused cases passed after restoring the compiler.
Generated from source revision 13e089fa2a using accepted bootstrap 941a4ea8. Clean stage0/stage1/stdlib/tools rebuild and all 89 focused regression cases passed. Pinned optimizer-only measurements retained the approximately 28% improvement on optimize-ann.ss after the clean bootstrap.
Generated from source revision 0e96d3b13a using accepted bootstrap 7776f39f. Clean stage0/stage1/stdlib/tools rebuild and all 95 focused cases passed. Pinned post-bootstrap optimize-ann measurements show approximately 36% less optimizer time and 13% less allocation; gxpkg remains essentially unchanged. Only raw substitutions are reused, never branch-sensitive optimized bodies or inferred facts.
Generated from source revision edaa24b2d8 using accepted bootstrap 8312c66a. Sequential clean stage0/stage1/stdlib/tools gate and all 106 focused cases passed. The value-routing view and rewriting remain opt-in; production normal-path analysis is unchanged. Default optimizer probes remain comparable on optimize-ann and gxpkg. No module inventories changed.
Source and validation: dc865ec7. Clean stage0/stage1 and dependent builds passed; post-bootstrap core/stdlib tests passed with the agreed static-link and ensemble.TODO exclusions.
Replace generic framing with the approved source policy and enclosing-location fallback. Audit pattern, clause and binding-group codecs; preserve research probes and evidence for 444 passing source/generation cases.

Record post-cutover compiler-owned contracts and interface dispatch, compile-time rejection of proven violations, untyped bidirectional inference, and fixed-size heterogeneous vector types. No product or bootstrap changes.
Add the 29-case module payload probe, runner registration, codec notes, and archived evidence for the 15-probe / 505-case research suite. Preserve failed fixtures and provenance separately from the IR implementation.
Implement typed immutable IR records, strict annotation codecs, lexical and phased lowering, shared module ownership, optional verification, and reification with checked publication. Preserve opaque user annotations and source identity. Register the modules after optimize-base in all build inventories.

Validation: incremental stage1 build and all 63 IR conversion cases pass. Conversion-only core and stdlib corpus acceptance remains pending.
Represent case-lambda arms as registered lambda nodes, tighten procedure typing, and preserve foreign syntax tails and inline-rule quote payloads. Extend focused regression coverage and record symbolic dispatch and ListTuple design decisions.
Compile core and stdlib modules in shared sessions and compare generated artifacts structurally, accounting for compiler timestamps and generated symbol identities. Record the completed corpus gate and subsequent focused verification.
Add captured binding and scope infrastructure, compiler assertions, IR traversal and transforms, explicit descriptor/session state, and general expression inference backed by the canonical CFG.

Preserve legacy facades, record the remaining migration work, and align source and bootstrap module inventories in dependency order.

Validation: focused source suites passed 207 cases and 14302 checks in separate processes. Bootstrap and native rebuild remain deferred until after cutover.
Capture the complete candidate IR optimizer, typed descriptor interfaces,
binding construction and relocation, metadata emission, and driver/build
integration. Include the isolated validation harness and final review fixes
for unchanged transforms, obsolete arena records, callable remapping, and
compilation failure handling.

Validated with 15 source suites (240 cases, 14,557 checks), a subsequent
22-case/162-check ownership gate, seven compiler-module emission checks,
and fresh-process execution of the emitted flow fixture. Preserve evidence
and record cutover as pending. Native/bootstrap validation and direct IR
backend emission remain subsequent milestones.
Generated with the recovered stage1 compiler. Validated with boot-clean followed by stage0, stage1, stdlib, libgerbil and tools builds.
Use explicit IR environments and worker-session metadata in compiler tests. Count checked and unchecked class predicates without changing folding expectations. Record runtime bootstrap recovery and clean native validation, including the missing static-library limitation.
Separate semantic call optimization, runtime helper lowering, and final unchecked
call lowering. Default to two bounded call sweeps, refreshing analysis only as
needed and collecting inline declarations once on the final descriptors.

Join mutable binding types across initializers and assignments, retain common
procedure returns without preserving unsafe dispatch claims, and track refinement
changes explicitly. Cover phase-1 initializers and avoid lazy mutable-cell seeds.

Remove unused IR records and production AST snapshots, index inline rules by
canonical descriptors, and render diagnostic provenance through source syntax.
Add regressions and record sweep measurements and native validation evidence.
Generate the bootstrap from source commit bd7488e5, including the simplified IR,
mutation bounds, staged inline lowering and two-sweep call optimization default.
Keep generated artifacts separate from the source changes.

Validation: stage0 and stage1 self-compilation, stdlib, libgerbil and tools all
rebuilt successfully. Artifact audits passed and the native compiler reports the
two-sweep default. Active stdlib passes 766 cases / 72076 checks. Gerbil passes
442/444 cases and 11228/11230 checks; only the two previously recorded static-link
failures remain, due to absent crypto, ssl, z and sqlite3 archives.
Normalize union alternatives and support subtype/disjointness proofs, compound
annotations and signatures, and SSXI projection and reload. Preserve distinct
callable summaries and keep calls through unions checked. Expose a precise join
separately from the existing nominal inference joins.

Validation: focused source suites pass 172 cases and 3214 checks. Core, stdlib,
libgerbil, and tools rebuilds pass. Full stdlib passes 766 cases and 72076 checks;
Gerbil passes 450/452 cases and 11404/11406 checks, with only the two recorded
missing-static-library failures. Include validation evidence and source hashes.
Validate declarations, returns, and known calls without requiring optimization. Require versioned compiled interfaces, reuse completed source-dependency SSXI, and preserve public wrapper result bounds.

Track SSXI in incremental builds, remove obsolete generation state, and cover baseline compilation and metadata failures. Record clean bootstrap self-build, assertion timings, and full-suite results; only the two existing host static-link failures remain.
Generated from source checkpoint 35630d48 with compiler assertions enabled. Fresh stage0 and clean stage1 self-compilation passed, followed by stdlib, libgerbil, tools, and full-suite validation.

All stdlib tests pass; Gerbil retains only the two known host static-link failures. Generation hashes and validation evidence are recorded in the source checkpoint.
Run isolated source workers and release dependents only after every phased
output and semantic interface is complete. Reuse compiler-driver native jobs,
prefer newer Scheme source over stale native objects, and retain pending
markers and diagnostics for failed builds.

Join workers cooperatively, return native slots on failure, honor explicit
native concurrency, and preserve companion-file build options. Preserve the
originating syntax context for inherited private slot types.

Validation: 773 stdlib cases and 72,135 checks passed. Gerbil retained only its
two known missing-static-archive failures. Focused tests passed with one and
eight cores; real artifact deletion rebuilt exactly six modules and the next
build was a no-op. Process-based ordinary and optimized executables passed.
Compile authored builtin metadata once and emit versioned .ssxi data for all modules. Decode declarations directly into isolated compiler sessions, preserve primitive signatures and literal rules, and migrate build outputs and incremental checks.

Validate with a fresh bootstrap, dependent builds, full suites, and artifact-removal rebuilds. Record pinned probes showing 40-44x faster metadata loading; retain the two known host static-link test failures in the evidence.
Include the compiled builtin artifact and plain module metadata. Stage0, stage1/BACH, stdlib, libgerbil and tools build without legacy metadata loading; validate Gerbil and stdlib suites and incremental recovery.
Collect procedure names with a weak creator cache, guard nested sampling, and capture before installing cleanup frames. Verify eager and deferred sampling, analyzer compatibility, and cleanup after exceptions.
Use the base prelude for compiler and expander consumers, inline small hash wrappers, and preserve intermediate slot types so chained interface calls eliminate redundant casts. Export the implicit application hooks from the protobuf prelude.

Use immediate tables for generated IR IDs, guard exhaustion and malformed IDs, and record source/native performance baselines. Bootstrap source compilation improves about 2.3% in pinned controls. All 774 active stdlib cases pass; Gerbil has only its two existing missing-static-library failures. Generated bootstrap follows separately.
Regenerate from f4609b9f, compile stage0, and use it to self-compile all 70 core modules to Scheme and semantic interfaces. Post-bootstrap validation passes all 774 active stdlib cases; Gerbil retains only its two existing missing-static-library failures.
vyzo added 10 commits 2026-10-01 16:45:25 +00:00
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin v0.19-typed-gerbil:v0.19-typed-gerbil
git switch v0.19-typed-gerbil

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch v0.19-staging
git merge --no-ff v0.19-typed-gerbil
git switch v0.19-typed-gerbil
git rebase v0.19-staging
git switch v0.19-staging
git merge --ff-only v0.19-typed-gerbil
git switch v0.19-typed-gerbil
git rebase v0.19-staging
git switch v0.19-staging
git merge --no-ff v0.19-typed-gerbil
git switch v0.19-staging
git merge --squash v0.19-typed-gerbil
git switch v0.19-staging
git merge --ff-only v0.19-typed-gerbil
git switch v0.19-staging
git merge v0.19-typed-gerbil
git push origin v0.19-staging
Sign in to join this conversation.
No description provided.