Skip to content

compiler: move AST validation and symbol construction into native - #8996

Merged
marsninja merged 6 commits into
jaseci-labs:mainfrom
marsninja:compiler/native-early-analysis
Sep 6, 2026
Merged

compiler: move AST validation and symbol construction into native#8996
marsninja merged 6 commits into
jaseci-labs:mainfrom
marsninja:compiler/native-early-analysis

Conversation

@marsninja

@marsninja marsninja commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Run the existing ASTValidationPass and SymTabBuildPass in the native compiler kernel after parsing and annex weaving. Materialize the AST and symbol graph together, then consume typed PassResult records through the normal host pass driver so diagnostics, suppression, timing, and scheduling remain consistent.

Modules with wildcard imports defer symbol construction until dependency resolution; parsing without a known codespace retains the host schedule. Pass algorithms remain shared in passes/.

The migration also fixes shared backend infrastructure needed by these passes:

  • Query LLVM for ABI field offsets and materialize reference containers while preserving object identity.
  • Preserve inherited walker events and dynamic dispatch, cross-module type identity, union property access, and boxed reference lifetimes.
  • Share runtime kernel ownership and layout ordering, support string enum construction, and invalidate native caches when annexes change.

Chess compile measurements

Ten uncached AOT builds per kernel, two fresh-process batches each, two excluded warmups per batch, ordered baseline/new/new/baseline. Compiler startup is excluded; object emission and linking are included.

Median Parser-only kernel Early-analysis kernel
Full chess AOT build 3.646 s 3.537 s
AST validation 34.25 ms 11.22 ms
Symbol construction 38.19 ms 14.00 ms
Both passes combined 72.45 ms 25.04 ms

Observed median improvement: 3.0% overall, 2.9x for the migrated passes. Overall timing ranges overlap, so the total improvement is a local measurement, not a guaranteed speedup. Measurements used identical host source based on d5d6172cc, before rebasing onto the latest main and its additional compiler performance changes. The benchmark script and methodology are included.

Validation

  • Rebuilt the native compiler shared library.
  • 30 targeted compiler/backend tests passed; the corrected ASCII hash-vector test passed separately (31 checks total).
  • All 76 seed modules compiled under jac0.
  • Both generated chess executables completed an automatic game.
  • Rebased onto current main, retaining both placement-work and early-pass cache cleanup; git range-diff confirms this is the only conflict-resolution adjustment.
  • Post-rebase native/host symbol-graph parity and diagnostic-suppression smoke checks passed using the rebuilt kernel.
  • git diff --check passes.

The full suite and a complete packaged Jac binary rebuild were not run. Native Unicode string iteration remains byte-based; the hash regression covers the ASCII compiler type names used here.

@marsninja marsninja added the skip-no-python-check Skip CI check that blocks PRs adding new .py files label Sep 6, 2026
@marsninja marsninja removed the skip-no-python-check Skip CI check that blocks PRs adding new .py files label Sep 6, 2026
@marsninja
marsninja merged commit 82ad640 into jaseci-labs:main Sep 6, 2026
52 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant