Skip to content

module style 5: add introspective constants#346

Merged
prozacchiwawa merged 78 commits intomainfrom
20260217-introspective-constants
May 7, 2026
Merged

module style 5: add introspective constants#346
prozacchiwawa merged 78 commits intomainfrom
20260217-introspective-constants

Conversation

@prozacchiwawa
Copy link
Copy Markdown
Contributor

@prozacchiwawa prozacchiwawa commented Feb 17, 2026

Note

High Risk
High risk because it changes core code generation, environment shaping, and constant evaluation ordering for module compilation, which can affect determinism and correctness of produced CLVM across many programs.

Overview
Enables module-style introspective constants by introducing ModulePhase (common phase, standalone export phase, and constant-evaluation phase) and threading it through CompilerOpts and PrimaryCodegen, changing how env shapes are built, finalized, and how exported functions are lambda-wrapped.

Reworks constant and helper generation in codegen to produce a stable env first, then evaluate module constants in a dependency-driven order (with convergence checks), and updates deinlining/funcache behavior to include constant dependencies for module compiles and to document cache-key invariants.

Adds new module test fixtures and extensive new tests for determinism, cache hit/miss behavior, @ form validation, and constant-cycle failure, plus a new GitHub Actions workflow that builds/tests this repo against chia-gaming (including a tempfile downgrade and helper scripts to patch and run chia-gaming’s CLSP test suite).

Reviewed by Cursor Bugbot for commit 3f308fc. Bugbot is set up for automated code reviews on this repo. Configure here.

@prozacchiwawa prozacchiwawa changed the base branch from 20260216-freeze-early-cache to 20260224-codegen-function-cache March 3, 2026 00:48
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/mod.rs
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/codegen.rs
Comment thread src/compiler/compiler.rs
Comment thread src/compiler/mod.rs
Comment thread src/compiler/codegen.rs Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 7 total unresolved issues (including 6 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0f86cfe. Configure here.

Comment thread src/compiler/compiler.rs
@prozacchiwawa prozacchiwawa merged commit aa012b4 into main May 7, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants