Repository navigation
feat: run the compiler on a 128 MiB stack and restore recursive traversals - #43
Merged
Merged
Conversation
…ser nesting limit Signed-off-by: microproofs <kwhitemsg@gmail.com>
Signed-off-by: microproofs <kwhitemsg@gmail.com>
Signed-off-by: microproofs <kwhitemsg@gmail.com>
…rsion, and target validation Signed-off-by: microproofs <kwhitemsg@gmail.com>
Signed-off-by: microproofs <kwhitemsg@gmail.com>
…ewrite, and recursion rewrite Signed-off-by: microproofs <kwhitemsg@gmail.com>
Signed-off-by: microproofs <kwhitemsg@gmail.com>
Signed-off-by: microproofs <kwhitemsg@gmail.com>
Signed-off-by: microproofs <kwhitemsg@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Compiler work now runs on threads with a 128 MiB stack, and the traversals that #39 converted to heap work lists recurse again. The branch also fixes the CBOR encoding of large negative Data integers, removes unused compiler helpers and adds Nash tests to the vesting example. Nine commits, nine changesets.
Behavior changes:
Space::TooDeeperror are removed.-(2^64 - 1)have a different CBOR encoding, and tag 3 payloads decode to a different value. See the fix below.Versioning: minor bumps for
nash-driver,nash-parse,nash-test,nash-constrainandnash-report; patch fornash-cli,nash-plutus,nash-irandnash-codegen. See.sampo/changesets/.Compiler stack (
feat(driver): run compiler work on a 128 MiB stack and remove the parser nesting limit)nash_driver::stackmodule:COMPILER_STACK(128 MiB) andrun, which executes a closure on a new scoped thread with that stack and resumes a panic from the work.nash-parseloseswith_depth, thedepthanddepth_errorparser state anderror::Space::TooDeep.nash-reportloses the matching variant and its snapshot.crates/nash-driver/tests/stack.rscompiles a module with 4,000 nested parentheses. That depth overflows a 2 MiB thread in a debug build.Recursive traversals restored
Four commits convert heap work lists back to recursion, in the shape of the Elm and imported code. Together they remove about 630 lines.
restore the recursive Flat term encoder and decoder).encode_termanddecode_termrecurse again.nash testdecodes programs on its worker pool, sonash_test::Configgainsworker_stackand the CLI gives those workers the compiler stack.restore the recursive UPLC printer, De Bruijn conversion, and target validation).pretty::term,to_debruijnandvalidate_*.restore the recursive Core traversals).walk,map, occurrence and free-variable analysis, discard checks, hygiene, ANF, beta splicing and Core printing innash-ir.restore the recursive lowering, constant-sharing rewrite, and recursion rewrite).The work lists that the stack audit lists under "Reproduced failures" and that these commits do not name stay as they are.
Data integer fix (
fix(plutus): encode and decode negative Data big integers as -1 - n)-1 - n(RFC 8949, section 3.4.3). The decoder read the payload as-n, and the encoder wroten.-2^64is now a plain negative integer (3bffffffffffffffff), not a tagged big integer.Maintenance
remove unused compiler helpers and ignored parameters). Removes database dependency bookkeeping andDepGraph::depends_on, unused report and type helpers, and theFailureKindalias. Removes ignored private parameters in config parsing, import resolution and destructuring projection.finish compiler maintenance and verify LSP root compatibility).iterated_dealiasis a loop, as Elm's version is tail recursive. The private evidence helper loses duplicate representation-superclass handling; public evidence validation stays. A new language server snapshot covers theroot_urifallback, workspace folder priority and the clearing of prior roots.Examples, dependencies and plan documents (
update vesting example)examples/vesting/app/src/VestingTests.nashcalls both validator entry points with synthetic V3 contexts. It checks claim deadline boundaries, owner and non-owner cancellations, and the parameterized minimum lock. The README gives the command.examples/orderbuilds again: thenash/basedependency entry is removed andnotcomes fromLogic.zipdependency drops Bzip2 support, sobzip2-sysis no longer built. All other ZIP features and XZ extraction stay.docs/macros.md,plans/11-macros-comptime.mdandSPEC.mdrecord the Plan 11 sequence, the source location contract and the chunk 15 property and assertion migration. These are document changes only.Documents
docs/overview.mdanddocs/codegen.mddescribe the stack model in place of the nesting limit and the work lists.docs/research/compiler-stack-audit.mdhas a new "Stack model" section that supersedes the work-stack direction, and a "Maintenance cleanup" section.docs/frontend-hardening-verification.mdnotes that the nesting bound is removed.Not in this PR
Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo nextest run --workspacecargo check --manifest-path tools/optimizer-perf/Cargo.tomlcargo run -p nash-cli -- test examples/vesting