Repository navigation
feat(ir): read format 3 text and bound verification resources - #241
Merged
LunaStev merged 2 commits intoOct 7, 2026
Merged
Conversation
3 tasks
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.
Typed IR printed by Wave and Whale could not be read back, and deeply nested Rust IR inputs could abort their host during verification. This change adds a verified format 3 reader and bounds the type/signature and constant-expression paths used by direct frontend integrations.
Reader and CLI
parse_module/parse_module_with_limits, locatedParseErrordiagnostics, a bounded UTF-8 lexer and strict typed syntax. Require IR format 3 / semantics version 1; reject unsupported versions, unknown fields/opcodes/escapes, conflicting annotations, invalid literals and trailing input. Semantic verification remains mandatory.//comments canonicalize.whale ir verify input.wirandwhale ir print input.wir [-o output.wir]available in the default build. AST format 2lowerstill requires socket-cli. Keep target rejection before input reads, feature recovery status, and atomic output/input-alias protection. Invalid options now fail explicitly; remove advertised flags that never did anything.parserconflicted with Wave's existing parser crate when importingwhale_ir::*.Verification limits
IrLimitsdefaults to 8 MiB input, 1,000,000 tokens/traversal nodes and type/constant depths of 128 (root 0). Depths can be lowered or raised through 256; larger configurations return a structured error. Iterative preflight covers all module type annotations and expressions before recursive cloning/equality/diagnostics. Signature validation and constant evaluation use explicit work stacks. Checked declaration and null-function APIs dispose of rejected owned signatures iteratively; callee signatures are checked before cloning.Expose limit-aware verification, constant evaluation, signature validation and checked declaration APIs. Preserve wrapping arithmetic, exact stored float results, left-to-right references, dependency resolution and cycle diagnostics. Budgets count work at each boundary, not elapsed time or all allocations. Borrowed Rust trees remain caller-owned; arbitrary unverified clone/Drop and legacy unchecked construction APIs are outside this protection.
The reader retains legacy
undeffor existing lowering compatibility. This does not complete initialization tracking (#65), runtime trap enforcement, pointer shadow metadata, an interpreter or native code generation. AST JSON remains format 2; text format 2 needs explicit migration, and future incompatible syntax/semantics requires a corresponding version change.Validation
All 23 registered GitHub CI checks passed on 32f1442, including Windows x64/ARM64 default/all, Linux/macOS, Rust 1.86, optimized regressions, RISC-V QEMU, coverage and Wave ELF. Documentation PR #480 has all four checks passing. Both PRs remain open for review.
Official reference/CLI/support-status documentation is in wavefnd/wave-platform#480, with executable IR/Rust examples and all nine existing locales. Merge the implementation before that documentation PR. No automatic merge or deployment.
Closes #238
Closes #239
Closes #83